[Bioperl-l] One letter protein sequence to three letters

Smithies, Russell Russell.Smithies at agresearch.co.nz
Tue Mar 26 23:44:35 UTC 2013


You're passing an ordinary String to Bio::SeqUtils->seq3 (that's what $hsp->query_string returns) but  I think it needs to be a Bio::PrimarySeqI compliant object.

try this:

$seqobj = Bio::PrimarySeq->new ( -seq => $hsp->query_string);
$polypeptide_3char = Bio::SeqUtils->seq3($seqobj);


--Russell

-----Original Message-----
From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Antony03
Sent: Wednesday, 27 March 2013 12:24 p.m.
To: Bioperl-l at lists.open-bio.org
Subject: [Bioperl-l] One letter protein sequence to three letters


Hi!

I wan't to parse a blastp output for have an hsp with three letters code. I try with this:

my $query1_in  = Bio::SeqIO->newFh ( -file   => "$infile1",
  				    -format => 'fasta' );
 my $query1 = <$query1_in>; 
 my $query2_in  = Bio::SeqIO->newFh ( -file   => "$infile2", 
  				      -format => 'fasta' );
 my $query2 = <$query2_in>; 
 
 my $factory = Bio::Tools::Run::StandAloneBlast->new('program'  => "$algo");  my $report = $factory->bl2seq($query1, $query2);

############################################################################################################
 while (my $result = $report->next_result) {  # while 1
    print "Query: ".$result->query_name."\n\n";
    while (my $hit = $result->next_hit) {     # while 2
 	while (my $hsp = $hit->next_hsp) {    # while 3
 
if ( $hsp->percent_identity >= "$identity" ) 

	{ # start of if
	
	$qseq = $hsp->query_string;
	$polypeptide_3char = Bio::SeqUtils->seq3($qseq);

	print $polypeptide_3char;

	
		
}
 	} # end of while 3
    print "\n";
    }	# end of while 2
 }	# end of while 3

And I got this error:

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Not a Bio::PrimarySeqI object but [$self]
STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/share/perl5/Bio/Root/Root.pm:472
STACK: Bio::SeqUtils::seq3 /usr/share/perl5/Bio/SeqUtils.pm:187
STACK: blast_parsing.pl:36
-----------------------------------------------------------
I don't understand why my code generate this error!

Thanks :)
--
View this message in context: http://old.nabble.com/One-letter-protein-sequence-to-three-letters-tp35222270p35222270.html
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.

_______________________________________________
Bioperl-l mailing list
Bioperl-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/bioperl-l

=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================




More information about the Bioperl-l mailing list