[ensembl-dev] off-by-one with cdna2genomic()

Reece Hart reece at harts.net
Mon Mar 28 06:23:25 BST 2011


Greetings-

I am having a lot difficulty figuring out how to use Ensembl to map between
chromosomal, contig, transcript, and protein coordinates.

The first step on the journey is to map HGVS transcript variations to
chromosomal coordinates. I'm using rs74423290 (ENST00000309983.4:c.500C>G)
as a test. The Ensembl and NCBI web sites show this SNP at 6:18134115. When
I use TranscriptMapper's cdna2genomic(), I get 18134114 (i.e., off by
one). Ensembl is 1-based everywhere else and I've not had other off-by-one
errors, so just making it all go away by adding one is disconcerting.

The core of the code is

my $id = 'ENST00000309983';
my $cds_pos = 500;
my ($tx) = $ens{ta}->fetch_by_stable_id($id);
my ($gstart) = $tx->cdna2genomic(
   $cds_pos + $tx->cdna_coding_start,
   $cds_pos + $tx->cdna_coding_start);

The full code is at http://pastebin.com/a8uwL3eB .

So, the question: why am I off by one?

Thanks,
Reece
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20110327/69975c20/attachment.html>


More information about the Dev mailing list