[Bioperl-l] Accessing nucleotide sequence

subarna thakur bubli_thakur at rediffmail.com
Mon Apr 11 07:16:10 UTC 2011


Hi everyone;I am quite new in bioperl.I am using the below code to access the cds from Genebank  for particular gi number-
package Bio::Perl;
use Bio::Perl;
use Bio::Factory::FTLocationFactory;
use Bio::DB::GenPept;
use Bio::DB::GenBank;

my $gp = Bio::DB::GenPept->new();
my $gb = Bio::DB::GenBank->new();
# factory to turn strings into Bio::Location objects
my $loc_factory = Bio::Factory::FTLocationFactory->new;

my $prot_obj = $gp->get_Seq_by_id('111219521');
foreach my $feat ( $prot_obj->top_SeqFeatures ) {
if ( $feat->primary_tag eq 'CDS' ) {
# example: 'coded_by="U05729.1:1..122"'
my @coded_by = $feat->each_tag_value('coded_by');
my ($nuc_acc,$loc_str) = split /\:/, $coded_by[0];
my $nuc_obj = $gb->get_Seq_by_acc($nuc_acc);
# create Bio::Location object from a string
my $loc_object = $loc_factory->from_string($loc_str);
# create a Feature object by using a Location
my $feat_obj = Bio::SeqFeature::Generic->new(-location =>$loc_object);
# associate the Feature object with the nucleotide Seq object
$nuc_obj->add_SeqFeature($feat_obj);
my $cds_obj = $feat_obj->spliced_seq;
my $seq1 = $cds_obj->seq; 
#print "CDS sequence is ",$cds_obj->seq,"\n";
$seq2 = new_sequence("$seq1","111219521");
write_sequence (">hum1",'fasta',$seq2);
}
}----------------------------------------I have to tried to modify the code to get a number of CDS according to a list of NCBI GI number provided to it. I have used the get _Stream _by_id method but it doesnot work. Can anybody please help me to modify the code or if anybody has a code to get mutiple number of cds according to list of GI number, please provide me the code.RegardsSubarna Thakur



More information about the Bioperl-l mailing list