[Bioperl-l] error message: can't call method "next_hit" on andundefined value

Mark A. Jensen maj at fortinbras.us
Tue Jun 16 19:32:02 UTC 2009


lomspace-
this

my $in = new Bio::SearchIO(-format => 'blast',
                           -file   => ">".$maid_dir."\\".$maid."aln_hu.aln",
   -report_type => 'blastn');

should be

my $in = new Bio::SearchIO(-format => 'blast',
                           -file   => $maid_dir."\\".$maid."aln_hu.aln",
   -report_type => 'blastn');

if you're reading the file. Then $result will have something in it when
you do $in->next_result

cheers, MAJ
----- Original Message ----- 
From: "Mgavi Brathwaite" <lsbrath at gmail.com>
To: <Bioperl-l at lists.open-bio.org>
Sent: Tuesday, June 16, 2009 11:42 AM
Subject: [Bioperl-l] error message: can't call method "next_hit" on andundefined 
value


> Hello,
> My method produces an error message stating that it can't call a "next_hit"
> method on an undefined value.
>
> Hello,
> My method produces an error message stating that it can't call a "next_hit"
> method on an undefined value.
>
> sub hu_bl2seq_parser{
> my ($maid, $maid_dir) = @_;
> # Get the report
> my $in = new Bio::SearchIO(-format => 'blast',
>                           -file   => ">".$maid_dir."\\".$maid."aln_hu.aln",
>    -report_type => 'blastn');
> #open(my $out, ">$maid_dir/".$maid."aln_hu_parsed.out");
> #my $out = Bio::AlignIO->newFh(-format => 'clustalw' );
> my $result=$in->next_result;
> my($hu_aln,$hu_mismatches);
> # Get info about the first hit
> my $hit = $result->next_hit;
> my $name = $hit->name;
> # get info about the first hsp of the first hit
> my $hsp = $hit->next_hsp;
> # get the alignment object
> my $aln = $hsp->get_aln;
> #my $percent_id = $hsp->percent_identity;
> #my $aln_length = $hsp->length('total');
> my @mismatches = $hsp->seq_inds('query','nomatch');
> my $aln_str="";
> # access the alignment string
> my $strIO=IO::String->new($aln_str);
> #  write the string alignio in clustalw format
> my $alnio = Bio::AlignIO->new(-format => 'clustalw', -fh=>$strIO);
> # now the actual alignment string is accessable for printing or in
> this case moving to a db table
> $alnio->write_aln($aln);
> $hu_aln=$aln_str;
> $hu_mismatches = scalar @mismatches;
> return($hu_aln, $hu_mismatches);
> }
>
> The problem is at "my $hit = $result->next_hit;"
> Any help will be appreciated.
> LomSpace
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> 




More information about the Bioperl-l mailing list