CNpreprocessing {CNprep}R Documentation

Pre-process DNA copy number (CN) data for detection of CN events.


Description: The package evaluates DNA copy number data, using both their intitial form (copy number as a noisy function of genomic position) and their approximation by a piecewise-constant function (segmentation), for the purpose of identifying genomic regions where the copy number differs from the norm.


CNpreprocessing(segall, ratall = NULL, idcol = NULL, startcol = NULL, 
endcol = NULL, medcol = NULL, madcol = NULL, errorcol = NULL, 
chromcol = NULL, bpstartcol = NULL, bpendcol = NULL, annot = NULL, 
annotstartcol = NULL, annotendcol = NULL, annotchromcol = NULL, 
useend = F, blsize = NULL, minjoin = NULL, ntrial = 10, bestbic = -1e+07, 
modelNames = "E", cweight = NULL, bstimes = NULL, chromrange = NULL, 
myseed = 123, distrib = c("vanilla", "Rparallel"), njobs = 1, 
normalength = NULL, normalmedian = NULL, normalmad = NULL, 
normalerror = NULL)



A matrix or a data frame for segmented copy number profiles. It may have a character column, with a name specified by idcol, and/or numeric columns with names specified by startcol, endcol, medcol, madcol,errorcol ,chromcol, bpstartcol, bpendcol. Each row of segall corresponds to a segment belonging to one of the profiles to be pre-processed.


A matrix whose rows correspond to genomic positions and columns to copy number profiles. Its matrix elements are functions of copy number, most often log ratios of copy number to the expected standard value, such as 2 in diploid genomes.


A character string specifying the name for the column in segall tabulating the profile IDs.

startcol, endcol

Character strings specifying the names of columns in segall that tabulate the (integer) start and end postions of each segment in internal units such as probe numbers for data of CGH microarray origin.

medcol, madcol, errorcol

Character strings specifying the names of columns in segall that, for the function of copy number used in the study (typically log ratios), tabulate the (numeric) values for the function (medcol), a measure of its spread (madcol) and its error (errorcol) for the segment.


A character string specifying the name for the column in segall tabulating the (integer) chromosome number for each segment.

bpstartcol, bpendcol

Character strings specifying the names of columns in segall that tabulate the (integer) genomic start and end coordinates of each segment.


A matrix or a data frame that contains the annotation for the copy number measurement platform in the study. It is generally expected to contain columns with names specified by annotstartcol, annotendcol, annotchromcol.

annotstartcol, annotendcol, annotchromcol

Character strings specifying the names of columns in annot that tabulate the (integer) genomic start and end coordinates and the chromosome number for each copy number measuring unit, such as a probe in case of CGH microarrays.


A single logical value specifying whether the segment end positions as given by the bpendcol of segall are to be looked up in the annotendcol column of annot (if useend=TRUE) or in the annotstartcol column (default).


A single integer specifying the bootstrap sampling rate of segment medians to generate input for model-based clustering. The number of times a segment is sampled is then given by the (integer) division of the segment length in internal units by blsize.


A single numeric value between 0 and 1 specifying the degree of overlap above which two clusters will be joined into one.


A single integer specifying the number of times a model-based clustering is attempted for each profile in order to achieve the highest Bayesian information criterion (BIC).


A single numeric value for initalizing BIC maximization. A large negative value is recommended. The default is -1e7.


A vector of character strings specifying the names of models to be used in model-based clustering (see package mclust for further details). The default is "E".


A single numeric value between 0 and 1 specifying the minimal share of the central cluster in each profile.


A single integer value specifying the number of time the median of each segment is sampled in order to predict the cluster assignment for the segment.


A numeric vector enumerating chromosomes from which segments are to be used for initial model-based clustering.


A single integer value to seed the random number generator.


One of "vanilla", "Rparallel" to specify the distributed computing option for the cluster assignment step. For "vanilla" (default) no distributed computing is performed. For "Rparallel" the parallel package of R core is used for multi-core processing.


A single integer specifying the number of worker jobs to create in case of distributed computation.


An integer vector specifying the genomic lengths of segments in the normal reference data.

normalmedian, normalmad, normalerror

Numeric vectors, of the same length as normalength, specifying the segment values, value spreads and errors of the normal reference segments.


Depending on the availability of input, the function will perform the following operations for each copy number profile.

If raw data are available in addition to segment start and end positions, median and MAD of each segment will be computed. For each profile, bootstrap sampling of the segment median values will be performed, and the sample will be used to estimate the error in the median for each segment. Model-dependent clustering (fitting to a gaussian mixture) of the sample will be performed. The central cluster (the one nearest the expected unaltered value) will be identified and, if necessary, merged with adjacent clusters in order to comprise the minimal required fraction of the data. Deviation of each segment from the center, its probabilty to belong to the central cluster and its marginal probability in the central cluster will be computed.

If segment medians or median deviations are available or have been computed, and, in addition, genomic lengths and average values are given for a collection of segments with unaltered copy number, additional estimates will be performed. If median values are available for the unaltered segments, the marginal probability of the observed median or median deviation in the unaltered set will be computed for each segment. Likewise, marginal probabilities for median/MAD and/or median/error will be computed if these statistics are available.


The input segall data frame to which some or all of the following columns may be bound, depending on the availability of input:


Median function of copy number


MAD for the function of copy number


median function of copy number relative to its central value


error estimate for the function of copy number


the probability that the segment is in the central cluster


marginal probability for the segment in the central cluster


the probability of finding the deviation as observed or larger in a collection of central segments


the probability of finding the deviation/MAD as observed or larger in a collection of central segments


the probability of finding the deviation/error as observed or larger in a collection of central segments


Alex Krasnitz


#small toy example
## Not run: 
#Example 1: 5 whole genome analysis, choosing the right format of arguments
#Example 2: how to use annotexample, when segment table does not have columns of 
#integer postions in terms of  measuring units(probes), such as "mysegs" below

## End(Not run)

[Package CNprep version 2.2 Index]