[Bioperl-l] Newbie question on Bio::SeqIO

James Platt plattj at Cardiff.ac.uk
Thu Jan 27 13:02:13 UTC 2011


I tried this already I got a different error:

Unrecognized character \xE2 in column 21 at ./biotester.pl line 18.

I then copied your script in and it worked, then I had my script and that identical and mine still didn't work. Not sure why it was happening.

So I  have my sequence now and I'm trying to reverese complement it:

$output1 = $seq_obj->subseq(160,180);
    print "$output1\n";
$rev_output1 = revcom( $output1 );
    print "$rev_output1\n";

I get this output:

ATTATAAAAAACTTTTAATTT
Bio::PrimarySeq=HASH(0x9c8e20)

I also try it in an object orientated manner:

 $rev_output1 = $output1->revcom;

ATTATAAAAAACTTTTAATTT
Can't locate object method "revcom" via package "ATTATAAAAAACTTTTAATTT" (perhaps you forgot to load "ATTATAAAAAACTTTTAATTT"?) at biotester.pl line 24, <GEN0> line 1.

I've been following instructions at http://www.bioperl.org/wiki/HOWTO:Beginners

Thanks again!

James


On 26 Jan 2011, at 22:15, Yifei Huang wrote:

> subseq is not a member function in SeqIO class. You need to use next_seq function in SeqIO class to read a sequence and then fetch a subsequence, which might be something like this.
> 
> 
> #!/usr/bin/perl
> use Bio::Perl;
> use Bio::SeqIO;
> 
> 
> my $seqio_obj = Bio::SeqIO->new(-file => "dna.fa",
>                                -format => 'Fasta');
> my $seq_obj = $seqio_obj->next_seq();
> my $output = $seq_obj->subseq(1,20);
> print "$output\n";
> 
> On Wed, Jan 26, 2011 at 5:05 PM, JayPea <plattj at cardiff.ac.uk> wrote:
> 
> Hi all.
> 
> I recently installed bioperl on my mac (OSX 10.6.6) using fink. And have
> been playing around trying to get some really simple things to work. SO what
> I'm trying to do is just grab 20bases of the fasta file then print them out.
> 
> This is my script:
> 
> #!/usr/bin/perl
> use Bio::Perl;
> use Bio::SeqIO;
> 
> 
> my $seqio_obj = Bio::SeqIO->new(-file => "dna.fa",
>                                -format => 'Fasta');
> my $output = $seqio_obj->subseq(1,20);
> print "$output\n";
> 
> fasta file:
> 
> >chr1 D_discoideum_Ax4_May_2005 4923596 bp DDB0232428
> NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
> NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTATAGTTACTATTGTAAATC
> GATAGATAACTTAATTTCATTAATATTATACATAGTAACATTATAAAAAACTTTTAATTT
> TTATTTGGGAATTTCAAATTGCTCATTTGGGAAAATTTTTAACTAAGAAAAAATTCAAAA
> 
> I get this error:
> 
> Can't locate object method "subseq" via package "Bio::SeqIO::fasta" at
> ./biotester.pl line 16.
> 
> Thanks for any help!
> 
> James
> --
> View this message in context: http://old.nabble.com/Newbie-question-on-Bio%3A%3ASeqIO-tp30768204p30768204.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
> 
> 
> 
> -- 
> Yifei Huang
> Department of Biology
> McMaster University





More information about the Bioperl-l mailing list