#!/usr/bin/perl -w ####################################################################### ### Huang He ### ### take fasta file from original fasta by blasted(unfinished) file ### ####################################################################### ($bwa,$fasta)=@ARGV; open(File,"$bwa")||die "can't open the $bwa\n"; while(){ chomp; s/\c@*//g; s/\cM*$//; if(/^\@SQ/){ next; } @temp=split; if($temp[2] eq "*"){ $id{$temp[0]}=0; } # print"$query\n"; } close File; open(File,"$fasta")||die "can't open the $fasta\n"; $flag=0; while(){ chomp; s/\c@*//g; s/\cM*$//; $line=$_; if(/^\>/){ $flag=1; $line=~s/\>//g; if(! exists $id{$line}){ $flag=0; next; } print">$line\n"; next; } if($flag==0){ next; } print"$line\n"; } close File;