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?