writeEstProfile {mBPCR} | R Documentation |
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.
writeEstProfile(path='', sampleName='', snpName, chr, position, logratio, chrToBeWritten, estPC, estBoundaries=NULL, postProbT=NULL, regrCurve=NULL, regr=NULL)
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 |
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 |
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 |
postProbT |
list containing the vectors of the posterior probabilities to be a breakpoint of the estimated breakpoints, for each of the chromosomes mentioned in |
regrCurve |
array containing the estimated regression curve. If |
regr |
choice of the computation of the regression curve. If |
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
.
##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)