其他分享
首页 > 其他分享> > 拟南芥基因注释

拟南芥基因注释

作者:互联网

Athaliana_447_Araport11.annotation_info.txt文件下载链接 https://phytozome.jgi.doe.gov/pz/portal.html#!bulk?org=Org_Athaliana_er

#!/usr/bin/perl

my $infile=shift;
my $gene_num=shift;
my $outfile=$infile.".annotation.txt";
$gene_num-=1;

my %anno_hash;

$usage="USAGE:
    perl $0 infile line_number\n";
unless($infile && $gene_num>=1){
    die "$usage";
}

my $anno_file="./Athaliana_447_Araport11.annotation_info.txt";
open ANNO,$anno_file or die "fileOpenError: unable to open $anno_file\n";
while(<ANNO>){
    chomp;
    my @line=split "\t",$_;
    if($line[12]){
        $anno_hash{$line[1]}=$line[12];
    }
}
close ANNO;


open INFILE,$infile or die "fileOpenError: unable to open $infile\n";
open OUTFILE,">".$outfile;
while(<INFILE>){
    chomp;
    my $line=$_;
    my @line=split "\t",$line;
    my $gene=$line[$gene_num];
    $gene=~s/\..*//g;
    if(exists $anno_hash{$gene}){
        print OUTFILE "$line\t$anno_hash{$gene}\n";
    }
    else{
        print OUTFILE "$line\n";
    }
}
close INFILE;
close OUTFILE;

标签:anno,open,基因,注释,拟南芥,line,gene,my,infile
来源: https://blog.csdn.net/weixin_40099163/article/details/110438536