[Patchwork-commits] r135 - pkg/patchworkCG/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jun 25 14:49:40 CEST 2012
Author: mayrhofer
Date: 2012-06-25 14:49:40 +0200 (Mon, 25 Jun 2012)
New Revision: 135
Modified:
pkg/patchworkCG/R/patchwork.CG.copynumbers.r
Log:
Updated CN calculation @ X and Y.
Modified: pkg/patchworkCG/R/patchwork.CG.copynumbers.r
===================================================================
--- pkg/patchworkCG/R/patchwork.CG.copynumbers.r 2012-06-25 11:53:55 UTC (rev 134)
+++ pkg/patchworkCG/R/patchwork.CG.copynumbers.r 2012-06-25 12:49:40 UTC (rev 135)
@@ -1,4 +1,4 @@
-patchwork.CG.copynumbers = function(cn2,delta,het,hom,maxCn=8,ceiling=1,name="copynumbers_",CGfile=NULL,forcedelta=F,male.sample=F,male2femref=T)
+patchwork.CG.copynumbers = function(cn2,delta,het,hom,maxCn=8,ceiling=1,name="copynumbers_",CGfile=NULL,forcedelta=F)
{
data(ideogram,package="patchworkCG")
@@ -294,33 +294,33 @@
tumor_percentDNA <- xdelta / expected_delta
tumor_percent <- tumor_percentDNA/(meanCn/2) / ( tumor_percentDNA/(meanCn/2) + (1-tumor_percentDNA) )
- ## Fix sex chromosomes in case of male sample.
- if (male.sample) {
- ix <- which(!is.autosome(regions$chr))
- regions$mCn[ix] <- 0
- ## Treats differently depending on sex of the reference
- if (!male2femref) {
- # X and Y (originally cn1) were compared to cn1 (matched normal or male references).
- # Unchanged copy number (=1) is expected at relative coverage 1.
- # Gains/loss are expected at xdelta (the delta of the autosomes)*2.
- rawcopychange <- (regions$median[ix]-1) / (xdelta*2)
- regions$Cn[ix] <- round(1+rawcopychange)
- regions$fullCN[ix] <- paste('cn',round(1+rawcopychange),'m0')
- } else
- {
- # X and Y (originally cn1) were compared to cn2 (female references).
- # Unchanged copy number (=1) is expected at relative coverage 1/2.
- # Gains/loss are expected at xdelta from there.
- rawcopychange <- (regions$median[ix]-1/2) / (xdelta)
- regions$Cn[ix] <- round(1+rawcopychange)
- regions$fullCN[ix] <- paste('cn',round(1+rawcopychange),'m0')
- }
- }
- ## And a small fix on female samples
- if (!male.sample) {
- ix <- which(regions$chr=='chrY')
- regions$mCn[ix] <- regions$Cn[ix] <- 0
- }
+ # ## Fix sex chromosomes in case of male sample.
+ # if (male.sample) {
+ # ix <- which(!is.autosome(regions$chr))
+ # regions$mCn[ix] <- 0
+ # ## Treats differently depending on sex of the reference
+ # if (!male2femref) {
+ # # X and Y (originally cn1) were compared to cn1 (matched normal or male references).
+ # # Unchanged copy number (=1) is expected at relative coverage 1.
+ # # Gains/loss are expected at xdelta (the delta of the autosomes)*2.
+ # rawcopychange <- (regions$median[ix]-1) / (xdelta*2)
+ # regions$Cn[ix] <- round(1+rawcopychange)
+ # regions$fullCN[ix] <- paste('cn',round(1+rawcopychange),'m0')
+ # } else
+ # {
+ # # X and Y (originally cn1) were compared to cn2 (female references).
+ # # Unchanged copy number (=1) is expected at relative coverage 1/2.
+ # # Gains/loss are expected at xdelta from there.
+ # rawcopychange <- (regions$median[ix]-1/2) / (xdelta)
+ # regions$Cn[ix] <- round(1+rawcopychange)
+ # regions$fullCN[ix] <- paste('cn',round(1+rawcopychange),'m0')
+ # }
+ # }
+ # ## And a small fix on female samples
+ # if (!male.sample) {
+ # ix <- which(regions$chr=='chrY')
+ # regions$mCn[ix] <- regions$Cn[ix] <- 0
+ # }
regions$meanCn <- meanCn
More information about the Patchwork-commits
mailing list