[Bioperl-l] bioperl1.5 generate_cigar_string

Susan J. Miller sjmiller at email.arizona.edu
Tue Apr 12 14:12:16 EDT 2005

  I am using bioperl 1.5 on a Solaris 8 system.  I'm trying to use the 
generate_cigar_string method in the following script, but I can't get it 
to work.  My input file is a normal blast output (no -m option).  Can 
someone tell me if I'm doing something incorrectly?

#!/usr/local/bin/perl -w

use lib '/export/home/susanjo/bioperl-1.5.0';
use Bio::SearchIO;
use Bio::Search::HSP::GenericHSP;

$fil = shift(@ARGV);
$srchio = new Bio::SearchIO ('-format' => 'blast', '-file' => $fil);

# Look at the results for each Query
while ($result = $srchio->next_result) {

     # Look at each subject hit
     while ($hit = $result->next_hit) {
	$hitnam = $hit->name;
	$acc = $hit->accession;
	print  "ACC $acc HIT $hitnam\n";

	# Within a hit there are one or more HSPs (High Scoring Pairs)
         while ($hsp = $hit->next_hsp) {
	    $Qseq = $hsp->query_string;
	    $Sseq = $hsp->hit_string;
	    $cigar = Bio::Search::HSP::GenericHSP::generate_cigar_string($Qseq, 
	    #print "CIGAR: $cigar\n";


The error message is:
Use of uninitialized value in split at 
/export/home/susanjo/bioperl-1.5.0/Bio/Search/HSP/GenericHSP.pm line 
1269, <GEN1> line 717.
Can't locate object method "throw" via package 
at /export/home/susanjo/bioperl-1.5.0/Bio/Search/HSP/GenericHSP.pm line 
1271, <GEN1> line 717.

I also tried changing my script like this:
$cigar = Bio::Search::HSP::GenericHSP->generate_cigar_string($Qseq, $Sseq);

but then the error is:
Can't use string ("Bio::Search::HSP::GenericHSP") as a HASH ref while 
"strict refs" in use at 
/export/home/susanjo/bioperl-1.5.0/Bio/Search/HSP/GenericHSP.pm line 
1275, <GEN1> line 717.

Am I using this incorrectly?


Susan J. Miller
Biotechnology Computing Facility
University of Arizona

More information about the Bioperl-l mailing list