1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| [color=green]
#found FASTA header
if ($char eq ">") {
#see if this is not the first fasta file
if (length($cur_header) > 0) {
#get the results
@pos_TGIKV = findTGIKV($complete_sequence);
@pos_PADVL = findPADVL($complete_sequence);
@pos_YY = findYY($complete_sequence);
@pos_WalkerA = findWalkerA($complete_sequence);
#get the header
$cur_header = splitHeader($cur_header) ;
%motifs_found = ( "TGIKV" => $pos_TGIKV[0],
"PADVL" => $pos_PADVL[0],
"YY" => $pos_YY[0],
);
@motifs_sorted_names = qw();
@motifs_sorted_locations = qw();
$key = "";
foreach $key (sort { $motifs_found{$a} cmp $motifs_found{$b} } keys(%motifs_found)) {
if ($motifs_found{$key} > 0) {
push(@motifs_sorted_names,$key);
push(@motifs_sorted_locations,$motifs_found{$key});
}
}
for (my $i = 0;$i<@motifs_sorted_names;$i++) {
if (@motifs_sorted_names == 1) { #the sequence analyzed contains only 1 pattern
#(ie TGIKV or PADVL or YY)
$header2 = $header2 . $motifs_sorted_names[$i] . " " . $motifs_sorted_locations[$i] . " ";
}
elsif ($i == @motifs_sorted_names - 1) { #the sequence analyzed contains 2 of the 3 patterns
#(ie TGIKV-PADVL, TGIKV-YY, PADVL-YY, etc)
$header2 = $header2 . $motifs_sorted_names[$i] . "(pos = ".$motifs_sorted_locations[$i] . ")";
}
else { #the sequence analyzed contains more than 2 patterns
#(ie: the 3 patterns, or many occurences of the same patterns, etc)
my $diff = int($motifs_sorted_locations[$i+1]) - int($motifs_sorted_locations[$i]);
$header2 = $header2 . $motifs_sorted_names[$i] . " (pos = " .$motifs_sorted_locations[$i] . ") <- " . $diff . " -> ";
}
}
print " --> ";
print $header2;
print "\n";
if (@pos_WalkerA > 0) {
$cur_header = $cur_header . " WalkerA";
for (my $i = 0;$i<@pos_WalkerA;$i++) {
$cur_header = $cur_header . " $pos_WalkerA[$i]";
}
}
print "$cur_header\t";
} |
Partager