Description Usage Arguments Value How to convert to model coordinates The conversion formula Examples

View source: R/fusionExpressionPlot.R

Converts a vector of (+ strand) genomic positions to a vector of coordinates in a model as described by a GRanges object. The model describes a sequence of non-ovelapping elements separated by gaps of varying sizes. Genomic positions are maped 1-1 within elements, but scale to a fixed gap width when they fall between elements. The GRanges object describing the element model must be all on one strand of one chromosome. '-' strand models are reveresed so all coordinates are 5' - 3' transformed.

1 2 | ```
genomicToModelCoordinates(pos, gene, gapWidth = 100,
outOfBounds = "warning")
``` |

`pos` |
Vector of integers (required). A vector of chromosome genomic positions to convert to model coordinates. Assumed to be on the same chromosome as the provided gene model, although not required to be within the gene model. |

`gene` |
GRanges object (required). Object giving the model, i.e. gene exons. All elements must be on the same chromosome on the same strand in sequence order with no overlaps and no 0 length introns. Assumes '-' strand genes are described as if their shadow on the '+' strand was the real gene, with ony the '-' indicateing anything aobut a reverse order. |

`gapWidth` |
Integer (default = 100) Fixed gap width. Equivalent is size to an exon of the same length. |

`outOfBounds` |
'warning' (default) | 'error' | 'ok' By default, genomic positions can be supplied that are outside the model, but a warning will be given, once. "Position outside the gene model found: #". Setting outOfBounds='error' will cause the first such position found to abort. Setting outOfBounds='ok' means no warning or error will be generated. |

Integer vector of genomic positions converted to model coordinates.

Model coordinates start with '1', corresponding to the genomic position of the first element in the GRanges object. Model coordinate end with a value that is the sum of all the element widths plus the number of gaps * the gapthWidth. Genomic positions before the model (less than any element start) are converted to model coordinate 0; genomic positions after the mode (greater than any element end are converted to the last model coordinate + 1. This can be controlled by the outOfBounds parameter (Not implemented).

If a genomic position falls within a gap, it is converted to a gap-relative position, then shifted 1/2 a position in the 5' direction. This shifted, gap-relative position [0.5 ... actualGapWidth - 0.5] is then scaled to fit (multiplied by gapWidth/actualGapWidth). The next largest integer (ceiling) is taken as the offset into the gap in the model, with the returned model coordinate being "the sum of the widths of the exons before" + (gapWidth * "the number of gaps before") + "this offset". If the strand is negative, the coordinate is relative to the last exon base of the mode instead of the first.

For positive strand coordinate values:

* coordinate = sum( widths(elementsBefore)) + count(gapsBefore) *
gapWidth + ceiling( (p - endPos(elementJustBefore) - 0.5) *
(gapWidth/thisGapWidth)) *

For negative strand coordinate values, an additional transformation is applied:

* coordinate = sum( widths( allElements )) + count(allGapsB) *
gapWidth + 1 - posCoordinate *

1 2 3 4 5 6 7 8 9 |

jefferys/FusionExpressionPlot documentation built on May 19, 2019, 3:59 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.