iCLIP.utils.TranscriptCoordInterconverter.genome2transcript

TranscriptCoordInterconverter.genome2transcript(pos)

Convert genome coordinate into transcript coordinates.

Can be a single coordinate or a array-like of coordinates

Parameters:pos (int or array-like or int) – positions, in the genome domain, to be converted
Returns:The position, or positions converted into the transcript domain.
Return type:int or numpy.array
Raises:ValueError – If the supplied genome position is not in the transcript. This could be because it falls into one of the introns (or exons if the converter was created with introns=True, or because the requested coordinates are before the start or after the end of the transcript.

See also

transcript2genome()
The inverse of this operation
genome_interval2transcript()
Convert intervals rather than single positions

Notes

A key point to be aware of is that this function converts positions not intervals. Because of the zero-based half-open nature of python coordinates, you can’t just convert the start and end positions into the transcript space. Use :method:`genome_interval2transcript` for this.

Passing an array ensures that the transcript is only searched once, ensuring O(n) performance rather than O(nlogn)