[Bioperl-l] Sorting BLAST Output
Andrew Walsh
walsh at cenix-bioscience.com
Tue Apr 5 14:47:25 EDT 2005
Hello,
One 'easy' way to do this is to build an array of hashes with the hits
and whatever feature you are interested. It's a pure perl
implementation. I don't think the API for the Bioperl search result
object supports the sorting you want to do, but I could be wrong.
my @hashes;
for my $hit (@your_hits) {
my $len = get_aln_len($hit);
my $num_mis = get_num_mis($hit);
push @hashes, { hit => $hit, len => $len, num_mis => $num_mis };
}
my @sorted = sort by_len_and_num_mis @hashes;
sub by_len_and_num_mis {
$a->{len} <=> $b->{len} ||
$a->{num_mis} <=> $b->{num_mis}
}
Andrew
Waibhav Tembe wrote:
> Hello List,
>
> I was wondering if there is any easy way to "sort" the hits in a blast
> output based on something other than the default sort key E value/bits.
> For example, I would like to sort the hits based on the number of
> mismatches or length of the alignments reported.
>
> I considered blast2table utility. But I would like to retain all the
> details in the BLAST output.
>
> Thanks.
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
--
------------------------------------------------------------------
Andrew Walsh, M.Sc.
Bioinformatics Software Engineer
IT Unit
Cenix BioScience GmbH
Tatzberg 47
01307 Dresden
Germany
Tel. +49-351-4173 137
Fax +49-351-4173 109
public key: http://www.cenix-bioscience.com/public_keys/walsh.gpg
------------------------------------------------------------------
More information about the Bioperl-l
mailing list