[Bioperl-l] questions
Roy Chaudhuri
roy.chaudhuri at gmail.com
Mon Feb 8 06:09:29 EST 2010
Hi Jessica,
> Does any one knows how to add locations(CDS, Joins(600,140;...) to the new
> sequence object as feature,'
use Bio::SeqIO;
use Bio::Seq;
use Bio::Location::Split;
use Bio::Location::Simple;
use Bio::SeqFeature::Generic;
my $seq=Bio::Seq->new(-seq=>'ACTGATCGATGCATGATGTAGATCGATAGCTGCTA');
my $loc=Bio::Location::Split->new;
$loc->add_sub_Location(Bio::Location::Simple->new(-start=>4, -end=>6,
-strand=>1);
$loc->add_sub_Location(Bio::Location::Simple->new(-start=>10, -end=>12,
-strand=>1);
my $feat=Bio::SeqFeature::Generic->new(-primary_tag=>'misc_feat',
-location=>$loc);
$seq->add_SeqFeature($feat);
my $out=Bio::SeqIO->new(-format=>'genbank';
$out->write_seq($seq);
> or if anyone knows how to keep the feature of truncated sequences object.
Look at the trunc_with_features method in Bio::SeqUtils:
use Bio::SeqUtils;
my $trunc=Bio::SeqUtils->trunc_with_features($seq, 2, 12);
$out->write_seq($trunc);
Hope this helps.
Roy.
More information about the Bioperl-l
mailing list