Thanks Emily. It worked. :)
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Slice;
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'ensembldb.ensembl.org', # alternatively 'useastdb.ensembl.org'
-user => 'anonymous',
-port => 5306 );
my $gene_adaptor = $registry->get_adaptor( 'Human', 'Core', 'Gene' );
my $gene = $gene_adaptor->fetch_by_stable_id( 'ENSG00000099889');
print $gene->seq_region_start();
print "\n";
print $gene->seq_region_end();
But I want the coordinates of GRCh37 instead of GRCh38. Where should I incorporate the version in my code?
What have you tried (i.e., show us the code you're using now that's not working)? BTW, is there a reason you want to use the perl API? You could also just use R and simply load the appropriate annotation package.
I do not know much of R. So, I thought of using Perl API, but in the tutorial I could not find any examples to get coordinates and in API, I could not find the function related to fetch coordinates by gene name.
Also, why do you think the coordinates would be different if you're using the same genome build? The only difference between UCSC and Ensembl coordinates is the chromosome name, which is trivial to alter.
I can try this, but as I use iGenomes builds, it would be good if I do some hands on Ensembl databases using their API.