IUBio GIL .. BIOSCI/Bionet News .. Biosequences .. Software .. FTP

seeking blast to fasta or similar

Jason Stajich jason at chg.mc.duke.edu
Thu Aug 24 09:45:46 EST 2000


You will need bioperl installed.

Check out bioperl (www.bioperl.org) for more info and how to obtain install
bioperl.

use Bio::Tools::Blast;
use Bio::DB::GenBank;
use Bio::SeqIO;

die("usage: blast_fetch blastfile outputfile") if( @ARGV != 2 );
my $db = new Bio::DB::GenBank;
my $blast = Bio::Tools::Blast->new(-file   =>@ARGV[0],
     -signif => 1e-5,
     -parse  => 1,
     -stats  => 1,
     -check_all_hits => 1,
     );
my $seqio = new Bio::SeqIO(-format=>'Fasta', -file=>">$ARGV[1]");
my ($an,$seq);
foreach my $hit ( $blast->hits) {
    (undef,$an) = split(/\|/, $hit->name);
    $seq = $db->get_Seq_by_id($an);
    if( defined $seq ) {
 $seqio->write_seq($seq);
    }
}


--
Jason Stajich
jason at nospam-chg.mc.duke.edu

"Neil Saunders" <s3003334 at pop3.unsw.edu.au> wrote in message
news:8nfnin$d8d$1 at mirv.comms.unsw.edu.au...
> I'm currently websurfing for an answer to this problem, but perhaps
someone
> knows a quick answer.  Basically, I'm looking for a quick way to download
> sequences obtained from a BLAST search and make a multiple Fasta format
file
> of those hits plus my query sequence.  Currently, I do my BLAST search,
then
> click on the accession numbers of the best hits to go to the sequence
> database entry.  From there I convert them to Fasta, then copy and paste
> into a new file.
>
> A slightly quicker way is to use the 'related sequences' facility from a
> search at NCBI and download all hits as Fasta.  But this is still quite
> tedious.  What I'd really like is a facility that would parse a BLAST
file,
> extract the top sequences from the database and give them in Fasta format.
> Does anyone know of such a thing?
>
> thanks,
>
> Neil Saunders
>
> --
> School of Microbiology & Immunology,
> University of New South Wales,
> Sydney 2052,
> Australia
>
> Ph: +61 2 9385 2093
> Fx: +61 2 9385 1591
> email: neil.saunders at unsw.edu.au
> http://www.crosswinds.net/~nfws/index.htm
> ArchaeaWeb
> http://www.crosswinds.net/~nfws/archaea/index.htm
>
>
>
>
>
>








More information about the Bio-www mailing list

Send comments to us at archive@iubioarchive.bio.net