This is a test version of Biostars. For the public version, visit https://www.biostars.org.
stable_id by external gene name

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

0 answers

No answers yet.

Log in to answer this question.