[ensembl-dev] ensembl API get 3'UTR sequence from gene list

Olivier armant olivier.armant at kit.edu
Tue Apr 9 10:07:03 BST 2013


Dear Ensembl API support,

I want to get back the 3'UTR sequence from  an array of genes defined by their stable id. The script I am using is below. I only get back the first hit and then get stuck. Could you please explain me why this does not work?

Cordially

Olivier A

#!/usr/bin/perl
use strict;
use warnings;
use lib "/data/shared/src/Perl_API/ensembl_70/modules";
use Bio::SeqIO;
use Bio::EnsEMBL::SeqFeature;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::DBSQL::GeneAdaptor;
#use Bio::EnsEMBL::DBSQL::ExonAdaptor;
use Bio::EnsEMBL::Transcript;
#use Data::Dumper;

my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
   -host => 'ensembldb.ensembl.org', # alternatively 'useastdb.ensembl.org'
   -user => 'anonymous'
);
my $specie = 'Danio rerio';
my $transcript_adaptor= $registry->get_adaptor($specie,'Core','Transcript') or die "ERROR 1 $!\n";
my $geneinput= 'gene_test.txt';
open (FILE, "$geneinput");
my @data= <FILE>;
close FILE;
foreach my $line ( @data)  # stdin as ensembl gene identifier
{
$line=~s/ //g;
$line=~s/\t//g;
$line=~s/\n//g;
my $transcript = $transcript_adaptor->fetch_by_stable_id($line);
my $name = $transcript->display_id;
my $n3UTR = $transcript->three_prime_utr;
my $n3UTRseq = $n3UTR->seq();
print "$name$n3UTRseq";
}
exit;


Olivier ARMANT PhD.

Institute of Toxicology and Genetics
KIT Campus Nord
Hermann-von-Helmholtz-Platz 1
D-76344 Eggenstein-Leopoldshafen
Germany

tel: +49-721-608-26774
fax: +49-721-608-23354





More information about the Dev mailing list