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

Will McLaren wm2 at ebi.ac.uk
Mon Mar 28 10:28:54 BST 2011


Hi Reece,

You have to subtract 1 because of the way you are adding our 1-based
coordinates.

To make it more simple, imagine you want to convert the first base of
the CDS to genomic coords using your approach. This coordinate will be
the same in cDNA as the cdna_coding_start, hence you would do
cdna_coding_start + 1 - 1.

You could of course use cds2genomic instead!!!

Cheers

Will
Ensembl Variation

On 28 March 2011 06:23, Reece Hart <reece at harts.net> wrote:
> 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
> _______________________________________________
> Dev mailing list
> Dev at ensembl.org
> http://lists.ensembl.org/mailman/listinfo/dev
>
>




More information about the Dev mailing list