writeEstProfile: Write the estimated profile of copy number data

Description Usage Arguments Details Examples

View source: R/mBPCR.R

Description

Function to write nicely the results of the copy number profile estimation. The function either writes the tables directly on a tab delimited file or returns the corresponding tables.

Usage

1
2
3
  writeEstProfile(path='', sampleName='', snpName, chr, position, logratio,
                  chrToBeWritten, estPC, estBoundaries=NULL, postProbT=NULL,
                  regrCurve=NULL, regr=NULL)

Arguments

path

path of the folder where the user wants to write the results of the estimation (it must end with '\' in windows, or '//' in linux). If path='', they will be written in the working directory. If path=NULL, the tables will not be written on a file, but only returned by the function.

sampleName

name of the sample. If the name of the sample if provided, it is used to named the files.

snpName

array containing the name of each probe

chr

array containing the name of the chromosome to which each probe belongs. The possible values of the elements of chr are: the integers from 1 to 22, 'X' and 'Y'.

position

array containing the physical position of each probe

logratio

array containing the log2ratio of the raw copy number data

chrToBeWritten

array containing the name of the estimated chromosomes, of which the user wants to write the results. The possible values of the chromosomes are: the integers from 1 to 22, 'X' and 'Y'.

estPC

array containing the estimated copy number profile as a piecewise constant function

estBoundaries

list containing the vectors of the estimated breakpoints, for each of the chromosomes mentioned in chrToBeWritten. If estBoundaries=NULL, then this information is not written.

postProbT

list containing the vectors of the posterior probabilities to be a breakpoint of the estimated breakpoints, for each of the chromosomes mentioned in chrToBeWritten. If postProbT=NULL, then this information is not written in the file containing the estimated breakpoints.

regrCurve

array containing the estimated regression curve. If regrCurve=NULL, then the file containing this information is not written.

regr

choice of the computation of the regression curve. If regr=NULL, then the regression curve was not computed (then the file containing this information is not written), if regr="BRC" the Bayesian Regression Curve with K_2 was computed (BRC with K_2), if regr="BRCAk" the Bayesian Regression Curve Averaging over k was computed (BRCAk).

Details

The function writes or returns at maximum three tables:

-one containing the estimated profile with mBPCR (the columns are: 'SNPname', 'chromosome', 'position', 'rawLog2ratio', 'mBPCRestimate')

-one containing a summary about the estimated profile with mBPCR (the columns are: 'SNPname(start)', 'SNPname(end)', 'chromosome', 'position(start)', 'position(end)', 'nProbes', 'mBPCRestimate' and, eventually, 'breakpointPostProb'). This table is not created if estBoundaries=NULL.

-one containing the estimated profile with a regression curve (the columns are: 'SNPname', 'chromosome', 'position', 'rawLog2ratio' and the name of the regression curve used). This table is not created if regrCurve=NULL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
##import the 10K data of cell line REC
data(rec10k)
##estimation of chromosome 5
results <- estProfileWithMBPCR(rec10k$SNPname, rec10k$Chromosome, rec10k$PhysicalPosition, 
rec10k$log2ratio, chrToBeAnalyzed=5, maxProbeNumber=2000)
##write the estimated profile of chromosome 5 in a file in  the working directory
writeEstProfile(path='', sampleName='rec10k', rec10k$SNPname, rec10k$Chromosome, 
rec10k$PhysicalPosition, rec10k$log2ratio, chrToBeWritten=5, results$estPC, results$estBoundaries, 
results$postProbT)


#### the same result can be obtained in the following way, by using the function computeMBPCR
#### for the estimation
##estimation of the global parameters
#param <- estGlobParam(rec10k$log2ratio)
##estimation of chromosome 5
#results <- computeMBPCR(rec10k$log2ratio[rec10k$Chromosome == 5], nu=param$nu, 
#rhoSquare=param$rhoSquare, sigmaSquare=param$sigmaSquare)
##write the estimated profile of chromosome 5 in a file in the working directory
#estPC <- array(dim=length(rec10k$SNPname))
#estBoundaries <- list(dim=1)
#postProbT <- list(dim=1)
#estPC[rec10k$Chromosome == 5] <- results$estPC
#estBoundaries[[1]] <- results$estBoundaries
#postProbT[[1]] <- c(results$postProbT[results$estBoundaries[-results$estK]],1)
#writeEstProfile(path='', sampleName='rec10k', rec10k$SNPname, rec10k$Chromosome, 
#rec10k$PhysicalPosition, rec10k$log2ratio, chrToBeWritten=5, estPC, estBoundaries, postProbT)

paolarancoita/mBPCR documentation built on Jan. 12, 2020, 6:24 p.m.