- 论坛徽章:
- 0
|
本帖最后由 conan_swu 于 2015-05-12 16:31 编辑
- #!/usr/local/bin/perl -w
- #This progrem transfer the BLAST result include the Query sites and Sbject sites to the excel file.
- $vision="Vision: 2.0"; #nipx 2001-7-20
- $vision="Vision: 3.0"; #nipx 2002-4-11
- use Getopt::Std;
- getopts "o:i:e:a:l:s:";
- print "*************\n*$vision*\n*************\n";
- if ((!defined $opt_i)|| (!defined $opt_o) ) {
- die "************************************************************************
- Usage:transferall.pl -i filename -o outfile.
- -h : help and usage.
- -v : vision.
- -e : expect value(default 10)
- -a : identity% (default 0)
- -l : alignment length (default 0)
- -s : score (default 0)
- ************************************************************************\n";
- }
- $Expect = (defined $opt_e) ? $opt_e : 10;
- $Length = (defined $opt_l) ? $opt_l : 0;
- $Identity = (defined $opt_a) ? $opt_a : 0;
- $Score = (defined $opt_s) ? $opt_s : 0;
- open(Ofile,">$opt_o.ext");print "Running.....\n";
- open (F,$opt_i) || die"can't open $opt_i:$!\n";
- $i=$q=$s=$a=0;
- printf Ofile "%8s %8s %8s %8s %8s %8s %8s %8s %10s %8s %5s %8s %8s\n", "Letter","QueryX","QueryY","SbjctX", "SbjctY","Length","Score","E value","Overlap/total","Identity","Fram","Query name","Sbject Name";
- while (<F>)
- {
- if (/Query= (\S+)/)
- {
- if($i==1)
- {
- #print Ofile "$query^$letter^Query:$qbegin----$qend^Sbject:$sbegin----$send^$name^$annotation^$length^$score^$expect^$identity^$over\n";
- if($score >$Score && $expect<=$Expect && $over>=$Identity && $identity2 >= $Length)
- {
- $ovalap_total = "$identity1/$identity2";
- printf Ofile "%8s %8s %8s %8s %8s %8s %8s %8s %10s %8s %5s %8s %8s %20s\n",$letter,$qbegin,$qend,$sbegin,$send,$length,$score,$expect,$ovalap_total,$over,$fram,$query,$name,$annotation;
- }
- $i=$q=$s=0;
- $query=$letter=$qbegin=$qend=$sbegin=$send=$name=$annotation=$length=$score=$expect=$identity=$over=0;
- }
- $query=$1;
- }
- elsif (/\((\S+)\s+letters\)/)
- {
- $letter=$1;$letter=~s/,//;
- }
- elsif (/^>(\S*)\s+(.*)/)
- {
- if($i==1)
- {
- if($score >$Score && $expect<=$Expect && $over>=$Identity && $identity2 >= $Length)
- {
- $ovalap_total = "$identity1/$identity2";
- printf Ofile "%8s %8s %8s %8s %8s %8s %8s %8s %10s %8s %5s %8s %8s %20s\n",$letter,$qbegin,$qend,$sbegin,$send,$length,$score,$expect,$ovalap_total,$over,$fram,$query,$name,$annotation;
- }
- $i=$q=$s=0;
- $qbegin=$qend=$sbegin=$send=$name=$annotation=$length=$score=$expect=$identity=$over=0;
- }
- $name=$1;
- $annotation=$2;
- $a=1;
- }
- elsif (/Length = (\d+)/)
- {
- $length=$1;
- $a=0;
- }
- elsif ($a==1)
- {
- chomp;
- $annotation.=$_;
- $annotation=~s/\s+/ /g;
- } #This sentence could get the very long annotation that is longer than one line;
- elsif (/Score = (.+) bits.+Expect\S* =\s+(\S+)\s*/)
- {
- if($i==1)
- {
- if($score >$Score && $expect<=$Expect && $over>=$Identity && $identity2 >= $Length)
- {
- $ovalap_total = "$identity1/$identity2";
- printf Ofile "%8s %8s %8s %8s %8s %8s %8s %8s %10s %8s %5s %8s %8s %20s\n",$letter,$qbegin,$qend,$sbegin,$send,$length,$score,$expect,$ovalap_total,$over,$fram,$query,$name,$annotation;
- }
- $i=$q=$s=0;
- $qbegin=$qend=$sbegin=$send=$score=$expect=$identity=$over=0;
- }
- $score=$1;$expect=$2;$expect=~s/^e/1e/;
- }
- elsif (/Identities = (\d+)\/(\d+)\s+\((.{0,4})%\)/)
- {
- $identity1=$1;
- $identity2=$2;
- $over=$3;
- }
- elsif (/Frame = (\S+)/)
- {
- $fram = $1;
- }
- elsif (/Query\:\s+(\d+)\s+\S+\s+(\d+)/)
- {
- if($q==0)
- {
- $qbegin=$1;
- }
- $qend=$2;
- $q=1;
- }
- elsif (/Sbjct\:\s+(\d+)\s+\S+\s+(\d+)/)
- {
- if($s==0)
- {
- $sbegin=$1;
- }
- $send=$2;
- $s=$i=1;
- }
- }
- if(($score>$Score && $Expect<=$Expect && $over>=$Identity && $identity2 >= $Length)&&($i==1))
- {
- $ovalap_total = "$identity1/$identity2";
- printf Ofile "%8s %8s %8s %8s %8s %8s %8s %8s %10s %8s %5s %8s %8s %20s\n",$letter,$qbegin,$qend,$sbegin,$send,$length,$score,$expect,$ovalap_total,$over,$fram,$query,$name,$annotation;
- }
- close(F);
- close(Ofile);
复制代码 使用的时候会报错: use of uninitialized value $score in numeric gt (> at d:\perl\eblastp.pl line 119, <F> line 6389.
果断小白,不知道哪里的问题,跪求指点。
|
|