stable_id by external gene name
0
0
Entering edit mode
6.8 years ago
mahmood.nt • 0

Hi there It is stated in the Ensembl documents that the function GeneAdaptor::fetch_all_by_external_name() returns a list of genes. For a gene name, e.g BRCA2 as stated in the example, that function returns two things: 1) a stable_id and 2) a LRG.

I only need the stable_id sequence, so I can access that since it is the first element in the array. Is that always true?

my @brca_genes = @{ $gene_adaptor->fetch_all_by_external_name('brca2') };
my $brca_gene = @brca_genes[0];
print ">" . $brca_gene->stable_id . " " . $brca_gene->display_xref->display_id . "\n";
print $brca_gene->seq . "\n";
my $start      = $brca_gene->start();
my $end        = $brca_gene->end();
print "Slice: $start-$end \n";

As you can see I hard coded the first element. If there are some situations that the first element is not the ensembl stable_id, then I have to manually check each iteration to see if that matches stable_id.

Any comment?

ensembl stable_id • 1.1k views
ADD COMMENT

Login before adding your answer.

Traffic: 2976 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6