git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/crlmm@41178 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -264,3 +264,11 @@ is decoded and scanned |
264 | 264 |
* overhaul of vignette |
265 | 265 |
* added update() method for copy number |
266 | 266 |
* added documentation and error checks for crlmmWrapper |
267 |
+ |
|
268 |
+2009-08-14 R. Scharpf - committed version 1.3.19 |
|
269 |
+ |
|
270 |
+* changes to crlmmWrapper (trying to make this handle the illumina platform as well...still needs testing) |
|
271 |
+ - removed crlmmIlluminaWrapper.Rd, and commented crlmmIlluminaWrapper function |
|
272 |
+* labeled figures / displayed output of code chunks in the copy number vignette |
|
273 |
+* added bibliography for copy number vignette. Added file inst/doc/refs.bib |
|
274 |
+* added boxplot method |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: crlmm |
2 | 2 |
Type: Package |
3 | 3 |
Title: Genotype Calling (CRLMM) and Copy Number Analysis tool for Affymetrix SNP 5.0 and 6.0 and Illumina arrays. |
4 |
-Version: 1.3.18 |
|
4 |
+Version: 1.3.19 |
|
5 | 5 |
Date: 2009-07-22 |
6 | 6 |
Author: Rafael A Irizarry, Benilton S Carvalho <bcarvalh@jhsph.edu>, Robert Scharpf <rscharpf@jhsph.edu>, Matt Ritchie <mritchie@wehi.EDU.AU> |
7 | 7 |
Maintainer: Benilton S Carvalho <bcarvalh@jhsph.edu>, Robert Scharpf <rscharpf@jhsph.edu>, Matt Ritchie <mritchie@wehi.EDU.AU> |
... | ... |
@@ -28,7 +28,7 @@ importFrom(Biobase, assayDataElement, assayDataElementNames, |
28 | 28 |
assayDataElementReplace, assayDataNew, classVersion, validMsg) |
29 | 29 |
|
30 | 30 |
importFrom(graphics, abline, axis, layout, legend, mtext, par, plot, |
31 |
- polygon, rect, segments, text, points) |
|
31 |
+ polygon, rect, segments, text, points, boxplot) |
|
32 | 32 |
|
33 | 33 |
importFrom(stats, update) |
34 | 34 |
|
... | ... |
@@ -76,7 +76,7 @@ export(batch, |
76 | 76 |
copyNumber, |
77 | 77 |
crlmm, |
78 | 78 |
crlmmIllumina, |
79 |
- crlmmIlluminaWrapper, |
|
79 |
+## crlmmIlluminaWrapper, |
|
80 | 80 |
crlmmWrapper, |
81 | 81 |
## ellipse, |
82 | 82 |
## computeEmission, |
... | ... |
@@ -215,69 +215,76 @@ harmonizeDimnamesTo <- function(object1, object2){ |
215 | 215 |
return(object1) |
216 | 216 |
} |
217 | 217 |
|
218 |
-crlmmIlluminaWrapper <- function(outdir="./", |
|
219 |
- cdfName, |
|
220 |
- save.intermediate=FALSE, |
|
221 |
- splitByChr=TRUE, |
|
222 |
- intensityFile, |
|
223 |
- ...){ ##additional arguments to readIdatFiles |
|
224 |
- stopifnot(basename(intensityFile) == "res.rda") |
|
225 |
- if(!file.exists(outdir)) stop(outdir, " does not exist.") |
|
226 |
- if(!isValidCdfName(cdfName, platform="illumina")) stop(cdfName, " not supported.") |
|
227 |
- if(file.exists(file.path(outdir, "RG.rda"))) { |
|
228 |
- message("Loading RG.rda...") |
|
229 |
- load(file.path(outdir, "RG.rda")) |
|
230 |
- } else { |
|
231 |
- message("Reading Idat files...") |
|
232 |
- RG <- readIdatFiles(...) |
|
233 |
- ##J <- match(c("1_A", "3_A", "5_A", "7_A"), sampleNames(RG)) |
|
234 |
- ##RG <- RG[, -J] |
|
235 |
- if(save.intermediate) save(RG, file=file.path(outdir, "RG.rda")) ##935M for 91 samples...better not to save this |
|
236 |
- } |
|
237 |
- if(!file.exists(intensityFile)){ |
|
238 |
- message("Quantile normalization / genotyping...") |
|
239 |
- crlmmOut <- crlmmIllumina(RG=RG, |
|
240 |
- cdfName=cdfName, |
|
241 |
- sns=sampleNames(RG), |
|
242 |
- returnParams=TRUE, |
|
243 |
- save.it=TRUE, |
|
244 |
- intensityFile=intensityFile) |
|
245 |
- if(save.intermediate) save(crlmmOut, file=file.path(outdir, "crlmmOut.rda")) |
|
246 |
- } else{ |
|
247 |
- load(file.path(outdir, "crlmmOut.rda")) |
|
248 |
- } |
|
249 |
- message("Loading ", intensityFile, "...") |
|
250 |
- load(intensityFile) |
|
251 |
- if(exists("cnAB")){ |
|
252 |
- np.A <- as.integer(cnAB$A) |
|
253 |
- np.B <- as.integer(cnAB$B) |
|
254 |
- np <- ifelse(np.A > np.B, np.A, np.B) |
|
255 |
- np <- matrix(np, nrow(cnAB$A), ncol(cnAB$A)) |
|
256 |
- rownames(np) <- cnAB$gns |
|
257 |
- colnames(np) <- cnAB$sns |
|
258 |
- cnAB$NP <- np |
|
259 |
- } |
|
260 |
- sampleNames(crlmmOut) <- res$sns |
|
261 |
- if(exists("cnAB")){ |
|
262 |
- ABset <- combineIntensities(get("res"), cnAB, cdfName=cdfName) |
|
263 |
- } else{ |
|
264 |
- ABset <- combineIntensities(get("res"), NULL, cdfName=cdfName) |
|
265 |
- } |
|
266 |
- ##protocolData(ABset)[["ScanDate"]] <- as.character(pData(RG)$ScanDate) |
|
267 |
- crlmmResult <- harmonizeSnpSet(crlmmOut, ABset, cdfName) |
|
268 |
- stopifnot(all.equal(dimnames(crlmmOut), dimnames(ABset))) |
|
269 |
- crlmmList <- list(ABset, |
|
270 |
- crlmmResult) |
|
271 |
- crlmmList <- as(crlmmList, "CrlmmSetList") |
|
272 |
- if(splitByChr){ |
|
273 |
- message("Saving by chromosome") |
|
274 |
- splitByChromosome(crlmmList, cdfName=cdfName, outdir=outdir) |
|
275 |
- } else{ |
|
276 |
- message("Saving crlmmList object to ", outdir) |
|
277 |
- save(crlmmList, file=file.path(outdir, "crlmmList.rda")) |
|
278 |
- } |
|
279 |
- message("CrlmmSetList objects saved to ", outdir) |
|
280 |
-} |
|
218 |
+##crlmmIlluminaWrapper <- function(filenames, |
|
219 |
+## cdfName, |
|
220 |
+## load.it=FALSE, |
|
221 |
+## save.it=FALSE, |
|
222 |
+## splitByChr=TRUE, |
|
223 |
+## crlmmFile, |
|
224 |
+## intensityFile, ...){ |
|
225 |
+#### outdir="./", |
|
226 |
+#### cdfName, |
|
227 |
+#### save.intermediate=FALSE, |
|
228 |
+#### splitByChr=TRUE, |
|
229 |
+#### intensityFile, |
|
230 |
+#### ...){ ##additional arguments to readIdatFiles |
|
231 |
+#### stopifnot(basename(intensityFile) == "res.rda") |
|
232 |
+## if(!file.exists(outdir)) stop(outdir, " does not exist.") |
|
233 |
+## if(!isValidCdfName(cdfName, platform="illumina")) stop(cdfName, " not supported.") |
|
234 |
+## if(file.exists(file.path(outdir, "RG.rda"))) { |
|
235 |
+## message("Loading RG.rda...") |
|
236 |
+## load(file.path(outdir, "RG.rda")) |
|
237 |
+## } else { |
|
238 |
+## message("Reading Idat files...") |
|
239 |
+## RG <- readIdatFiles(...) |
|
240 |
+## ##J <- match(c("1_A", "3_A", "5_A", "7_A"), sampleNames(RG)) |
|
241 |
+## ##RG <- RG[, -J] |
|
242 |
+## if(save.intermediate) save(RG, file=file.path(outdir, "RG.rda")) ##935M for 91 samples...better not to save this |
|
243 |
+## } |
|
244 |
+## if(!file.exists(intensityFile)){ |
|
245 |
+## message("Quantile normalization / genotyping...") |
|
246 |
+## crlmmOut <- crlmmIllumina(RG=RG, |
|
247 |
+## cdfName=cdfName, |
|
248 |
+## sns=sampleNames(RG), |
|
249 |
+## returnParams=TRUE, |
|
250 |
+## save.it=TRUE, |
|
251 |
+## intensityFile=intensityFile) |
|
252 |
+## if(save.intermediate) save(crlmmOut, file=file.path(outdir, "crlmmOut.rda")) |
|
253 |
+## } else{ |
|
254 |
+## load(file.path(outdir, "crlmmOut.rda")) |
|
255 |
+## } |
|
256 |
+## message("Loading ", intensityFile, "...") |
|
257 |
+## load(intensityFile) |
|
258 |
+## if(exists("cnAB")){ |
|
259 |
+## np.A <- as.integer(cnAB$A) |
|
260 |
+## np.B <- as.integer(cnAB$B) |
|
261 |
+## np <- ifelse(np.A > np.B, np.A, np.B) |
|
262 |
+## np <- matrix(np, nrow(cnAB$A), ncol(cnAB$A)) |
|
263 |
+## rownames(np) <- cnAB$gns |
|
264 |
+## colnames(np) <- cnAB$sns |
|
265 |
+## cnAB$NP <- np |
|
266 |
+## } |
|
267 |
+## sampleNames(crlmmOut) <- res$sns |
|
268 |
+## if(exists("cnAB")){ |
|
269 |
+## ABset <- combineIntensities(get("res"), cnAB, cdfName=cdfName) |
|
270 |
+## } else{ |
|
271 |
+## ABset <- combineIntensities(get("res"), NULL, cdfName=cdfName) |
|
272 |
+## } |
|
273 |
+## ##protocolData(ABset)[["ScanDate"]] <- as.character(pData(RG)$ScanDate) |
|
274 |
+## crlmmResult <- harmonizeSnpSet(crlmmOut, ABset, cdfName) |
|
275 |
+## stopifnot(all.equal(dimnames(crlmmOut), dimnames(ABset))) |
|
276 |
+## crlmmList <- list(ABset, |
|
277 |
+## crlmmResult) |
|
278 |
+## crlmmList <- as(crlmmList, "CrlmmSetList") |
|
279 |
+## if(splitByChr){ |
|
280 |
+## message("Saving by chromosome") |
|
281 |
+## splitByChromosome(crlmmList, cdfName=cdfName, outdir=outdir) |
|
282 |
+## } else{ |
|
283 |
+## message("Saving crlmmList object to ", outdir) |
|
284 |
+## save(crlmmList, file=file.path(outdir, "crlmmList.rda")) |
|
285 |
+## } |
|
286 |
+## message("CrlmmSetList objects saved to ", outdir) |
|
287 |
+##} |
|
281 | 288 |
|
282 | 289 |
##quantileNormalize1m <- function(cel.files, |
283 | 290 |
## outdir, |
... | ... |
@@ -393,7 +400,29 @@ crlmmWrapper <- function(filenames, |
393 | 400 |
save.it=FALSE, |
394 | 401 |
splitByChr=TRUE, |
395 | 402 |
crlmmFile, |
396 |
- intensityFile, ...){ |
|
403 |
+ intensityFile, |
|
404 |
+ rgFile, |
|
405 |
+ platform=c("affymetrix", "illumina")[1], |
|
406 |
+ ...){ |
|
407 |
+ if(!(platform %in% c("affymetrix", "illumina"))) |
|
408 |
+ stop("Only 'affymetrix' and 'illumina' platforms are supported at this time.") |
|
409 |
+ if(missing(intensityFile)) stop("must specify 'intensityFile'.") |
|
410 |
+ if(missing(crlmmFile)) stop("must specify 'crlmmFile'.") |
|
411 |
+ if(platform == "illumina"){ |
|
412 |
+ if(missing(rgFile)) stop("must specify 'rgFile'.") |
|
413 |
+ if(load.it & !file.exists(rgFile)){ |
|
414 |
+ message("load.it is TRUE, bug rgFile not present. Attempting to read the idatFiles.") |
|
415 |
+ RG <- readIdatFiles(...) |
|
416 |
+ if(save.it) save(RG, file=rgFile) |
|
417 |
+ } |
|
418 |
+ if(load.it & file.exists(rgFile)){ |
|
419 |
+ message("Loading RG file") |
|
420 |
+ load(rgFile) |
|
421 |
+ RG <- get("RG") |
|
422 |
+ } |
|
423 |
+ } |
|
424 |
+ if(!(file.exists(dirname(crlmmFile)))) stop(dirname(crlmmFile), " does not exist.") |
|
425 |
+ if(!(file.exists(dirname(intensityFile)))) stop(dirname(intensityFile), " does not exist.") |
|
397 | 426 |
outfiles <- file.path(dirname(crlmmFile), paste("crlmmSetList_", 1:24, ".rda", sep="")) |
398 | 427 |
if(load.it & all(file.exists(outfiles))){ |
399 | 428 |
load(outfiles[1]) |
... | ... |
@@ -404,38 +433,55 @@ crlmmWrapper <- function(filenames, |
404 | 433 |
return("load.it is TRUE and 'crlmmSetList_<CHR>.rda' objects found. Nothing to do...") |
405 | 434 |
} |
406 | 435 |
} |
407 |
- if(missing(intensityFile)) stop("must specify 'intensityFile'.") |
|
408 |
- if(missing(crlmmFile)) stop("must specify 'crlmmFile'.") |
|
409 | 436 |
if(load.it){ |
410 | 437 |
if(!file.exists(crlmmFile)){ |
411 | 438 |
message("load.it is TRUE, but 'crlmmFile' does not exist. Rerunning the genotype calling algorithm") |
412 | 439 |
load.it <- FALSE |
413 | 440 |
} |
414 | 441 |
} |
415 |
- if(!file.exists(outdir)) stop(outdir, " does not exist.") |
|
416 |
- if(!isValidCdfName(cdfName, platform="affymetrix")) |
|
417 |
- stop(cdfName, " is not a valid entry. See crlmm:::validCdfNames(platform='affymetrix')") |
|
418 |
- if(!file.exists(crlmmFile) | !load.it){ |
|
419 |
- crlmmResult <- crlmm(filenames=filenames, |
|
420 |
- cdfName=cdfName, |
|
421 |
- save.it=TRUE, |
|
422 |
- load.it=load.it, |
|
423 |
- intensityFile=intensityFile, ...) |
|
424 |
- message("Quantile normalizing the copy number probes...") |
|
425 |
- cnrmaResult <- cnrma(filenames=filenames, cdfName=cdfName) |
|
426 |
- if(save.it){ |
|
427 |
- message("Saving crlmmResult and cnrmaResult to", crlmmFile) |
|
428 |
- save(crlmmResult, cnrmaResult, file=crlmmFile) |
|
442 |
+ if(!isValidCdfName(cdfName, platform=platform)) |
|
443 |
+ stop(cdfName, " is not a valid entry. See crlmm:::validCdfNames(platform)") |
|
444 |
+ if(platform == "affymetrix"){ |
|
445 |
+ if(!file.exists(crlmmFile) | !load.it){ |
|
446 |
+ crlmmResult <- crlmm(filenames=filenames, |
|
447 |
+ cdfName=cdfName, |
|
448 |
+ save.it=TRUE, |
|
449 |
+ load.it=load.it, |
|
450 |
+ intensityFile=intensityFile) |
|
451 |
+ message("Quantile normalizing the copy number probes...") |
|
452 |
+ cnrmaResult <- cnrma(filenames=filenames, cdfName=cdfName) |
|
453 |
+ if(save.it){ |
|
454 |
+ message("Saving crlmmResult and cnrmaResult to", crlmmFile) |
|
455 |
+ save(crlmmResult, cnrmaResult, file=crlmmFile) |
|
456 |
+ } |
|
457 |
+ } else { |
|
458 |
+ message("Loading ", crlmmFile, "...") |
|
459 |
+ load(crlmmFile) |
|
460 |
+ crlmmResult <- get("crlmmResult") |
|
461 |
+ cnrmaResult <- get("cnrmaResult") |
|
462 |
+ } |
|
463 |
+ } |
|
464 |
+ if(platform == "illumina"){ |
|
465 |
+ if(!file.exists(crlmmFile) | !load.it){ |
|
466 |
+ crlmmOut <- crlmmIllumina(RG=RG, |
|
467 |
+ cdfName=cdfName, |
|
468 |
+ sns=sampleNames(RG), |
|
469 |
+ returnParams=TRUE, |
|
470 |
+ save.it=TRUE, |
|
471 |
+ intensityFile=intensityFile) |
|
472 |
+ if(save.it) save(crlmmOut, file=crlmmFile) |
|
473 |
+ } else { |
|
474 |
+ message("Loading ", crlmmFile, "...") |
|
475 |
+ load(crlmmFile) |
|
476 |
+ crlmmResult <- get("crlmmResult") |
|
477 |
+ if(exists("cnAB")){ |
|
478 |
+ cnrmaResult <- get("cnAB") |
|
479 |
+ } else cnrmaResult <- NULL |
|
429 | 480 |
} |
430 |
- } else { |
|
431 |
- message("Loading ", crlmmFile, "...") |
|
432 |
- load(crlmmFile) |
|
433 |
- crlmmResult <- get("crlmmResult") |
|
434 |
- cnrmaResult <- get("cnrmaResult") |
|
435 | 481 |
} |
436 | 482 |
load(intensityFile) |
437 | 483 |
ABset <- combineIntensities(get("res"), cnrmaResult, cdfName) |
438 |
- protocolData(ABset)[["ScanDate"]] <- as.character(celDates(filenames)) |
|
484 |
+ if(platform=="affymetrix") protocolData(ABset)[["ScanDate"]] <- as.character(celDates(filenames)) |
|
439 | 485 |
crlmmResult <- harmonizeSnpSet(crlmmResult, ABset, cdfName) |
440 | 486 |
stopifnot(all.equal(dimnames(crlmmResult), dimnames(ABset))) |
441 | 487 |
crlmmSetList <- as(list(ABset, crlmmResult), "CrlmmSetList") |
... | ... |
@@ -611,9 +657,7 @@ instantiateObjects <- function(calls, conf, NP, plate, envir, |
611 | 657 |
envir[["normalNP"]] <- normalNP |
612 | 658 |
} |
613 | 659 |
|
614 |
-setMethod("update", "CrlmmSetList", function(object, ...){ |
|
615 |
- computeCopynumber(object, ...) |
|
616 |
-}) |
|
660 |
+ |
|
617 | 661 |
|
618 | 662 |
computeCopynumber <- function(object, |
619 | 663 |
CHR, |
... | ... |
@@ -621,6 +665,7 @@ computeCopynumber <- function(object, |
621 | 665 |
batch, |
622 | 666 |
SNRmin=5, |
623 | 667 |
cdfName, ...){ |
668 |
+ if(class(object) != "CrlmmSetList") stop("object must be of class ClrmmSetList") |
|
624 | 669 |
if(missing(cdfName)) |
625 | 670 |
cdfName <- annotation(object) |
626 | 671 |
if(!isValidCdfName(cdfName, platform="affymetrix")) stop(cdfName, " not supported.") |
... | ... |
@@ -23,43 +23,48 @@ setMethod("[", "CrlmmSetList", function(x, i, j, ..., drop = FALSE){ |
23 | 23 |
as(x, "CrlmmSetList") |
24 | 24 |
}) |
25 | 25 |
|
26 |
-##setReplaceMethod("[[", "CrlmmSetList", function(x, i, j, ..., value) { |
|
27 |
-## browser() |
|
28 |
-## ##otherwise infinite recursion |
|
29 |
-## x <- as(x, "list") |
|
30 |
-## x[[i]] <- value |
|
31 |
-## x <- as(x, "CrlmmSetList") |
|
32 |
-## x <- .harmonizeDimnames(x) |
|
33 |
-## stopifnot(identical(featureNames(x[[i]]), featureNames(x[[1]]))) |
|
34 |
-## return(x) |
|
35 |
-##}) |
|
26 |
+setMethod("$", "CrlmmSetList", function(x, name) { |
|
27 |
+ ##if(!(name %in% .parameterNames()[output(x) != 0])){ |
|
28 |
+ if(length(x) != 3){ |
|
29 |
+ stop("'$' operature reserved for accessing parameter names in CopyNumberSet object. CrlmmSetList must be of length 3") |
|
30 |
+ } |
|
31 |
+ j <- grep(name, fvarLabels(x[[3]])) |
|
32 |
+ if(length(j) < 1) |
|
33 |
+ stop(name, " not in fvarLabels of CopyNumberSet object") |
|
34 |
+ if(length(j) > 1){ |
|
35 |
+ warning("Multiple instances of ", name, " in fvarLabels. Using the first instance") |
|
36 |
+ j <- j[1] |
|
37 |
+ } |
|
38 |
+ param <- fData(x[[3]])[, j] |
|
39 |
+ param |
|
40 |
+}) |
|
41 |
+setMethod(".harmonizeDimnames", "CrlmmSetList", function(object){ |
|
42 |
+ i <- length(object) |
|
43 |
+ while(i > 1){ |
|
44 |
+ object[[i-1]] <- harmonizeDimnamesTo(object[[i-1]], object[[i]]) |
|
45 |
+ i <- i-1 |
|
46 |
+ } |
|
47 |
+ object |
|
48 |
+}) |
|
36 | 49 |
|
37 | 50 |
setMethod("A", "CrlmmSetList", function(object) A(object[[1]])) |
38 |
- |
|
39 | 51 |
setMethod("annotation", "CrlmmSetList", function(object) annotation(object[[1]])) |
40 |
- |
|
41 | 52 |
setMethod("B", "CrlmmSetList", function(object) B(object[[1]])) |
42 |
- |
|
53 |
+setMethod("batch", "CrlmmSetList", function(object) batch(object[[3]])) |
|
43 | 54 |
setMethod("CA", "CrlmmSetList", function(object, ...) CA(object[[3]], ...)) |
44 | 55 |
setMethod("CB", "CrlmmSetList", function(object, ...) CB(object[[3]], ...)) |
45 |
- |
|
46 | 56 |
setMethod("calls", "CrlmmSetList", function(object) calls(object[[2]])) |
57 |
+setMethod("chromosome", "CrlmmSetList", function(object) chromosome(object[[3]])) |
|
47 | 58 |
setMethod("cnIndex", "CrlmmSetList", function(object, ...) { |
48 | 59 |
match(cnNames(object[[1]], annotation(object)), featureNames(object)) |
49 | 60 |
}) |
50 |
- |
|
51 |
-setMethod("copyNumber", "CrlmmSetList", function(object) copyNumber(object[[3]])) |
|
52 |
- |
|
53 | 61 |
setMethod("combine", signature=signature(x="CrlmmSetList", y="CrlmmSetList"), |
54 | 62 |
function(x, y, ...){ |
55 | 63 |
x.abset <- x[[1]] |
56 | 64 |
y.abset <- y[[1]] |
57 |
- |
|
58 | 65 |
x.snpset <- x[[2]] |
59 | 66 |
y.snpset <- y[[2]] |
60 |
- |
|
61 | 67 |
abset <- combine(x.abset, y.abset) |
62 |
- |
|
63 | 68 |
##we have hijacked the featureData slot to store parameters. Biobase will not allow combining our 'feature' data. |
64 | 69 |
warning("the featureData is not easily combined... removing the featureData") |
65 | 70 |
##fd1 <- featureData(x.snpset) |
... | ... |
@@ -71,13 +76,10 @@ setMethod("combine", signature=signature(x="CrlmmSetList", y="CrlmmSetList"), |
71 | 76 |
merged <- as(merged, "CrlmmSetList") |
72 | 77 |
merged |
73 | 78 |
}) |
74 |
- |
|
75 |
- |
|
76 |
- |
|
77 |
-##setMethod("fData", "CrlmmSetList", function(object) featureNames(object[[1]])) |
|
78 |
- |
|
79 |
+setMethod("confs", "CrlmmSetList", function(object) confs(object[[2]])) |
|
80 |
+setMethod("copyNumber", "CrlmmSetList", function(object) copyNumber(object[[3]])) |
|
81 |
+setMethod("dims", "CrlmmSetList", function(object) sapply(object, dim)) |
|
79 | 82 |
setMethod("featureNames", "CrlmmSetList", function(object) featureNames(object[[1]])) |
80 |
- |
|
81 | 83 |
setMethod("ncol", signature(x="CrlmmSetList"), function(x) ncol(x[[1]])) |
82 | 84 |
setMethod("nrow", signature(x="CrlmmSetList"), function(x) nrow(x[[1]])) |
83 | 85 |
setMethod("plot", signature(x="CrlmmSetList"), |
... | ... |
@@ -86,18 +88,15 @@ setMethod("plot", signature(x="CrlmmSetList"), |
86 | 88 |
B <- log2(B(x)) |
87 | 89 |
plot(A, B, ...) |
88 | 90 |
}) |
89 |
- |
|
90 | 91 |
setMethod("points", signature(x="CrlmmSetList"), |
91 | 92 |
function(x, y, ...){ |
92 | 93 |
A <- log2(A(x)) |
93 | 94 |
B <- log2(B(x)) |
94 | 95 |
points(A, B, ...) |
95 | 96 |
}) |
96 |
- |
|
97 |
+setMethod("position", "CrlmmSetList", function(object) position(object[[3]])) |
|
97 | 98 |
setMethod("sampleNames", "CrlmmSetList", function(object) sampleNames(object[[1]])) |
98 |
- |
|
99 | 99 |
setMethod("show", "CrlmmSetList", function(object){ |
100 |
- ##for(i in seq(along=object)) show(object[[i]]) |
|
101 | 100 |
cat("\n Elements in CrlmmSetList object: \n") |
102 | 101 |
cat("\n") |
103 | 102 |
for(i in 1:length(object)){ |
... | ... |
@@ -106,43 +105,7 @@ setMethod("show", "CrlmmSetList", function(object){ |
106 | 105 |
cat("Dimensions: ", dim(object[[i]])) |
107 | 106 |
cat("\n \n") |
108 | 107 |
} |
109 |
-## cat("\n") |
|
110 |
-## cat("Dimensions:\n") |
|
111 |
-## print(dims(object)) |
|
112 |
-}) |
|
113 |
- |
|
114 |
-setMethod("chromosome", "CrlmmSetList", function(object) chromosome(object[[3]])) |
|
115 |
-setMethod("position", "CrlmmSetList", function(object) position(object[[3]])) |
|
116 |
-setMethod("confs", "CrlmmSetList", function(object) confs(object[[2]])) |
|
117 |
- |
|
118 |
- |
|
119 |
-setMethod(".harmonizeDimnames", "CrlmmSetList", function(object){ |
|
120 |
- i <- length(object) |
|
121 |
- while(i > 1){ |
|
122 |
- object[[i-1]] <- harmonizeDimnamesTo(object[[i-1]], object[[i]]) |
|
123 |
- i <- i-1 |
|
124 |
- } |
|
125 |
- object |
|
126 |
-}) |
|
127 |
-setMethod("dims", "CrlmmSetList", function(object) sapply(object, dim)) |
|
128 |
-setMethod("batch", "CrlmmSetList", function(object) batch(object[[3]])) |
|
129 |
-setMethod("$", "CrlmmSetList", function(x, name) { |
|
130 |
- ##if(!(name %in% .parameterNames()[output(x) != 0])){ |
|
131 |
- if(length(x) != 3){ |
|
132 |
- stop("'$' operature reserved for accessing parameter names in CopyNumberSet object. CrlmmSetList must be of length 3") |
|
133 |
- } |
|
134 |
- j <- grep(name, fvarLabels(x[[3]])) |
|
135 |
- if(length(j) < 1) |
|
136 |
- stop(name, " not in fvarLabels of CopyNumberSet object") |
|
137 |
- if(length(j) > 1){ |
|
138 |
- warning("Multiple instances of ", name, " in fvarLabels. Using the first instance") |
|
139 |
- j <- j[1] |
|
140 |
- } |
|
141 |
- param <- fData(x[[3]])[, j] |
|
142 |
- param |
|
143 | 108 |
}) |
144 |
- |
|
145 |
- |
|
146 | 109 |
setMethod("snpIndex", "CrlmmSetList", function(object, ...){ |
147 | 110 |
match(snpNames(object[[1]], annotation(object)), featureNames(object)) |
148 | 111 |
}) |
... | ... |
@@ -163,5 +126,78 @@ setMethod("splitByChromosome", "CrlmmSetList", function(object, cdfName, outdir) |
163 | 126 |
save(crlmmSetList, file=file.path(outdir, paste("crlmmSetList_", CHR, ".rda", sep=""))) |
164 | 127 |
} |
165 | 128 |
}) |
129 |
+setMethod("update", "CrlmmSetList", function(object, ...){ |
|
130 |
+ computeCopynumber(object, ...) |
|
131 |
+}) |
|
166 | 132 |
|
167 | 133 |
|
134 |
+setMethod("boxplot", "CrlmmSetList", function(x, ...){ |
|
135 |
+##boxplot.CrlmmSetList <- function(x, ...){ |
|
136 |
+ if(length(x) != 3) stop("elements of list should be of class ABset, SnpSet, and CopyNumberSet, respectively.") |
|
137 |
+ genotypes <- calls(x)-1 |
|
138 |
+ A1 <- A(x) |
|
139 |
+ B1 <- B(x) |
|
140 |
+ Alist <- split(A1, genotypes) |
|
141 |
+ Alist <- rev(Alist) |
|
142 |
+ Blist <- split(B1, genotypes) |
|
143 |
+ ylim <- range(unlist(Alist)) |
|
144 |
+ boxplot(Alist, xaxt="n", ylab=expression(I[A]), |
|
145 |
+ cex.axis=0.6, |
|
146 |
+ xlab="", |
|
147 |
+ ylim=range(unlist(Alist), na.rm=TRUE), |
|
148 |
+ border="grey50", xaxs="i", at=0:2, xlim=c(-0.5, 2.5), |
|
149 |
+ cex.main=0.9, xaxt="n", |
|
150 |
+ yaxt="n", |
|
151 |
+ col=cols) |
|
152 |
+ axis(2, at=pretty(ylim), cex.axis=0.8) |
|
153 |
+ axis(1, at=0:2, labels=rev(c("2A (AA genotype)", "1A (AB genotype)", "0A (BB genotype)")), cex.axis=0.7) |
|
154 |
+ ##extracts nuA for first batch |
|
155 |
+ suppressWarnings(nuA <- x$nuA) |
|
156 |
+ segments(-1, nuA, |
|
157 |
+ 0, nuA, lty=2, col="blue") |
|
158 |
+ suppressWarnings(phiA <- x$phiA) |
|
159 |
+ ##phiA <- fData(x)[["phiA_A"]] |
|
160 |
+ segments(0, nuA, |
|
161 |
+ 2.5, nuA+2.5*phiA, lwd=2, col="blue") |
|
162 |
+ axis(2, at=nuA, labels=expression(hat(nu[A])), cex.axis=0.9) |
|
163 |
+ text(0, ylim[1], labels=paste("n =", length(Alist[[1]])), cex=0.8) |
|
164 |
+ text(1, ylim[1], labels=paste("n =", length(Alist[[2]])), cex=0.8) |
|
165 |
+ text(2, ylim[1], labels=paste("n =", length(Alist[[3]])), cex=0.8) |
|
166 |
+## segments(0.5, nuA+0.5*phiA, |
|
167 |
+## 1, pretty(ylim, n=5)[2], lty=2, col="blue") |
|
168 |
+## segments(1, pretty(ylim, n=5)[2], |
|
169 |
+## 1.2, pretty(ylim)[2], lty=2, col="blue") |
|
170 |
+## text(1.25, pretty(ylim)[2], pos=4, |
|
171 |
+## labels=expression(hat(nu[A]) + c[A]*hat(phi[A]))) |
|
172 |
+ legend("topleft", fill=rev(cols), legend=c("AA", "AB", "BB"))##, title="diallelic genotypes") |
|
173 |
+ |
|
174 |
+ ylim <- range(unlist(Blist)) |
|
175 |
+ boxplot(Blist, xaxt="n", ylab=expression(I[B]), |
|
176 |
+ ##xlab="diallelic genotypes", |
|
177 |
+ cex.axis=0.6, |
|
178 |
+ ylim=range(unlist(Blist), na.rm=TRUE), |
|
179 |
+ border="grey50", xaxs="i", |
|
180 |
+ at=0:2, xlim=c(-0.5, 2.5), |
|
181 |
+ cex.main=0.9, yaxt="n", |
|
182 |
+ col=rev(cols)) |
|
183 |
+ axis(2, at=pretty(ylim), cex.axis=0.8) |
|
184 |
+ axis(1, at=0:2, labels=c("0B (AA genotype)", "1B (AB genotype)", "2B (BB genotype)"), cex.axis=0.7) |
|
185 |
+ ##nuB <- fData(x)[["nuB_A"]] |
|
186 |
+ suppressWarnings(nuB <- x$nuB) |
|
187 |
+ segments(-1, nuB, |
|
188 |
+ 0, nuB, lty=2, col="blue") |
|
189 |
+ ##phiB <- fData(x[i,])[["phiB_A"]] |
|
190 |
+ suppressWarnings(phiB <- x$phiB) |
|
191 |
+ segments(0, nuB, |
|
192 |
+ 2.5, nuB+2.5*phiB, lwd=2, col="blue") |
|
193 |
+ axis(2, at=nuB, labels=expression(hat(nu[B])), cex.axis=0.9) |
|
194 |
+ text(0, ylim[1], labels=paste("n =", length(Blist[[1]])), cex=0.8) |
|
195 |
+ text(1, ylim[1], labels=paste("n =", length(Blist[[2]])), cex=0.8) |
|
196 |
+ text(2, ylim[1], labels=paste("n =", length(Blist[[3]])), cex=0.8) |
|
197 |
+## segments(0.5, nuB+0.5*phiB, |
|
198 |
+## 1, pretty(ylim,n=5)[2], lty=2, col="blue") |
|
199 |
+## segments(1, pretty(ylim, n=5)[2], |
|
200 |
+## 1.2, pretty(ylim,n=5)[2], lty=2, col="blue") |
|
201 |
+## text(1.25, pretty(ylim,n=5)[2], pos=4, labels=expression(hat(nu[B]) + c[B]*hat(phi[B]))) |
|
202 |
+ mtext(featureNames(x)[i], 3, outer=TRUE, line=1) |
|
203 |
+}) |
... | ... |
@@ -4,6 +4,7 @@ |
4 | 4 |
%\VignettePackage{crlmm} |
5 | 5 |
\documentclass{article} |
6 | 6 |
\usepackage{graphicx} |
7 |
+\usepackage[authoryear,round,numbers]{natbib} |
|
7 | 8 |
\newcommand{\Rfunction}[1]{{\texttt{#1}}} |
8 | 9 |
\newcommand{\Rmethod}[1]{{\texttt{#1}}} |
9 | 10 |
\newcommand{\Rcode}[1]{{\texttt{#1}}} |
... | ... |
@@ -32,7 +33,9 @@ options(prompt="R> ") |
32 | 33 |
|
33 | 34 |
\begin{abstract} |
34 | 35 |
This vignette estimates copy number for HapMap samples on the |
35 |
- Affymetrix 6.0 platform. |
|
36 |
+ Affymetrix 6.0 platform. See \citep{Scharpf2009} for the working |
|
37 |
+ paper. |
|
38 |
+ |
|
36 | 39 |
\end{abstract} |
37 | 40 |
|
38 | 41 |
\section{Simple usage} |
... | ... |
@@ -142,7 +145,32 @@ str(brks) |
142 | 145 |
@ |
143 | 146 |
|
144 | 147 |
\paragraph{Circular binary segmentation} |
145 |
-TO DO. |
|
148 |
+ |
|
149 |
+<<setup>>= |
|
150 |
+library(DNAcopy) |
|
151 |
+library(genefilter) |
|
152 |
+ratioset <- crlmmSetList[[3]] |
|
153 |
+meds <- rowMedians(copyNumber(ratioset), na.rm=TRUE) |
|
154 |
+ratios <- log2(copyNumber(ratioset)) - log2(meds) |
|
155 |
+ratioset <- new("SnpCopyNumberSet", |
|
156 |
+ copyNumber=ratios, |
|
157 |
+ phenoData=phenoData(ratioset), |
|
158 |
+ featureData=featureData(ratioset), |
|
159 |
+ annotation=annotation(ratioset)) |
|
160 |
+@ |
|
161 |
+ |
|
162 |
+The following code chunk (not evaluated) takes a while to run: |
|
163 |
+ |
|
164 |
+<<cbs, eval=FALSE>>= |
|
165 |
+CNA.object <- CNA(copyNumber(ratioset), |
|
166 |
+ chromosome(ratioset), |
|
167 |
+ position(ratioset), |
|
168 |
+ data.type="logratio", |
|
169 |
+ sampleid=sampleNames(ratioset)) |
|
170 |
+smoothed.CNA.object <- smooth.CNA(CNA.object) |
|
171 |
+segment.cna <- segment(smoothed.CNA.object, verbose=1) |
|
172 |
+save(segment.cna, file=file.path(outdir, paste("segment.cna_", CHR, ".rda", sep=""))) |
|
173 |
+@ |
|
146 | 174 |
|
147 | 175 |
\section{Accessors} |
148 | 176 |
|
... | ... |
@@ -301,7 +329,12 @@ argument to \Robject{TRUE}: |
301 | 329 |
update(crlmmSetList, CHR=22, bias.adj=TRUE) |
302 | 330 |
@ |
303 | 331 |
|
304 |
-Calculate the frequency of amplifications and deletions at each locus. |
|
332 |
+The following code chunk calculates the frequency of amplifications and |
|
333 |
+deletions at each locus. Shaded regions above the zero line in Figure |
|
334 |
+\ref{fig:hmm_hapmap} display the frequency of amplifications, whereas |
|
335 |
+shaded regions below the zero line graphically display the frequency of |
|
336 |
+hemizygous or homozygous deletions. |
|
337 |
+ |
|
305 | 338 |
<<hmm_hapmap, fig=TRUE, include=FALSE, width=8, height=7>>= |
306 | 339 |
require(SNPchip) |
307 | 340 |
library(RColorBrewer) |
... | ... |
@@ -351,14 +384,17 @@ gc() |
351 | 384 |
\begin{figure} |
352 | 385 |
\centering |
353 | 386 |
\includegraphics[width=\textwidth]{copynumber-hmm_hapmap} |
354 |
- \caption{} |
|
387 |
+ \caption{\label{fig:hmm_hapmap} The frequency of amplifications in the |
|
388 |
+ hapmap samples is displayed above the zero line. The frequency of |
|
389 |
+ hemizygous or homozygous deletions are displayed below the zero |
|
390 |
+ line.} |
|
355 | 391 |
\end{figure} |
356 | 392 |
|
393 |
+\clearpage |
|
357 | 394 |
\paragraph{One sample at a time: locus-level estimates} |
358 | 395 |
|
359 |
-Plot physical position versus copy number for the first sample. Recall |
|
360 |
-that the copy number estimates were multiplied by 100 and stored as an |
|
361 |
-integer. |
|
396 |
+Figure \ref{fig:oneSample} plots physical position (horizontal axis) |
|
397 |
+versus copy number (vertical axis) for the first sample. |
|
362 | 398 |
|
363 | 399 |
<<oneSample, fig=TRUE, width=8, height=4, include=FALSE>>= |
364 | 400 |
par(las=1) |
... | ... |
@@ -377,17 +413,55 @@ plotCytoband(22, new=FALSE, cytoband.ycoords=c(5.8, 6.0), label.cytoband=FALSE) |
377 | 413 |
|
378 | 414 |
\begin{figure} |
379 | 415 |
\includegraphics[width=0.9\textwidth]{copynumber-oneSample} |
380 |
- \caption{Total copy number (y-axis) for chromosome 22 plotted |
|
381 |
- against physical position (x-axis) for one sample. Estimates at |
|
382 |
- nonpolymorphic loci are plotted in light blue.} |
|
416 |
+ \caption{\label{fig:oneSample} Total copy number (y-axis) for |
|
417 |
+ chromosome 22 plotted against physical position (x-axis) for one |
|
418 |
+ sample. Estimates at nonpolymorphic loci are plotted in light |
|
419 |
+ blue.} |
|
420 |
+\end{figure} |
|
421 |
+ |
|
422 |
+\noindent The following code chunk plots the locus-level copy number |
|
423 |
+estimates and overlays the predictions from the hidden markov model. |
|
424 |
+ |
|
425 |
+<<overlayHmmPredictions, fig=TRUE, include=FALSE>>= |
|
426 |
+ask <- FALSE |
|
427 |
+op <- par(mfrow=c(3, 1), las=1, mar=c(1, 4, 1, 1), oma=c(3, 1, 1, 1), ask=ask) |
|
428 |
+##Put fit on the copy number scale |
|
429 |
+cns <- copyNumber(crlmmSetList) |
|
430 |
+cnState <- hmmPredictions - as.integer(1) |
|
431 |
+xlim <- c(10*1e6, max(position(crlmmSetList))) |
|
432 |
+cols <- brewer.pal(8, "Dark2")[1:4] |
|
433 |
+for(j in 1:3){ |
|
434 |
+ plot(position(crlmmSetList), cnState[, j], pch=".", col=cols[2], xaxt="n", |
|
435 |
+ ylab="copy number", xlab="Physical position (Mb)", type="s", lwd=2, |
|
436 |
+ ylim=c(0,6), xlim=xlim) |
|
437 |
+ points(position(crlmmSetList), cns[, j], pch=".", col=cols[3]) |
|
438 |
+ lines(position(crlmmSetList), cnState[,j], lwd=2, col=cols[2]) |
|
439 |
+ axis(1, at=pretty(position(crlmmSetList)), |
|
440 |
+ labels=pretty(position(crlmmSetList))/1e6) |
|
441 |
+ abline(h=c(1,3), lty=2, col=cols[1]) |
|
442 |
+ legend("topright", bty="n", legend=sampleNames(crlmmSetList)[j]) |
|
443 |
+ legend("topleft", lty=1, col=cols[2], legend="copy number state", |
|
444 |
+ bty="n", lwd=2) |
|
445 |
+ plotCytoband(CHR, cytoband.ycoords=c(5, 5.2), new=FALSE, |
|
446 |
+ label.cytoband=FALSE, xlim=xlim) |
|
447 |
+} |
|
448 |
+par(op) |
|
449 |
+@ |
|
450 |
+ |
|
451 |
+\begin{figure} |
|
452 |
+ \includegraphics[width=\textwidth]{copynumber-overlayHmmPredictions} |
|
453 |
+ \caption{\label{fig:overlayHmmPredictions} Total copy number (y-axis) |
|
454 |
+ for chromosome 22 plotted against physical position (x-axis) for |
|
455 |
+ three samples. Estimates at nonpolymorphic loci are plotted in |
|
456 |
+ light blue. } |
|
383 | 457 |
\end{figure} |
384 | 458 |
|
459 |
+\clearpage |
|
385 | 460 |
\paragraph{One SNP at a time} |
386 | 461 |
|
387 |
-Plot the prediction regions for total copy number 2 and 3 for the first |
|
388 |
-plate. Plotting symbols are the genotype calls (1=AA, 2=AB, 3=BB); light |
|
389 |
-grey points are from other plates. One could also add the prediction |
|
390 |
-regions for 0-4 copies, but it gets crowded. |
|
462 |
+Scatterplots of the A and B allele intensities (log-scale) can be useful |
|
463 |
+for assessing the diallelic genotype calls. The following code chunk is |
|
464 |
+displayed in Figure \ref{fig:genotypeCalls}. |
|
391 | 465 |
|
392 | 466 |
<<genotypeCalls, fig=TRUE, width=8, height=8, include=FALSE>>= |
393 | 467 |
xlim <- ylim <- c(6.5,13) |
... | ... |
@@ -397,7 +471,7 @@ cex <- 0.6 |
397 | 471 |
par(mfrow=c(3,3), las=1, pty="s", ask=FALSE, mar=c(2, 2, 2, 2), oma=c(2, 2, 1, 1)) |
398 | 472 |
##plot 9 at a time |
399 | 473 |
indices <- split(snpIndex(crlmmSetList), rep(1:length(snpIndex(crlmmSetList)), each=9, length.out=length(snpIndex(crlmmSetList)))) |
400 |
-par(ask=FALSE) |
|
474 |
+##par(ask=FALSE) |
|
401 | 475 |
j <- 1 |
402 | 476 |
for(i in indices[[j]]){ |
403 | 477 |
gt <- calls(crlmmSetList)[i, ] |
... | ... |
@@ -409,9 +483,22 @@ for(i in indices[[j]]){ |
409 | 483 |
mtext("A", 1, outer=TRUE, line=1) |
410 | 484 |
mtext("B", 2, outer=TRUE, line=1) |
411 | 485 |
} |
412 |
-@ |
|
486 |
+@ |
|
487 |
+ |
|
488 |
+\begin{figure} |
|
489 |
+ \centering |
|
490 |
+ \includegraphics[width=0.8\textwidth]{copynumber-genotypeCalls} |
|
491 |
+ \caption{\label{fig:genotypeCalls} Scatterplots of A versus B |
|
492 |
+ intensities. Each panel displays a single SNP.} |
|
493 |
+\end{figure} |
|
494 |
+ |
|
495 |
+TODO: Plot the prediction regions for total copy number 2 and 3 for the |
|
496 |
+first plate. Plotting symbols are the genotype calls (1=AA, 2=AB, 3=BB); |
|
497 |
+light grey points are from other plates. One could also add the |
|
498 |
+prediction regions for 0-4 copies, but it gets crowded. |
|
499 |
+ |
|
413 | 500 |
|
414 |
-<<predictionRegion, fig=TRUE, width=8, height=8, include=FALSE, eval=FALSE>>= |
|
501 |
+<<predictionRegion, fig=TRUE, width=8, height=8, include=FALSE, eval=FALSE, echo=FALSE>>= |
|
415 | 502 |
require(RColorBrewer) |
416 | 503 |
library(ellipse) |
417 | 504 |
greens <- brewer.pal(9, "Greens") |
... | ... |
@@ -470,14 +557,45 @@ j <- 1 |
470 | 557 |
%\end{figure} |
471 | 558 |
|
472 | 559 |
\section{Details for the copy number estimation procedure} |
473 |
-TO DO. |
|
560 |
+ |
|
561 |
+We assume a linear relationship between the normalized intensities and |
|
562 |
+the allele-specific copy number. SNP-specific parameters are estimated |
|
563 |
+only from samples with a suitable confidence score for the diallelic |
|
564 |
+genotype calls. The default confidence threshold is 0.99, but can be |
|
565 |
+adjusted by passing the argument \Robject{CONF.THR} to the |
|
566 |
+\Robject{update} method. TODO: illustrate this approach with boxplots |
|
567 |
+of the A and B intensities stratified by genotype. |
|
568 |
+ |
|
569 |
+<<linearModel, fig=TRUE,include=FALSE, eval=FALSE, echo=FALSE>>= |
|
570 |
+cols <- brewer.pal(7, "Accent")[c(1, 4, 7)] |
|
571 |
+i <- match("SNP_A-8608180", featureNames(crlmmSetList)) |
|
572 |
+B <- batch(crlmmSetList) == unique(batch(crlmmSetList))[1] |
|
573 |
+gt.conf <- confs(crlmmSetList[i, B]) |
|
574 |
+op <- par(mfrow=c(2, 1), las=1, ask=FALSE, mar=c(3.5, 4, 0.5, 0.5), oma=c(0, 0, 2, 0)) |
|
575 |
+crlmm:::boxplot(crlmmSetList[i, B][[1]]) |
|
576 |
+par(op) |
|
577 |
+@ |
|
578 |
+ |
|
579 |
+%\begin{figure} |
|
580 |
+% \centering |
|
581 |
+% \includegraphics[width=0.8\textwidth]{copynumber-linearModel} |
|
582 |
+% |
|
583 |
+% \caption{\label{fig:linearModel} The SNP-specific intercept and slope |
|
584 |
+% for the first batch of samples. These plots can sometimes be |
|
585 |
+% misleading as the genotypes estimated with low confidence do not |
|
586 |
+% influence the regression line.} |
|
587 |
+%\end{figure} |
|
474 | 588 |
|
475 | 589 |
\section{Session information} |
476 | 590 |
<<sessionInfo, results=tex>>= |
477 | 591 |
toLatex(sessionInfo()) |
478 | 592 |
@ |
479 | 593 |
|
594 |
+\section*{References} |
|
480 | 595 |
|
481 |
- |
|
596 |
+%\begin{bibliography} |
|
597 |
+ \bibliographystyle{plain} |
|
598 |
+ \bibliography{refs} |
|
599 |
+%\end{bibliography} |
|
482 | 600 |
|
483 | 601 |
\end{document} |
485 | 603 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,8 @@ |
1 |
+@UNPUBLISHED{Scharpf2009, |
|
2 |
+ author = {Robert B Scharpf and Ingo Ruczinski and Benilton Carvalho and Betty |
|
3 |
+ Doan and Aravinda Chakravarti and Rafael Irizarry}, |
|
4 |
+ title = {A multilevel model to address batch effects in copy number estimation |
|
5 |
+ using SNP arrays}, |
|
6 |
+ month = {May}, |
|
7 |
+ year = {2009} |
|
8 |
+} |
|
0 | 9 |
\ No newline at end of file |
... | ... |
@@ -13,6 +13,7 @@ |
13 | 13 |
\alias{chromosome,CrlmmSetList-method} |
14 | 14 |
\alias{cnIndex,CrlmmSetList-method} |
15 | 15 |
\alias{combine,CrlmmSetList,CrlmmSetList-method} |
16 |
+\alias{confs,CrlmmSetList-method} |
|
16 | 17 |
\alias{copyNumber,CrlmmSetList-method} |
17 | 18 |
\alias{nrow,CrlmmSetList-method} |
18 | 19 |
\alias{ncol,CrlmmSetList-method} |
... | ... |
@@ -22,6 +23,7 @@ |
22 | 23 |
\alias{sampleNames,CrlmmSetList-method} |
23 | 24 |
\alias{show,CrlmmSetList-method} |
24 | 25 |
\alias{snpIndex,CrlmmSetList-method} |
26 |
+\alias{update,CrlmmSetList-method} |
|
25 | 27 |
|
26 | 28 |
|
27 | 29 |
\title{Class "CrlmmSetList"} |
... | ... |
@@ -68,15 +70,15 @@ |
68 | 70 |
\section{Methods}{ |
69 | 71 |
\describe{ |
70 | 72 |
\item{"["}{\code{signature(x = "CrlmmSetList")}: subsets both the |
71 |
- features and samples of each element in th elist} |
|
72 |
- |
|
73 |
+ features and samples of each element in th elist} |
|
74 |
+ |
|
73 | 75 |
\item{"$"}{\code{signature(x = "CrlmmSetList")}: used to access |
74 | 76 |
element from the \code{featureData} of the \code{CopyNumberSet} |
75 | 77 |
element. In particular, useful for extract the SNP- and |
76 | 78 |
batch-specific parameters used to estimate copy number that are |
77 | 79 |
currently stored in the \code{featureData} of \code{CopyNumberSet} |
78 | 80 |
objects. } |
79 |
- |
|
81 |
+ |
|
80 | 82 |
\item{"A"}{\code{signature(object = "CrlmmSetList")}: extracts the |
81 | 83 |
quantile normalized intensities for the A allele in the |
82 | 84 |
\code{ABset} element.} |
... | ... |
@@ -84,7 +86,7 @@ |
84 | 86 |
\item{"B"}{\code{signature(object = "CrlmmSetList")}: extracts the |
85 | 87 |
quantile normalized intensities for the B allele in the |
86 | 88 |
\code{ABset} element.} |
87 |
- |
|
89 |
+ |
|
88 | 90 |
\item{"batch"}{\code{signature(object = "CrlmmSetList")}: extracts the |
89 | 91 |
batch information used to estimate copy number.} |
90 | 92 |
|
... | ... |
@@ -104,6 +106,9 @@ |
104 | 106 |
|
105 | 107 |
\item{"combine"}{\code{signature(x = "CrlmmSetList", y = "CrlmmSetList")}: combines |
106 | 108 |
objects of the class. } |
109 |
+ |
|
110 |
+ \item{"confs"}{\code{signature(x = "CrlmmSetList")}: confidence |
|
111 |
+ scores for crlmm genotype calls. } |
|
107 | 112 |
|
108 | 113 |
\item{"nrow"}{\code{signature(x = "CrlmmSetList")}: Number of rows |
109 | 114 |
(features) of each element in the list. } |
... | ... |
@@ -125,18 +130,20 @@ |
125 | 130 |
|
126 | 131 |
\item{"snpIndex"}{\code{signature(object = "CrlmmSetList")}: returns |
127 | 132 |
the row indices of the polymorphic probes.} |
128 |
- |
|
129 |
- |
|
130 |
- } |
|
131 |
-} |
|
132 | 133 |
|
134 |
+ \item{"update"}{\code{signature(object = "CrlmmSetList")}: This |
|
135 |
+ method calls \code{computeCopynumber} to compute copy number for the |
|
136 |
+ \code{crlmmSetList} object. The object returned by this method is |
|
137 |
+ itself an instance of class \code{CrlmmSetList}. The third element |
|
138 |
+ of the list is an instance of \code{CopyNumberSet} containing the |
|
139 |
+ locus-level, allele-specific estimates of copynumber. } |
|
140 |
+} |
|
141 |
+} |
|
133 | 142 |
|
134 | 143 |
\section{Warnings}{ |
135 |
- |
|
136 | 144 |
\code{combine} will produce a warning as the \code{featureData} are |
137 | 145 |
not easily combined and therefore removed. This method needs |
138 | 146 |
improvement. |
139 |
- |
|
140 | 147 |
} |
141 | 148 |
\author{R. Scharpf} |
142 | 149 |
\seealso{ |
... | ... |
@@ -8,7 +8,7 @@ |
8 | 8 |
|
9 | 9 |
} |
10 | 10 |
\usage{ |
11 |
-computeCopynumber(object, CHR, bias.adj=FALSE, batch, SNRmin=5, cdfName="genomewidesnp6", ...) |
|
11 |
+computeCopynumber(object, CHR, bias.adj=FALSE, batch, SNRmin=5, cdfName, ...) |
|
12 | 12 |
} |
13 | 13 |
\arguments{ |
14 | 14 |
\item{object}{object of class \code{CrlmmSetList}.} |
... | ... |
@@ -25,6 +25,10 @@ computeCopynumber(object, CHR, bias.adj=FALSE, batch, SNRmin=5, cdfName="genomew |
25 | 25 |
|
26 | 26 |
\details{ |
27 | 27 |
|
28 |
+ One may altenatively use the \code{update} method (a wrapper for |
|
29 |
+ \code{computeCopynumber}) to add a \code{CopyNumberSet} object to the |
|
30 |
+ \code{CrlmmSetList} object. |
|
31 |
+ |
|
28 | 32 |
This function requires 10 or more samples to estimate model |
29 | 33 |
parameters. Preferably, 70+ samples would be processed together in a |
30 | 34 |
batch. |
... | ... |
@@ -42,12 +46,12 @@ computeCopynumber(object, CHR, bias.adj=FALSE, batch, SNRmin=5, cdfName="genomew |
42 | 46 |
|
43 | 47 |
\value{ |
44 | 48 |
|
45 |
- An object of class \code{CopyNumberSet}. |
|
49 |
+ An object of class \code{CrlmmSetList}. |
|
46 | 50 |
|
47 | 51 |
} |
48 | 52 |
|
49 | 53 |
\seealso{ |
50 |
- \code{\linkS4class{CopyNumberSet}}, \code{.computeCopynumber} |
|
54 |
+ \code{\link{update}}, \code{\linkS4class{CrlmmSetList}}, \code{\linkS4class{CopyNumberSet}}, \code{.computeCopynumber} |
|
51 | 55 |
} |
52 | 56 |
\author{Rob Scharpf} |
53 | 57 |
\keyword{manip} |
54 | 58 |
deleted file mode 100644 |
... | ... |
@@ -1,57 +0,0 @@ |
1 |
-\name{crlmmIlluminaWrapper} |
|
2 |
-\Rdversion{1.1} |
|
3 |
-\alias{crlmmIlluminaWrapper} |
|
4 |
-\title{ |
|
5 |
- Reads idat files, quantile normalizes the raw intensities, and |
|
6 |
- provides diallelic genotype calls at polymorphic loci. |
|
7 |
-} |
|
8 |
-\description{ |
|
9 |
- This function is a wrapper for utilities used to preprocess and |
|
10 |
- genotype files from the illumina platform. See Section see also. |
|
11 |
-} |
|
12 |
-\usage{ |
|
13 |
-crlmmIlluminaWrapper(outdir = "./", cdfName, save.intermediate = FALSE, splitByChr = TRUE, intensityFile, ...) |
|
14 |
-} |
|
15 |
-\arguments{ |
|
16 |
- \item{outdir}{Character string. The complete path to the directory |
|
17 |
- where output will be saved.} |
|
18 |
- \item{cdfName}{Character string. Annotation package. See |
|
19 |
- crlmm:::validCdfNames() for supported packages. |
|
20 |
- } |
|
21 |
- \item{save.intermediate}{Logical. Whether to save intermediate |
|
22 |
- files. This is used primarily for debugging. |
|
23 |
- } |
|
24 |
- \item{splitByChr}{Logical. Whether to split output files by |
|
25 |
- chromosome. This is recommended for datasets with 50 or more samples. |
|
26 |
- } |
|
27 |
- \item{intensityFile}{Character string. Name of intermediate file for storing |
|
28 |
- quantile normalized intensities. This is always saved regardless of |
|
29 |
- the value of save.intermediate. |
|
30 |
- } |
|
31 |
- \item{\dots}{Additional arguments to readIdatFiles. |
|
32 |
- } |
|
33 |
-} |
|
34 |
-\details{ |
|
35 |
-} |
|
36 |
-\value{ |
|
37 |
- An object of class \code{CrlmmSetList}. This object will have the |
|
38 |
- following two elements: |
|
39 |
- |
|
40 |
- - an object of class \code{ABset} |
|
41 |
- - an object of class \code{SnpSet} |
|
42 |
- |
|
43 |
-} |
|
44 |
-\author{ |
|
45 |
- Rob Scharpf |
|
46 |
-} |
|
47 |
-\note{ |
|
48 |
-} |
|
49 |
-\seealso{ |
|
50 |
- \code{\linkS4class{CrlmmSetList}} |
|
51 |
- \code{\linkS4class{ABset}} |
|
52 |
- \code{\link[Biobase]{SnpSet}} |
|
53 |
-} |
|
54 |
-\examples{ |
|
55 |
-} |
|
56 |
-\keyword{manip} |
|
57 |
- |
... | ... |
@@ -10,7 +10,8 @@ |
10 | 10 |
} |
11 | 11 |
\usage{ |
12 | 12 |
crlmmWrapper(filenames, cdfName = "genomewidesnp6", load.it=FALSE, |
13 |
-save.it=FALSE, splitByChr=TRUE, crlmmFile, intensityFile, ...) |
|
13 |
+save.it=FALSE, splitByChr=TRUE, crlmmFile, intensityFile, rgFile, |
|
14 |
+platform=c("affymetrix", "illumina")[1], ...) |
|
14 | 15 |
} |
15 | 16 |
\arguments{ |
16 | 17 |
\item{filenames}{ |
... | ... |
@@ -34,9 +35,17 @@ save.it=FALSE, splitByChr=TRUE, crlmmFile, intensityFile, ...) |
34 | 35 |
\code{paste(dirname(crlmmFile), "crlmmSetList_", CHR, ".rda", sep="")}. |
35 | 36 |
} |
36 | 37 |
\item{crlmmFile}{Character string. Name of file (including the |
37 |
- complete path) containing the genotype calls. |
|
38 |
+ complete path) containing the genotype calls. } |
|
39 |
+ \item{intensityFile}{Character string. Name of file (with |
|
40 |
+ complete path) containing the quantile-normalized intensities. } |
|
41 |
+ \item{rgFile}{Character string. Name of file (including the |
|
42 |
+ complete path) containing the RG intensities (only applicable for |
|
43 |
+ illumina platform). } |
|
44 |
+ \item{platform}{Character string. Currently only \code{affymetrix} |
|
45 |
+ and \code{illumina} are supported.} |
|
38 | 46 |
\item{\dots}{ |
39 |
- additional arguments to function \code{crlmm} |
|
47 |
+ additional arguments to function \code{readIdatFiles} (illumina |
|
48 |
+ platform only) |
|
40 | 49 |
} |
41 | 50 |
} |
42 | 51 |
\value{ |
... | ... |
@@ -17,9 +17,9 @@ |
17 | 17 |
|
18 | 18 |
\usage{ |
19 | 19 |
|
20 |
- cnIndex(object, cdfName) |
|
20 |
+ cnIndex(object, ...) |
|
21 | 21 |
|
22 |
- snpIndex(object, cdfName) |
|
22 |
+ snpIndex(object, ...) |
|
23 | 23 |
|
24 | 24 |
} |
25 | 25 |
|
... | ... |
@@ -28,7 +28,7 @@ |
28 | 28 |
\item{object}{Any object extending eSet (ABset, CopyNumberSet, |
29 | 29 |
CrlmmSetList, SnpSet} |
30 | 30 |
|
31 |
- \item{cdfName}{Character string indicating annotation package.} |
|
31 |
+ \item{\dots}{Usually the character string indicating annotation package.} |
|
32 | 32 |
|
33 | 33 |
} |
34 | 34 |
|