Skip to content

Instantly share code, notes, and snippets.

@wakuteka
Created September 1, 2015 09:05
Show Gist options
  • Save wakuteka/aed0efcc66bfa60ddd39 to your computer and use it in GitHub Desktop.
Save wakuteka/aed0efcc66bfa60ddd39 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
my $target="ATcgAGCGTTTCG";
my $line;
open (DATAFILE, " < /home/work/biol/References/hg19/chr2.fa")) or die("error: no such file! \n!);
print $target."\n";
while ($line = <DATAFILE>)
{
$target=uc($line);
my @pos;
@pos[0]=0;
for(my $i=1; $i<=3; $i++){
@pos[$i] = index($target,"CG",@pos[$i-1]) + 1;
print "$i\t@pos[$i]\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment