[ensembl-dev] Retrieve exons for just one gen

Gonzalo Parra gonza_parra at hotmail.com
Fri Jun 3 18:40:06 BST 2011


Hello People, 
I am trying to retrieve the exon structure for a list of genes that i have stored in a file.So I am now trying to do it for just one gene so, then I can read my gene list element by element and retrieve all the exons for each one.
I have the following code. But I am not understanding the use of the slice and adaptors so I cannot adapt the code for my problem.
Can anybody help me? Below I paste the code that does what i want to do for all the genes in a chromosome.
#!/usr/bin/perl -w
use Bio::EnsEMBL::Feature;use Bio::EnsEMBL::Registry;use Bio::EnsEMBL::DBSQL::GeneAdaptor;
my $registry = 'Bio::EnsEMBL::Registry';


sub feature2string{    my $feature = shift;
    my $stable_id  = $feature->stable_id();    my $seq_region = $feature->slice->seq_region_name();    my $start      = $feature->start();    my $end        = $feature->end();    my $strand     = $feature->strand();
    return sprintf( "%s: %s:%d-%d (%+d)",        $stable_id, $seq_region, $start, $end, $strand );}
$registry->load_registry_from_db(    -host => 'ensembldb.ensembl.org',    -user => 'anonymous');
my $slice_adaptor = $registry->get_adaptor( 'Human', 'Core', 'Slice' );my $slice = $slice_adaptor->fetch_by_region( 'chromosome', 'X', 1e6, 10e6 );
#my $slice = $slice_adaptor->fetch_by_gene_stable_id( 'ENSG00000099889', 5e3 ); // I have read that i can change the last line for this one here.. but i don't know how to do the following step in whis i get the information from the gene..
my $genes = $slice->get_all_Genes();
my $gene = shift @{$genes};    my $gstring = feature2string($gene);    print "$gstring\n";
    my $transcripts = $gene->get_all_Transcripts();
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20110603/c8b04bf0/attachment.html>


More information about the Dev mailing list