[Bioperl-l] parse cds and peptide from genbank file with identifier
Guoqi4 at aol.com
Guoqi4 at aol.com
Sun May 25 02:05:05 EDT 2003
Dear group,
I am interested in parsing cds and peptide from genbank file. I run the
following script:
#!/usr/bin/perl -w
# Contributed by Jason Stajich <^S HYPERLINK "mailto:jason at bioperl.org"
^Tjason at bioperl.org^U>
# simple extract the CDS features from a genbank file and
# write out the CDS and Peptide sequences
use strict;
use Bio::SeqIO;
my $filename = shift || die("pass in a genbank filename on the cmd line");
my $in = new Bio::SeqIO(-file => $filename, -format => 'genbank');
my $out = new Bio::SeqIO(-file => ">$filename.cds");
my $outpep = new Bio::SeqIO(-file => ">$filename.pep");
while( my $seq = $in->next_seq ) {
my @cds = grep { $_->primary_tag eq 'CDS' } $seq->get_SeqFeatures();
foreach my $feature ( @cds ) {
my $featureseq = $feature->spliced_seq;
#print 'featureseq:'.$featureseq;
my $featureseqid=$feature->display_name;
#print my $featureseqid;
# $out->write_seq($featureseq);
$out->write_seq($featureseqid);
$outpep->write_seq($featureseq->translate);
}
}
There are two problems found. The first lines are all the same in for One
is the fasta format
More information about the Bioperl-l
mailing list