Mercurial > repos > dereeper > pgap
diff PGAP-1.2.1/Blast_Filter.pl @ 0:83e62a1aeeeb draft
Uploaded
author | dereeper |
---|---|
date | Thu, 24 Jun 2021 13:51:52 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PGAP-1.2.1/Blast_Filter.pl Thu Jun 24 13:51:52 2021 +0000 @@ -0,0 +1,51 @@ +#!/usr/bin/perl +use strict; +use warnings; + + +my $BLASTResult=$ARGV[0]; +my $SEQFile=$ARGV[1]; +my $coverage=$ARGV[2]; +my $identity=$ARGV[3]*100;#percents +my $score=$ARGV[4]; +my %hash; +my @row; +my $line; + +#my $coverage=0.5; +#my $identity=50;#percents +#my $score=50; + +&ReadSeqLength("$SEQFile",\%hash); + +open(F,$BLASTResult); +while ($line=<F>) + { + if ($line!~/\#/) + { + @row=split(/\t/,$line); + if ($row[2]>=$identity and $row[11]>=$score) + { + if ((($row[7]-$row[6]+1)/$hash{$row[0]})>=$coverage) + { + if ((($row[9]-$row[8]+1)/$hash{$row[1]})>=$coverage) + { + print "$row[0]\t$row[1]\t$row[11]"; + } + } + } + } + } +close(F); + +sub ReadSeqLength() + { + use Bio::SeqIO; + (my $file,my $hash)=@_; + my $seq; + my $in=Bio::SeqIO->new(-file=>"$file",-format=>"fasta"); + while ($seq=$in->next_seq()) + { + $$hash{$seq->id}=length($seq->seq()); + } + } \ No newline at end of file