#!/usr/bin/perl open(FO,">Annotations.cds"); open(FI,"Predictions.cds"); while($line=){ chomp($line); @col=split(/\s+/,$line); $name="$col[0]"; $length=0;$s=0; open(FA,"CreateDb.example.fa"); while($lfa=){ chomp($lfa); if(index($lfa,">")==0){ if($s==1){ last; } $nim=substr($lfa,1,length($lfa)-1); if($nim eq "$name"){ $s=1; next; } } if($s==1){ $lfa=~tr/[a-z]/[A-Z]/; $lfa=~s/[^A-Z]//g; $lin=length($lfa); $length+=$lin; } } close FA; splice(@col,1,0,$length); print FO "@col\n"; } close FI; close FO;