git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/crlmm@38290 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -60,7 +60,15 @@ BioC data packages |
60 | 60 |
* fixed documentation to acommodate this change |
61 | 61 |
|
62 | 62 |
2009-03-28 B Carvalho - committed version 1.0.64 |
63 |
+* modified crlmm and cnrma to look for data at extdata/ |
|
63 | 64 |
|
64 |
-* modified warning message |
|
65 |
+2009-03-29 Rob Scharpf - committed version 1.0.65 |
|
65 | 66 |
|
66 |
-* modified crlmm and cnrma to look for data at extdata/ |
|
67 |
+* update to copynumber vignette |
|
68 |
+ |
|
69 |
+* updated computeCopynumber.Rd to accommodate SnpSet objects and |
|
70 |
+ changes to genomewidesnp6Crlmm |
|
71 |
+ |
|
72 |
+* cnrma function requires the cdfName |
|
73 |
+ |
|
74 |
+* update man files for cnrma and computeCopynumber |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: crlmm |
2 | 2 |
Type: Package |
3 | 3 |
Title: Genotype Calling (CRLMM) and Copy Number Analysis tool for SNP 5.0 and 6.0 arrays. |
4 |
-Version: 1.0.64 |
|
4 |
+Version: 1.0.65 |
|
5 | 5 |
Date: 2008-12-28 |
6 | 6 |
Author: Rafael A Irizarry, Benilton S Carvalho <bcarvalh@jhsph.edu>, Robert Scharpf <rscharpf@jhsph.edu> |
7 | 7 |
Maintainer: Benilton S Carvalho <bcarvalh@jhsph.edu>, Robert Scharpf <rscharpf@jhsph.edu> |
... | ... |
@@ -28,6 +28,7 @@ generateIXTX <- function(x, nrow=3) { |
28 | 28 |
XTX <- crossprod(X) |
29 | 29 |
solve(XTX) |
30 | 30 |
} |
31 |
+ |
|
31 | 32 |
nuphiAllele <- function(p, allele, Ystar, W, envir){ |
32 | 33 |
Ns <- envir[["Ns"]] |
33 | 34 |
CHR <- envir[["chrom"]] |
... | ... |
@@ -120,7 +121,8 @@ celDates <- function(celfiles){ |
120 | 121 |
return(celdts) |
121 | 122 |
} |
122 | 123 |
|
123 |
-cnrma <- function(filenames, sns, cdfName, seed=1, verbose=FALSE){ |
|
124 |
+cnrma <- function(filenames, cdfName="genomewidesnp6", sns, seed=1, verbose=FALSE){ |
|
125 |
+ if(cdfName != "genomewidesnp6") stop("Only genomewidesnp6 supported at this time") |
|
124 | 126 |
## BC: 03/14/09 |
125 | 127 |
## getting pkgname from cdfName, in the future this might be useful |
126 | 128 |
## as the method might be implemented for other platforms |
... | ... |
@@ -131,7 +133,6 @@ cnrma <- function(filenames, sns, cdfName, seed=1, verbose=FALSE){ |
131 | 133 |
loader("npProbesFid.rda", .crlmmPkgEnv, pkgname) |
132 | 134 |
## data("npProbesFid", package=pkgname, envir=.crlmmPkgEnv) |
133 | 135 |
fid <- getVarInEnv("npProbesFid") |
134 |
- gc() |
|
135 | 136 |
set.seed(seed) |
136 | 137 |
idx2 <- sample(length(fid), 10^5) ##for skewness. no need to do everything |
137 | 138 |
SKW <- vector("numeric", length(filenames)) |
... | ... |
@@ -378,7 +379,7 @@ computeCopynumber <- function(chrom, |
378 | 379 |
envir=envir) |
379 | 380 |
} |
380 | 381 |
steps[3] <- TRUE |
381 |
- envir[["snp-cn"]] <- steps |
|
382 |
+ envir[["steps"]] <- steps |
|
382 | 383 |
} |
383 | 384 |
if(!steps[4]){ |
384 | 385 |
message("\nCopy number for nonpolymorphic probes...") |
... | ... |
@@ -389,7 +390,7 @@ computeCopynumber <- function(chrom, |
389 | 390 |
envir=envir) |
390 | 391 |
} |
391 | 392 |
steps[4] <- TRUE |
392 |
- envir[["np-cn"]] <- steps |
|
393 |
+ envir[["step"]] <- steps |
|
393 | 394 |
} |
394 | 395 |
} |
395 | 396 |
|
... | ... |
@@ -1053,14 +1054,99 @@ biasAdj <- function(plateIndex, envir, priorProb){ |
1053 | 1054 |
} |
1054 | 1055 |
|
1055 | 1056 |
|
1057 |
+posteriorNonpolymorphic <- function(plateIndex, envir, priorProb, cnStates=0:6){ |
|
1058 |
+ p <- plateIndex |
|
1059 |
+ CHR <- envir[["chrom"]] |
|
1060 |
+ if(missing(priorProb)) priorProb <- rep(1/length(cnStates), length(cnStates)) ##uniform |
|
1061 |
+ plate <- envir[["plate"]] |
|
1062 |
+ uplate <- envir[["plate"]] |
|
1063 |
+ NP <- envir[["NP"]][, plate==uplate[p]] |
|
1064 |
+ nuT <- envir[["nuT"]][, p] |
|
1065 |
+ phiT <- envir[["phiT"]][, p] |
|
1066 |
+ sig2T <- envir[["sig2T"]][, p] |
|
1067 |
+ ##Assuming background variance for np probes is the same on the log-scale |
|
1068 |
+ emit <- array(NA, dim=c(nrow(NP), ncol(NP), length(cnStates)))##SNPs x sample x 'truth' |
|
1069 |
+ lT <- log2(NP) |
|
1070 |
+ sds <- sqrt(sig2T) |
|
1071 |
+ counter <- 1##state counter |
|
1072 |
+ for(CT in cnStates){ |
|
1073 |
+ cat(".") |
|
1074 |
+ if(CHR == 23) browser() |
|
1075 |
+ means <- suppressWarnings(log2(nuT + CT*phiT)) |
|
1076 |
+ emit[, , counter] <- dnorm(lT, mean=means, sd=sds) |
|
1077 |
+ counter <- counter+1 |
|
1078 |
+ } |
|
1079 |
+ for(j in seq(along=cnStates)){ |
|
1080 |
+ emit[, , j] <- priorProb[j]*emit[, , j] |
|
1081 |
+ } |
|
1082 |
+ homDel <- emit[, , 1] |
|
1083 |
+ hemDel <- emit[, , 2] |
|
1084 |
+ norm <- emit[, , 3] |
|
1085 |
+ amp <- emit[, , 4] |
|
1086 |
+ amp4 <- emit[, , 5] |
|
1087 |
+ amp5 <- emit[, , 6] |
|
1088 |
+ amp6 <- emit[, , 7] |
|
1089 |
+ total <- homDel+hemDel+norm+amp+amp4+amp5+amp6 |
|
1090 |
+ weights <- array(NA, dim=c(nrow(NP), ncol(NP), length(cnStates))) |
|
1091 |
+ weights[, , 1] <- homDel/total |
|
1092 |
+ weights[, , 2] <- hemDel/total |
|
1093 |
+ weights[, , 3] <- norm/total |
|
1094 |
+ weights[, , 4] <- amp/total |
|
1095 |
+ weights[, , 5] <- amp4/total |
|
1096 |
+ weights[, , 6] <- amp5/total |
|
1097 |
+ weights[, , 7] <- amp6/total |
|
1098 |
+ ##posterior mode |
|
1099 |
+ posteriorMode <- apply(weights, c(1, 2), function(x) order(x, decreasing=TRUE)[1]) |
|
1100 |
+ posteriorMode <- posteriorMode-1 |
|
1101 |
+ ##sns <- envir[["sns"]] |
|
1102 |
+ ##colnames(posteriorMode) <- sns |
|
1103 |
+ ##envir[["np.posteriorMode"]] <- posteriorMode |
|
1104 |
+ ##envir[["np.weights"]] <- weights |
|
1105 |
+ posteriorMeans <- 0*homDel/total + 1*hemDel/total + 2*norm/total + 3*amp/total + 4*amp4/total + 5*amp5/total + 6*amp6/total |
|
1106 |
+ ##colnames(posteriorMeans) <- sns |
|
1107 |
+ ##envir[["np.posteriorMeans"]] <- posteriorMeans |
|
1108 |
+ return(posteriorMode) |
|
1109 |
+} |
|
1110 |
+ |
|
1111 |
+posteriorWrapper <- function(envir){ |
|
1112 |
+ snp.PM <- matrix(NA, length(envir[["snps"]]), length(envir[["sns"]])) |
|
1113 |
+ np.PM <- matrix(NA, length(envir[["cnvs"]]), length(envir[["sns"]])) |
|
1114 |
+ plate <- envir[["plate"]] |
|
1115 |
+ uplate <- envir[["uplate"]] |
|
1116 |
+ for(p in seq(along=uplate)){ |
|
1117 |
+ tmp <- expectedC(plateIndex=p, envir=envir) |
|
1118 |
+ snp.PM[, plate==uplate[p]] <- tmp |
|
1119 |
+ ##snp.pm <- env[["posteriorMode"]] |
|
1120 |
+ ##trace(posteriorNonpolymorphic, browser) |
|
1121 |
+ tmp <- posteriorNonpolymorphic(plateIndex=p, envir=envir) |
|
1122 |
+ np.PM[, plate==uplate[p]] <- tmp##env[["np.posteriorMode"]] |
|
1123 |
+ ##pMode <- rbind(snp.pm, np.pm) |
|
1124 |
+ ##rownames(pMode) <- c(env[["snps"]], env[["cnvs"]]) |
|
1125 |
+ ##dn <- dimnames(pMode) |
|
1126 |
+ ##pMode <- matrix(as.integer(pMode), nrow(pMode), ncol(pMode)) |
|
1127 |
+ } |
|
1128 |
+ PM <- rbind(snp.PM, np.PM) |
|
1129 |
+ PM <- matrix(as.integer(PM), nrow(PM), ncol(PM)) |
|
1130 |
+ dns <- list(c(envir[["snps"]], envir[["cnvs"]]), envir[["sns"]]) |
|
1131 |
+ dimnames(PM) <- dns |
|
1132 |
+ return(PM) |
|
1133 |
+} |
|
1134 |
+ |
|
1135 |
+ |
|
1136 |
+ |
|
1056 | 1137 |
|
1057 | 1138 |
|
1058 | 1139 |
##for polymorphic probes |
1059 |
-expectedC <- function(A, B, plateIndex, envir, priorProb){ |
|
1140 |
+expectedC <- function(plateIndex, envir, priorProb, cnStates=0:6){ |
|
1060 | 1141 |
p <- plateIndex |
1061 | 1142 |
CHR <- envir[["chrom"]] |
1062 |
- if(missing(priorProb)) priorProb <- rep(1/4, 6) ##uniform |
|
1143 |
+ if(missing(priorProb)) priorProb <- rep(1/length(cnStates), length(cnStates)) ##uniform |
|
1063 | 1144 |
plate <- envir[["plate"]] |
1145 |
+ uplate <- envir[["uplate"]] |
|
1146 |
+ A <- envir[["A"]] |
|
1147 |
+ B <- envir[["B"]] |
|
1148 |
+ A <- A[, plate==uplate[p]] |
|
1149 |
+ B <- B[, plate==uplate[p]] |
|
1064 | 1150 |
calls <- envir[["calls"]] |
1065 | 1151 |
calls <- calls[, plate==unique(plate)[p]] |
1066 | 1152 |
probA <- sqrt(rowMeans(calls == 1, na.rm=TRUE)) |
... | ... |
@@ -1084,7 +1170,7 @@ expectedC <- function(A, B, plateIndex, envir, priorProb){ |
1084 | 1170 |
lB <- log2(B) |
1085 | 1171 |
X <- cbind(lA, lB) |
1086 | 1172 |
counter <- 1##state counter |
1087 |
- for(CT in 0:6){ |
|
1173 |
+ for(CT in cnStates){ |
|
1088 | 1174 |
cat(".") |
1089 | 1175 |
for(CA in 0:CT){ |
1090 | 1176 |
CB <- CT-CA |
... | ... |
@@ -1122,9 +1208,8 @@ expectedC <- function(A, B, plateIndex, envir, priorProb){ |
1122 | 1208 |
norm <- priorProb[3]*emit[, , 4:6] |
1123 | 1209 |
amp <- priorProb[4]*emit[, , 7:10] |
1124 | 1210 |
amp4 <- priorProb[5]*emit[, , 11:15] |
1125 |
- amp5 <- priorProb[5]*emit[, , 16:21] |
|
1126 |
- amp6 <- priorProb[5]*emit[, , 22:28] |
|
1127 |
- |
|
1211 |
+ amp5 <- priorProb[6]*emit[, , 16:21] |
|
1212 |
+ amp6 <- priorProb[7]*emit[, , 22:28] |
|
1128 | 1213 |
##sum over the different combinations within each copy number state |
1129 | 1214 |
hemDel <- apply(hemDel, c(1,2), sum) |
1130 | 1215 |
norm <- apply(norm, c(1, 2), sum) |
... | ... |
@@ -1144,18 +1229,24 @@ expectedC <- function(A, B, plateIndex, envir, priorProb){ |
1144 | 1229 |
##posterior mode |
1145 | 1230 |
posteriorMode <- apply(weights, c(1, 2), function(x) order(x, decreasing=TRUE)[1]) |
1146 | 1231 |
posteriorMode <- posteriorMode-1 |
1147 |
- envir[["posteriorMode"]] <- posteriorMode |
|
1232 |
+ ##This is for one plate. Need to instantiate a much bigger |
|
1233 |
+ ##object in the environment |
|
1234 |
+ |
|
1235 |
+ ##envir[["posteriorMode"]] <- posteriorMode |
|
1148 | 1236 |
##weights <- list(homDel/total, hemDel/total, norm/total, amp/total, amp4/total, amp5/total, amp6/total) |
1149 |
- ##names(weights) <- c(0:6) |
|
1150 |
- envir[["weights"]] <- weights |
|
1237 |
+ ##names(weights) <- c(cnStates) |
|
1238 |
+ ##envir[["weights"]] <- weights |
|
1151 | 1239 |
posteriorMeans <- 0*homDel/total + 1*hemDel/total + 2*norm/total + 3*amp/total + 4*amp4/total + 5*amp5/total + 6*amp6/total |
1152 |
- sns <- envir[["sns"]] |
|
1153 |
- colnames(posteriorMeans) <- sns |
|
1154 |
- envir[["posteriorMeans"]] <- posteriorMeans |
|
1240 |
+ ##sns <- envir[["sns"]] |
|
1241 |
+ ##colnames(posteriorMeans) <- sns |
|
1242 |
+ ##envir[["posteriorMeans"]] <- posteriorMeans |
|
1243 |
+ return(posteriorMode) |
|
1155 | 1244 |
} |
1156 | 1245 |
|
1157 | 1246 |
|
1158 | 1247 |
|
1248 |
+ |
|
1249 |
+ |
|
1159 | 1250 |
biasAdjNP <- function(plateIndex, envir, priorProb){ |
1160 | 1251 |
p <- plateIndex |
1161 | 1252 |
normalNP <- envir[["normalNP"]] |
... | ... |
@@ -136,11 +136,11 @@ list2SnpSet <- function(x, returnParams=FALSE){ |
136 | 136 |
} |
137 | 137 |
|
138 | 138 |
loader <- function(theFile, envir, pkgname){ |
139 |
- stopifnot(theFile %in% c("genotypeStuff.rda", "mixtureStuff.rda", "preprocStuff.rda")) |
|
140 |
- theFile <- file.path(system.file(package=pkgname), |
|
141 |
- "extdata", theFile) |
|
142 |
- if (!file.exists(theFile)) |
|
143 |
- stop("File", theFile, "does not exist in", pkgname) |
|
144 |
- load(theFile, envir=envir) |
|
139 |
+ ##stopifnot(theFile %in% c("genotypeStuff.rda", "mixtureStuff.rda", "preprocStuff.rda")) |
|
140 |
+ theFile <- file.path(system.file(package=pkgname), |
|
141 |
+ "extdata", theFile) |
|
142 |
+ if (!file.exists(theFile)) |
|
143 |
+ stop("File", theFile, "does not exist in", pkgname) |
|
144 |
+ load(theFile, envir=envir) |
|
145 | 145 |
} |
146 | 146 |
|
... | ... |
@@ -70,7 +70,7 @@ Quantile normalize the nonpolymorphic probes and save the results. |
70 | 70 |
if(!exists("cnrmaResult")){ |
71 | 71 |
if(file.exists(file.path(outdir, "cnrmaResult.rda"))) load(file.path(outdir, "cnrmaResult.rda")) |
72 | 72 |
else { |
73 |
- cnrmaResult <- cnrma(celFiles) |
|
73 |
+ cnrmaResult <- cnrma(celFiles, cdfName="genomewidesnp6") |
|
74 | 74 |
save(cnrmaResult, file=file.path(outdir, "cnrmaResult.rda")) |
75 | 75 |
} |
76 | 76 |
} |
... | ... |
@@ -94,8 +94,9 @@ We require 6 items for copy number estimation: |
94 | 94 |
<<snpAndCnSummaries>>= |
95 | 95 |
A <- res$A |
96 | 96 |
B <- res$B |
97 |
-calls <- crlmmResult$calls |
|
98 |
-conf <- crlmmResult$conf |
|
97 |
+genotypes <- crlmm:::calls(crlmmResult)##$calls |
|
98 |
+conf <- confs(crlmmResult)##$conf |
|
99 |
+gender <- crlmmResult$gender |
|
99 | 100 |
SNR <- crlmmResult$SNR |
100 | 101 |
NP <- cnrmaResult$NP |
101 | 102 |
gc() |
... | ... |
@@ -107,21 +108,22 @@ A histogram of the signal to noise ratio for the HapMap samples: |
107 | 108 |
hist(SNR, xlab="SNR", main="") |
108 | 109 |
@ |
109 | 110 |
|
110 |
-We suggest excluding samples with a signal to noise ratio less than 5. |
|
111 |
-As batch effects can be very large in the quantile-normalized |
|
112 |
-intensities, we suggest adjusting for date or chemistry plate. |
|
113 | 111 |
|
114 | 112 |
<<dates>>= |
115 | 113 |
dts <- celDates(celFiles) |
116 | 114 |
table(format(dts, "%d %b %Y")) |
115 |
+SNRmin <- 5 |
|
117 | 116 |
@ |
118 | 117 |
|
119 |
- |
|
120 |
-Ideally, one would have 70+ files in a given batch. Here we make a table |
|
121 |
-of date versus ancestry: |
|
118 |
+We suggest excluding samples with a signal to noise ratio less than |
|
119 |
+\Sexpr{SNRmin}. As batch effects can be very large in the |
|
120 |
+quantile-normalized intensities, we suggest adjusting for date or |
|
121 |
+chemistry plate. Ideally, one would have 70+ files in a given |
|
122 |
+batch. Here we make a table of date versus ancestry: |
|
122 | 123 |
|
123 | 124 |
<<specifyBatch>>= |
124 |
-sns <- colnames(calls) |
|
125 |
+require(Biobase) |
|
126 |
+sns <- sampleNames(crlmmResult) |
|
125 | 127 |
sns[1] |
126 | 128 |
plate <- substr(basename(sns), 13, 13) |
127 | 129 |
table(plate) |
... | ... |
@@ -142,7 +144,7 @@ if(!exists("env")){ |
142 | 144 |
computeCopynumber(chrom=CHR, |
143 | 145 |
A=A, |
144 | 146 |
B=B, |
145 |
- calls=calls, |
|
147 |
+ calls=genotypes, |
|
146 | 148 |
conf=conf, |
147 | 149 |
NP=NP, |
148 | 150 |
plate=plate, |
... | ... |
@@ -150,7 +152,7 @@ if(!exists("env")){ |
150 | 152 |
DF.PRIOR=50, |
151 | 153 |
MIN.OBS=1, |
152 | 154 |
SNR=SNR, |
153 |
- SNRmin=5) |
|
155 |
+ SNRmin=SNRmin) |
|
154 | 156 |
save(env, file=file.path(outdir, paste("env_chr", CHR, ".rda", sep=""))) |
155 | 157 |
} else { |
156 | 158 |
load(file.path(outdir, paste("env_chr", CHR, ".rda", sep=""))) |
... | ... |
@@ -165,8 +167,9 @@ that all of the assay data is bound to the meta-data. |
165 | 167 |
|
166 | 168 |
<<oligoSnpSet>>= |
167 | 169 |
require(oligoClasses) |
168 |
-data(snpProbes, package="genomewidesnp6Crlmm") |
|
169 |
-data(cnProbes, package="genomewidesnp6Crlmm") |
|
170 |
+path <- system.file("extdata", package="genomewidesnp6Crlmm") |
|
171 |
+load(file.path(path, "snpProbes.rda")) |
|
172 |
+load(file.path(path, "cnProbes.rda")) |
|
170 | 173 |
position <- snpProbes[match(env[["snps"]], rownames(snpProbes)), "position"] |
171 | 174 |
position.np <- cnProbes[match(rownames(env[["NP"]]), rownames(cnProbes)), "position"] |
172 | 175 |
CA <- env[["CA"]] |
... | ... |
@@ -220,7 +223,7 @@ if(!exists("env")){ |
220 | 223 |
computeCopynumber(chrom=CHR, |
221 | 224 |
A=A, |
222 | 225 |
B=B, |
223 |
- calls=calls, |
|
226 |
+ calls=genotypes, |
|
224 | 227 |
conf=conf, |
225 | 228 |
NP=NP, |
226 | 229 |
plate=plate, |
... | ... |
@@ -332,8 +335,8 @@ i <- I[1] |
332 | 335 |
##plate effects are small |
333 | 336 |
log2(phiA[i, ]) |
334 | 337 |
log2(phiB[i, ]) |
335 |
-plot(log2(A[i, ]), log2(B[i, ]), pch=as.character(calls[i, ]), col="grey60", cex=0.9, ylim=ylim, xlim=ylim, xlab="A", ylab="B") |
|
336 |
-points(log2(A[i, J]), log2(B[i, J]), col="black", pch=as.character(calls[i, J])) |
|
338 |
+plot(log2(A[i, ]), log2(B[i, ]), pch=as.character(genotypes[i, ]), col="grey60", cex=0.9, ylim=ylim, xlim=ylim, xlab="A", ylab="B") |
|
339 |
+points(log2(A[i, J]), log2(B[i, J]), col="black", pch=as.character(genotypes[i, J])) |
|
337 | 340 |
for(CT in 2){ |
338 | 341 |
if(CT == 2) ellipse.col <- "black" ##else ellipse.col <- "purple" |
339 | 342 |
for(CA in 0:CT){ |
... | ... |
@@ -419,9 +422,9 @@ for(j in seq(along=index)){ |
419 | 422 |
J1 <- grep(plate[plate1[j]], plate) ##sample indices for this plate |
420 | 423 |
J2 <- grep(plate[plate2[j]], plate) ##sample indices for this plate |
421 | 424 |
ylim <- c(6.5,13) |
422 |
- plot(log2(A[i, ]), log2(B[i, ]), pch=as.character(calls[i, ]), col="grey60", cex=0.9, ylim=ylim, xlim=ylim, xlab="A", ylab="B") |
|
423 |
- points(log2(A[i, J1]), log2(B[i, J1]), col="brown", pch=as.character(calls[i, J1])) |
|
424 |
- points(log2(A[i, J2]), log2(B[i, J2]), col="blue", pch=as.character(calls[i, J2])) |
|
425 |
+ plot(log2(A[i, ]), log2(B[i, ]), pch=as.character(genotypes[i, ]), col="grey60", cex=0.9, ylim=ylim, xlim=ylim, xlab="A", ylab="B") |
|
426 |
+ points(log2(A[i, J1]), log2(B[i, J1]), col="brown", pch=as.character(genotypes[i, J1])) |
|
427 |
+ points(log2(A[i, J2]), log2(B[i, J2]), col="blue", pch=as.character(genotypes[i, J2])) |
|
425 | 428 |
CT <- 2 |
426 | 429 |
P <- c(plate1[j], plate2[j]) |
427 | 430 |
for(p in seq(along=P)){ |
... | ... |
@@ -459,11 +462,6 @@ for(i in seq(along=index)){ |
459 | 462 |
} |
460 | 463 |
@ |
461 | 464 |
|
462 |
-%\begin{figure} |
|
463 |
-% \includegraphics[width=0.9\textwidth]{copynumber-plateEffect} |
|
464 |
-% \caption{The prediction regions for copy number 2 shift when there |
|
465 |
-% is a large plate effect.} |
|
466 |
-%\end{figure} |
|
467 | 465 |
|
468 | 466 |
\section{Session information} |
469 | 467 |
<<>>= |
... | ... |
@@ -6,12 +6,12 @@ |
6 | 6 |
to a HapMap reference distribution. |
7 | 7 |
} |
8 | 8 |
\usage{ |
9 |
-cnrma(filenames, sns, cdfName, seed = 1, verbose=FALSE) |
|
9 |
+cnrma(filenames, cdfName="genomewidesnp6", sns, seed = 1, verbose=FALSE) |
|
10 | 10 |
} |
11 | 11 |
\arguments{ |
12 | 12 |
\item{filenames}{filenames with complete path} |
13 |
+ \item{cdfName}{Only 'genomewidesnp6' allowed} |
|
13 | 14 |
\item{sns}{the sample names. If missing, the basename of the filenames is used.} |
14 |
- \item{cdfName}{Should be 'genomewidesnp6Crlmm'} |
|
15 | 15 |
\item{seed}{seed for sampling the intensities to calculate skewness} |
16 | 16 |
\item{verbose}{logical} |
17 | 17 |
} |
... | ... |
@@ -22,13 +22,11 @@ cnrma(filenames, sns, cdfName, seed = 1, verbose=FALSE) |
22 | 22 |
\author{Rob Scharpf} |
23 | 23 |
\note{Not tested} |
24 | 24 |
\examples{ |
25 |
- \dontrun{ |
|
26 |
- library(genomewidesnp6Crlmm) |
|
27 |
- library(hapmapsnp6) |
|
28 |
- path <- system.file("celFiles", package="hapmapsnp6") |
|
29 |
- celFiles <- list.celfiles(path, full.names=TRUE) |
|
30 |
- cnrmaResult <- cnrma(celFiles) |
|
31 |
- } |
|
25 |
+ library(genomewidesnp6Crlmm) |
|
26 |
+ library(hapmapsnp6) |
|
27 |
+ path <- system.file("celFiles", package="hapmapsnp6") |
|
28 |
+ celFiles <- list.celfiles(path, full.names=TRUE) |
|
29 |
+ cnrmaResult <- cnrma(celFiles, cdfName="genomewidesnp6") |
|
32 | 30 |
} |
33 | 31 |
\keyword{robust} |
34 | 32 |
|
... | ... |
@@ -13,7 +13,6 @@ computeCopynumber(chrom, A, B, calls, conf, NP, plate, MIN.OBS=1, |
13 | 13 |
envir, P, DF.PRIOR = 50, CONF.THR = 0.99, bias.adj=FALSE, |
14 | 14 |
priorProb, gender=NULL, SNR, SNRmin, seed=123, verbose=TRUE, ...) |
15 | 15 |
} |
16 |
-%- maybe also 'usage' for other objects documented here. |
|
17 | 16 |
\arguments{ |
18 | 17 |
\item{chrom}{Chromosome (an integer). Use 23 for X and 24 for Y.} |
19 | 18 |
\item{A}{The A allele intensities from \code{snprma}} |
... | ... |
@@ -52,22 +51,58 @@ priorProb, gender=NULL, SNR, SNRmin, seed=123, verbose=TRUE, ...) |
52 | 51 |
|
53 | 52 |
\details{ |
54 | 53 |
|
55 |
- This function essentially transforms intensities from the raw scale to |
|
56 |
- a copy number scale. We assume that the median within-SNP intensity |
|
57 |
- across samples is 2. We make no assumption about the chromosomal copy |
|
58 |
- number. This function is mostly useful for detecting rare variants |
|
59 |
- (e.g., variants that would not affect the SNP-specific quantile-based |
|
60 |
- estimators of location and scale). A correction for more common |
|
61 |
- variants is coming, as well as improved estimates of the uncertainty. |
|
54 |
+ This function transforms the intensities to a copy number scale. We |
|
55 |
+ assume that the median within-SNP intensity across samples is 2. We |
|
56 |
+ make no assumption about the chromosomal copy number. This function is |
|
57 |
+ useful for detecting rare variants (e.g., variants that would not |
|
58 |
+ affect the SNP-specific quantile-based estimators of location and |
|
59 |
+ scale). A correction for more common variants is coming, as well as |
|
60 |
+ improved estimates of the uncertainty. |
|
62 | 61 |
|
63 | 62 |
} |
64 | 63 |
|
65 | 64 |
\value{ |
66 | 65 |
|
67 |
- For now, nothing is returned. All objects created by this function are |
|
68 |
- stored in the environment passed to this function. See the copynumber |
|
69 |
- vignette for details on accessing these objects. |
|
70 |
- |
|
66 |
+All objects created by this function are stored in the environment |
|
67 |
+ passed to this function. In addition, each of the elements are |
|
68 |
+ specific to the chromosome(s) specified by the argument \code{chrom}. |
|
69 |
+ For instance the element \code{A} is the matrix of quantile-normalized |
|
70 |
+ intensities for the A-allele on chromosome(s) \code{chrom}. The |
|
71 |
+ element of this environment are as follows |
|
72 |
+ |
|
73 |
+ \item{A}{Matrix of quantile-normalized intensities for the A-allele} |
|
74 |
+ \item{B}{Matrix of quantile-normalized intensities for the A-allele} |
|
75 |
+ \item{CA}{Copy number estimate for the A-allele (x 100)} |
|
76 |
+ \item{CB}{Copy number estimate for the B-allele (x 100)} |
|
77 |
+ \item{calls}{CRLMM genotype calls (AA=1, AB=2, BB=3)} |
|
78 |
+ \item{chrom}{Integer(s) indicating the chromosome(s)} |
|
79 |
+ \item{cnvs}{Names of the nonpolymorphic probes. These are the |
|
80 |
+ rownames of \code{NP} and \code{CT}.} |
|
81 |
+ \item{conf}{CRLMM confidence scores for the genotypes: 'round(-1000*log2(1-p))'} |
|
82 |
+ \item{corr}{Correlation of the A and B alleles for genotypes AB} |
|
83 |
+ \item{corrA.BB}{Correlation of A and B alleles for genotypes BB} |
|
84 |
+ \item{corrB.AA}{Correlation of A and B alleles for genotypes AA} |
|
85 |
+ \item{CT}{Copy number estimates for nonpolymorphic probe. See |
|
86 |
+ \code{cnvs} for the rownames.} |
|
87 |
+ \item{CT.sds}{Standard deviation estimates for \code{CT}} |
|
88 |
+ \item{npflags}{Flags for the nonpolymorphic probes.} |
|
89 |
+ \item{Ns}{The number of observations for each genotype/plate} |
|
90 |
+ \item{nuA}{Background/cross-hyb for the A allele (plate- and locus-specific)} |
|
91 |
+ \item{nuB}{Background/cross-hyb for the B allele (plate- and locus-specific)} |
|
92 |
+ \item{nuT}{Background for the nonpolymorphic probes (plate- and locus-specific)} |
|
93 |
+ \item{phiA}{Slope for the A allele (plate- and locus-specific)} |
|
94 |
+ \item{phiB}{Slope for the B allele (plate- and locus-specific)} |
|
95 |
+ \item{phiT}{Slope for the nonpolymorphic probes (plate- and locus-specific)} |
|
96 |
+ \item{plate}{Factor indicating batch (same length as number of cel files)} |
|
97 |
+ \item{sig2A}{Variance estimate for the A-allele signal (plate- and locus-specific)} |
|
98 |
+ \item{sig2B}{Variance estimate for the B-allele signal (plate- and locus-specific)} |
|
99 |
+ \item{sig2T}{Variance estimate for the nonpolymorphic signal (plate- and locus-specific)} |
|
100 |
+ \item{snpflags}{Flags for polymorphic probes} |
|
101 |
+ \item{snps}{Rownames for \code{A}, \code{B}, \code{CA}, \code{CB}, ...} |
|
102 |
+ \item{sns}{ Sample names -- the column names for \code{A}, \code{B}, ...} |
|
103 |
+ \item{steps}{Steps completed. For internal use.} |
|
104 |
+ \item{tau2A}{Variance estimate for the B-allele background/cross-hyb (plate- and locus-specific)} |
|
105 |
+ \item{tau2B}{Variance estimate for the B-allele background/cross-hyb (plate- and locus-specific)} |
|
71 | 106 |
} |
72 | 107 |
\references{Nothing yet.} |
73 | 108 |
\author{Rob Scharpf} |