[Bioperl-l] bioperl1.5 generate_cigar_string

Jason Stajich jason.stajich at duke.edu
Tue Apr 12 14:48:42 EDT 2005


You should be able to just call:
my $cigarstring = $hsp->cigar_string.

it takes care of delegating to generate_cigar_string for you.

Otherwise you can call it explicitly ( the previous will cache the call  
for you )
$hsp->generate_cigar_string($Qseq, $Sseq);

You need to have instantiated an HSP object to call this method because  
it further delegates to other methods (_sub_cigar_string).

-jason
--
Jason Stajich
jason.stajich at duke.edu
http://www.duke.edu/~jes12/

On Apr 12, 2005, at 2:12 PM, Susan J. Miller wrote:

>  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, $Sseq);
> 	    #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  
> "tgctgcgttctccatcgatgccatatttgaccccaccccgacattttcccctcgcgaaagggttgaggta 
> ggaagcgcacgcgcaaccactcccttgacccaaccaccaacaaaaaggctcgcccaagcaaacacataaac 
> caccgccgccgccttttggagagaaccaactatggaggcccacatcttccaacgaacaaaggaccgagcac 
> cgccgctacgaacgagtctgaatttttccatcgtgtttcccaagcacctcgactgcagcaaccatgccccg 
> ccgaacggaccgttggagagggggctcccgggcaacgagcttccgaaccccatacaaaaaacacgctaggg 
> gaaataataacaaaggatgggacaagcacaagcatcgcttgcaagtgcacgaaacaacaagcgtgaactca 
> agataggcaactaaaaatgttgcgagtctctttcgcaagaggcaccaccccgacaaagcatcaaacccgct 
> cacctagagacacaccacacgttcctagattacatacaatcgaaacccacacacaacccaaacgaaaaaac 
> aaaacagccctgctatcaatgatcctaccgcaggttcacctacggaaaaccttgttacgacttcta" 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?
>
>
> Thanks,
>
> Susan J. Miller
> Biotechnology Computing Facility
> University of Arizona
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>



More information about the Bioperl-l mailing list