[Bioperl-l] XML -> Flat Query-Anchored & Identities
simon andrews (BI)
simon.andrews at bbsrc.ac.uk
Wed Aug 6 05:16:18 EDT 2003
> -----Original Message-----
> From: Fanteï Caujolle Yan [mailto:Yan.Fantei at unice.fr]
> Sent: 06 August 2003 09:31
> To: bioperl-l at bioperl.org
> Subject: [Bioperl-l] XML -> Flat Query-Anchored & Identities
>
>
> Hello all,
>
> How to create a "Flat Query-Anchored with Identities" report from xml
> blast result (option -m7 of Blast) ?
Not exactly sure of the output format you want, but you probably want
to use the Bio::SearchIO module to parse your blast report.
#!/usr/bin/perl -w
use strict;
use Bio::SearchIO;
my $search = Bio::SearchIO -> new (-format => 'blastxml',
-file => 'your_blast_file.xml');
# Assuming you only have one report in your file.
# You can put this in a loop for a multiple report file
my $report = Bio::SearchIO -> next_report();
while (my $hit = $report -> next_hit()){
print "Found a hit to ", $hit->name;
print " which is ", $hit->description() , "\n";
# Again you can put this bit in a loop if you want
# details for individual hsps
my $first_hsp = $hit -> next_hsp();
print "Total length of hit was ", $hsp->length('total'),"bp \n";
print "Total identity of hit was ", $hsp->frac_identical('total'),"% \n";
}
More information about the Bioperl-l
mailing list