美文网首页
提取domain的序列

提取domain的序列

作者: 余绕 | 来源:发表于2022-01-14 23:33 被阅读0次

Owing to the need for the domain sequences of proteins to build the phylogenetic tree, the following codes were written.

open FA, "$ARGV[0]";
$/=">";
<FA>;
while(<FA>){
    chomp;
    my($id,$seq)=(split /\n/,$_,2)[0,1];
    $seq=~s/\n//g;
    
    $hash{$id}=$seq;
    #print">$id\n$seq\n";

    
    
}

$/="\n";

open IN, "$ARGV[1]";

while(<IN>){
    chomp;
    @temp=split /\t/,$_;
    $length=$temp[2]-$temp[1]+1;
    if(exists $hash{$temp[0]}){
        $sequnce=substr($hash{$temp[0]},$temp[1]-1,$length);
        print ">$temp[0]\n$sequnce\n";
        
        
    }
        
}

input1 file


image.png

input2 file:


image.png

Running the code:

perl .\Domain_seq_extrac.pl  .\ALl_combined_1.txt   .\Domain_for_perl.txt

Results:


image.png

相关文章

网友评论

      本文标题:提取domain的序列

      本文链接:https://www.haomeiwen.com/subject/sxozcrtx.html