templatefromequalsegments: Create a template data frame with artificial segments of...

View source: R/accessory_functions.R

templatefromequalsegmentsR Documentation

Create a template data frame with artificial segments of equal length

Description

Divide chromosomes in artificial segments with the specified number of bins. You can provide a template without segment values (for instance, an unsegmented QDNAseq-object) as input for this function. You can also use this function to only resegment a subset of chromosomes.

Usage

templatefromequalsegments(template, QDNAseqobjectsample = FALSE, 
  equalsegments = 20, funtype = 'mean', chrsubset, 
  onlyautosomes = TRUE)

Arguments

template

Object. Either a data frame as created by objectsampletotemplate, or a QDNAseq-object

QDNAseqobjectsample

Integer. Specifies which sample to analyze from the QDNAseqobject. Required when using a QDNAseq-object as template. Default = FALSE

equalsegments

Integer. templatefromequalsegments "resegments" simply by creating segments containing as many bins as specified in this argument. Default = 20

funtype

Character string. Specifies the function used to calculate new segment values. Alternative is "median". Default = "mean"

chrsubset

Integer vector. Specify the chromosomes you want to resegment

onlyautosomes

Logical or integer. You can fill in an integer to specify how many autosomes your species has. When TRUE, templatefromequalsegments defaults to 22 (human) autosomes. When FALSE, templatefromequalsegments will also resegment whichever other chromosomes are specified in the template, e.g. "X", "Y", "MT"

Details

templatefromequalsegments resegments the input template chromosome by chromosome. It makes segments with the number of bins specified in the argument equalsegments. Any leftover bins are divided equally among all newly created segments. Only bins with values (!is.na) are considered. If there are fewer bins on a chromosome than two times the specified value, then all bins of this chromosome are put in a single segment.

Value

Returns a template data frame

Note

The chrsubset argument works slightly differently compared to the plotting functions. It does not necessarily segment only contiguous chromosomes. For instance, specifying chrsubset = c(8,12) will only resegment chromosomes 8 and 12. For the other chromosomes, segment values will not be changed.

Author(s)

Jos B. Poell

See Also

twosamplecompare, correlationmatrixadjusted

Examples

data("copyNumbersSegmented")
tfes <- templatefromequalsegments(copyNumbersSegmented, 
  QDNAseqobjectsample = 2)

tgac-vumc/ACE documentation built on Nov. 29, 2022, 12:15 a.m.