[Bioperl-l] Start and end of query sequence in HSPs

Wiepert, Mathieu Wiepert.Mathieu@mayo.edu
Wed, 16 Oct 2002 10:29:32 -0500


Hi,

The blast object can get the query and hit starts and stops, like this (assumes you know how to get the blastobj, which you made it sound like you had already achieved?)

$hsp->query->start()
$hsp->query->end()
$hsp->hit->start()
$hsp->hit->end()


This code works with the bioperl-live code as well...


my $result = $blastobj->next_result;
print "Query Name: ", $result->query_name(), "\n";
while( my $hit = $result->next_hit ) {
  print "\tHit Accession#: ", $hit->accession(), "\n";
  print "\tHit Name: ", $hit->name(), "\n";
  while (my $hsp = $hit->next_hsp()) {
    my $len = $hsp->length('query');
    print "\t\tQuery Length:  ", $hsp->length('query'), "\n";
    print "\t\tQuery Start: ", $hsp->query->start(), "\n";
    print "\t\tQuery End: ", $hsp->query->end(), "\n";
    print "\t\tHSP Hit Start: ",$hsp->hit->start(), "\n";
    print "\t\tHSP Hit End: ",$hsp->hit->end(), "\n";
    #frac_conserved in the hsp is what some consider the similarity percentage.
    print "\t\tSimilarity Percentage: ",$hsp->frac_conserved('query'), "\n";
    print "\t\tSimilar: ",sprintf("%.0f", $hsp->frac_conserved('query')*$len), "\n";
    print "\t\tIdentical Percentage: ",$hsp->frac_identical('query'), "\n";
    print "\t\tIdentical: ", sprintf("%.0f", $hsp->frac_identical('query')*$len), "\n";
    print "\t\tHit Length: ", $hit->length, "\n";
  }
}



-Mat

> -----Original Message-----
> From: Kasper Munch Terkelsen [mailto:kmt@daimi.au.dk]
> Sent: Wednesday, October 16, 2002 10:11 AM
> To: bioperl-l@bioperl.org
> Subject: [Bioperl-l] Start and end of query sequence in HSPs
> 
> 
> Dear all
> 
> Does anyone know how to get hold of the start and end positions of a
> sbjct sequence in a HSP? I am using the StandAloneBlast module, so I
> think I am confined to using the Search and SearchIO modules to parse
> the BLAST reports because the blastall method returns a blast
> object. So what I am after is simply the two numbers at the ends of
> each HSP as they appear in the blast report. Please help me, I am
> desperate!
> 
> Regards Kasper
> 
> -- 
> Kasper Munch Terkelsen
> Bioinformatics Centre
> University of Copenhagen
> 15, Universitetsparken
> 2100 Copenhagen Ø
> Denmark
> 
> Office  tlf. +45 3532 1348 (Direct)
> 	tlf. +45 3532 1313 (Secretary)
> Home:	tlf. +45 3296 1516
> Email   kmt@daimi.au.dk
> Homepage http://www.daimi.au.dk/~kmt
> ----------------------------------------
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>