Question: stable_id by external gene name
0
gravatar for mahmood.nt
2.2 years ago by
mahmood.nt0
mahmood.nt0 wrote:

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?

stable_id ensembl • 539 views
ADD COMMENTlink written 2.2 years ago by mahmood.nt0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1134 users visited in the last hour