Question: Concatenate Sequences With Bioperl
0
gravatar for maczerek
6.6 years ago by
maczerek40
maczerek40 wrote:

Hello, I've got some trivial (I guess) question. I try to write features of a sequence in single output sequences. My code looks like that:

my @features = $seq->get_SeqFeatures(); #GenBank sequence
my $split = Bio::Location::Split->new();
foreach my $feat ( @features ) {
if ($feat->primary_tag eq "exon"){               #exons only
$split->add_sub_Location($feat->location);
}
   my $cds= $seq->subseq($split);
my $seq = new Bio::PrimarySeq(-seq => $cds,
              -id => 'cds',
                          -alphabet => 'dna');
$seq_out->write_seq($seq);
}}

Unfortunetely every exon is written as separate sequence. What do I do wrong?

Marek

bioperl • 1.8k views
ADD COMMENTlink modified 6.6 years ago • written 6.6 years ago by maczerek40
4
gravatar for maczerek
6.6 years ago by
maczerek40
maczerek40 wrote:

Ok, I manage to solve it by myself.

    while ($seq=$seq_in->next_seq){
my @features = $seq->get_SeqFeatures();
my $split = Bio::Location::Split->new();
foreach my $feat(@features){
if ($feat->primary_tag eq "exon"){
$split->add_sub_Location($feats->location)
}}
my $cds = $seq->subseq($split);
my $out_seq = Bio::PrimarySeq->new (-seq => $cds,
                    -id  => "cds");
$seq_out->write_seq($out_seq)
}

Now it's working properly.

ADD COMMENTlink written 6.6 years ago by maczerek40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1038 users visited in the last hour