Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

mitoprot bioperl code help

by cburger (Acolyte)
on Mar 20, 2012 at 18:09 UTC ( [id://960612]=perlquestion: print w/replies, xml ) Need Help??

cburger has asked for the wisdom of the Perl Monks concerning the following question:

Hi I'm new to bioperl and am trying to use the bioperl mitoprot wrapper to search protein sequences for mitochondrial target sequences. I tried the test code provided on the wiki link with Spombe fasta file. however I still have problems when it is supposed to read through a whole fasta file. it stops after the first sequence and doesn't go through the whole file. Any idea why? When I leave out the mitprot code part - and just print the id's it reads the whole file.

#!/usr/bin/perl-w use strict; use Bio::Tools::Analysis::Protein::Mitoprot; use Bio::PrimarySeq; use Bio::SeqIO; my $inputstream = Bio::SeqIO->new(-file => "myseq2.fa",-format => 'Fa +sta'); # my $seqobj = $inputstream->next_seq(); while (my $seqobj = $inputstream->next_seq){ # print the sequence print ">"; print $seqobj->id,"\n"; my $seq= $seqobj-> seq; my $id= $seqobj->id; my $seq = new Bio::PrimarySeq(-seq=>$seq, -primary_id=>$id); my $mitoprot = Bio::Tools::Analysis::Protein::Mitoprot->new(-seq +=> $seq); # sequence must be >!5aa long and start with an M. $mitoprot->run(); die "Could not get a result" unless $mitoprot->status =~ /^COMPLETED +/; print $mitoprot->result; # print raw prediction to STDOUT my $rawdata = my $analysis_object->result; print "rawdata: $rawdata\n"; ## .................................................... } # close while

here is the output I get with error message :

>SPAC212.11.1 Input sequence length : 1887 aa VALUES OF COMPUTED PARAMETERS Net charge of query sequence : -14 Analysed region : 5 Number of basic residues in targeting sequence : 0 Number of acidic residues in targeting sequence : 0 Cleavage site : not predictable Cleaved sequence : HYDROPHOBIC SCALE USED GES KD GVH1 ECS H17 : 1.776 1.635 0.456 0.701 MesoH : -0.097 0.599 -0.205 0.261 MuHd_075 : 8.891 2.722 0.982 0.422 MuHd_095 : 40.686 26.860 12.359 9.439 MuHd_100 : 45.583 25.681 12.613 9.543 MuHd_105 : 45.113 22.080 11.556 8.739 Hmax_075 : 1.867 9.625 -1.365 2.660 Hmax_095 : 15.800 20.400 3.835 6.380 Hmax_100 : 16.000 20.300 3.835 6.190 Hmax_105 : 15.600 15.600 2.796 5.250 PROBABILITY of export to mitochondria: 0.5284 Can't call method "result" on an undefined value at test.pl line 36, < +GEN0> line 1.

Thanks again!

Replies are listed 'Best First'.
Re: mitoprot bioperl code help
by onelesd (Pilgrim) on Mar 20, 2012 at 18:20 UTC

    This line:

    my $mitoprot->run();

    should probably read:

    $mitoprot->run();
Re: mitoprot bioperl code help
by molecules (Monk) on Mar 20, 2012 at 18:26 UTC

    Add the line use strict; at the beginning of your code. After you do this, then you'll get an error message telling you that you tried to declare $mitoprot again (i.e. using my). It's at this line:

    my $mitoprot->run();
Re: mitoprot bioperl code help
by molecules (Monk) on Mar 20, 2012 at 18:53 UTC
    This much works on my machine.
    use 5.008; # Require at least Perl version 5.8 use strict; # Must declare all variables before using them use warnings; # Emit helpful warnings use Bio::Tools::Analysis::Protein::Mitoprot; use Bio::PrimarySeq; my $seq = new Bio::PrimarySeq( -seq =>'MIKLCVHHJHJHJHJHJHJHNLAILAKAHLIELALAL', -primary_id=>'test', ); # a Bio::PrimarySeqI object my $mitoprot = Bio::Tools::Analysis::Protein::Mitoprot->new(-seq => $s +eq); # sequence must be >!5aa long and start with an M. # run Mitoprot prediction on amino acid sequence $mitoprot->run(); print $mitoprot->result; # print raw prediction to STDOUT 1;
    It gives the following output:
    Input sequence length : 31 aa
    
    
                     VALUES OF COMPUTED PARAMETERS
    
    Net charge of query sequence                    :  +1
    Analysed region                                 :  28
    Number of basic residues in targeting sequence  :   2
    Number of acidic residues in targeting sequence :   1
    Cleavage site                                   : not predictable
    Cleaved sequence                                : 
    
                             HYDROPHOBIC SCALE USED
    
                        GES       KD       GVH1       ECS
    
    H17         :      0.365     1.571    -0.153     0.534
    MesoH       :     -0.410    -0.410    -0.410    -0.410
    MuHd_075    :     16.751     8.794     5.615     2.837
    MuHd_095    :     19.407    14.027     7.300     3.693
    MuHd_100    :     14.856    12.028     6.718     2.831
    MuHd_105    :     17.763    15.164     7.100     3.885
    Hmax_075    :      5.017     5.000    -2.544     3.990
    Hmax_095    :      8.313    10.762     0.128     3.806
    Hmax_100    :      6.100    10.400     0.010     3.710
    Hmax_105    :      4.433     8.400    -2.501     3.640
    
                                PROBABILITY
    
    of export to mitochondria: 0.0001
    

      Thanks all for the help, I got it to run on the test file. I'm trying now to get it reading through a whole fasta file. But it stops after the first sequence and doesn't go through the whole file. Any idea why?

      #!/usr/bin/perl-w use strict; use Bio::Tools::Analysis::Protein::Mitoprot; use Bio::PrimarySeq; use Bio::SeqIO; my $inputstream = Bio::SeqIO->new(-file => "myseq2.fa",-format => 'Fa +sta'); while (my $seqobj = $inputstream->next_seq){ # print the sequence print ">"; print $seqobj->id,"\n"; my $seq= $seqobj-> seq; my $id= $seqobj->id; my $seq = new Bio::PrimarySeq(-seq=>$seq, -primary_id=>$id); my $mitoprot = Bio::Tools::Analysis::Protein::Mitoprot->new(-seq +=> $seq); # sequence must be >!5aa long and start with an M. $mitoprot->run(); die "Could not get a result" unless $mitoprot->status =~ /^COMPLETED +/; print $mitoprot->result; # print raw prediction to STDOUT my $rawdata = my $analysis_object->result; print "rawdata: $rawdata\n"; ## .................................................... } # close while

      here is the output I get with error message :

      >SPAC212.11.1 Input sequence length : 1887 aa VALUES OF COMPUTED PARAMETERS Net charge of query sequence : -14 Analysed region : 5 Number of basic residues in targeting sequence : 0 Number of acidic residues in targeting sequence : 0 Cleavage site : not predictable Cleaved sequence : HYDROPHOBIC SCALE USED GES KD GVH1 ECS H17 : 1.776 1.635 0.456 0.701 MesoH : -0.097 0.599 -0.205 0.261 MuHd_075 : 8.891 2.722 0.982 0.422 MuHd_095 : 40.686 26.860 12.359 9.439 MuHd_100 : 45.583 25.681 12.613 9.543 MuHd_105 : 45.113 22.080 11.556 8.739 Hmax_075 : 1.867 9.625 -1.365 2.660 Hmax_095 : 15.800 20.400 3.835 6.380 Hmax_100 : 16.000 20.300 3.835 6.190 Hmax_105 : 15.600 15.600 2.796 5.250 PROBABILITY of export to mitochondria: 0.5284 Can't call method "result" on an undefined value at test.pl line 36, < +GEN0> line 1.

      Thanks!!

        Try removing these lines and seeing if it works:
        my $rawdata = my $analysis_object->result; print "rawdata: $rawdata\n";
Re: mitoprot bioperl code help
by molecules (Monk) on Mar 20, 2012 at 18:38 UTC
    You also need to create $analysis_object somehow.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://960612]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-23 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found