prepareParameters4 {karyoploteR} | R Documentation

## prepareParameters4

### Description

Prepare and normalize the parameters for functions with x0, x1 and y0, y1 parameters

### Usage

    prepareParameters4(function.name, karyoplot, data=NULL, chr=NULL, x0=NULL, x1=NULL, y0=NULL, y1=NULL, ymax=NULL, ymin=NULL, r0=NULL, r1=NULL, data.panel=1, filter.data=TRUE, ...)

### Arguments

`function.name` | (character) The name of the function calling `prepareParameters4`. Only user for error reporting.
`karyoplot` | (KaryoPlot) A karyoplot object.
`data` | A GRanges
`chr` | A character representing the chromosome names.
`x0` | The position in the chromosome in number of bases.
`x1` | The position in the chromosome in number of bases.
`y0` | The value to be plotted.
`y1` | The value to be plotted.
`ymax` | The maximum value of y
`ymin` | The minimum value of y
`r0` | The start of the range to use for plotting
`r1` | The end of the range to use for plotting
`data.panel` | The data panel to use
`filter.data` | A boolean indicating if data should be filtered so only data in visible chromosomes is kept. (defaults to TRUE, filter data)
`...` | Any additional parameter

### Details

This function prepares and normalizes the parameters for plotting functions with x0, x1, y0 and y1 parameters (as opposed to x and y) so functions can offer a richer interface while internally dealing only with standard and simple code. It extracts the positions from `data` if available and applies the `r0` and `r1` scaling. It returns the ready to plot values in a list with only `chr`, `x0`, `x1`, `y0` and `y1`. Individual parameters (`chr`, `x0`, `x1`, `y0` and All parameters are interpreted and used as explained in `kpRect`. It also filters out any data points corresponding to chromosomes not present in the current karyoplot.

### Value

A list with five values: `chr`, `x0`, `x1`, `y0` and `y1`. Each of them a vector of the same length with the normalized values to plot.

### Note

This function is only useful when creating custom plotting functions. It is not intended to the general user.

For detailed documentation on the parameters, see `kpRect`

### See Also

`kpRect`

### Examples

    kp <- plotKaryotype()
    prepareParameters4("TestFunc", kp, data=NULL, chr="chr1", x0=c(10, 20, 30), x1=c(20, 30, 40), y0=c(0, 1, 2), y1=c(0.5, 1.5, 3), r0=0, r1=0.5, ymin=0, ymax=3)

[Package karyoploteR version 1.14.1 Index]