Browse code

Remove plot-methods. Shorten example for xyplot.

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/crlmm@58910 bc3139a8-67e5-0310-9ffc-ced21a209358

Rob Scharp authored on 08/10/2011 14:07:58
Showing4 changed files

... ...
@@ -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.11.52
4
+Version: 1.11.53
5 5
 Date: 2010-12-10
6 6
 Author: Benilton S Carvalho <Benilton.Carvalho@cancer.org.uk>, Robert Scharpf <rscharpf@jhsph.edu>, Matt Ritchie <mritchie@wehi.edu.au>, Ingo Ruczinski <iruczins@jhsph.edu>, Rafael A Irizarry
7 7
 Maintainer: Benilton S Carvalho <Benilton.Carvalho@cancer.org.uk>, Robert Scharpf <rscharpf@jhsph.edu>, Matt Ritchie <mritchie@wehi.EDU.AU>
... ...
@@ -42,7 +42,6 @@ Collate: AllGenerics.R
42 42
 	 crlmmGT2.R
43 43
          crlmm-illumina.R
44 44
 	 snprma-functions.R
45
-	 plot-methods.R
46 45
          utils.R
47 46
          zzz.R
48 47
 	 test_crlmm_package.R
... ...
@@ -52,7 +52,7 @@ importFrom(ellipse, ellipse)
52 52
 importFrom(ff, ffdf, physical.ff, physical.ffdf, ffrowapply)
53 53
 
54 54
 importClassesFrom(oligoClasses, ff_matrix, ffdf)
55
-exportMethods(lines)
55
+##exportMethods(lines)
56 56
 exportMethods(CA, CB)
57 57
 export(crlmm,
58 58
        crlmmIllumina,
59 59
deleted file mode 100644
... ...
@@ -1,98 +0,0 @@
1
-setMethod("lines", signature=signature(x="CNSet"),
2
-	  function(x, y, batch, copynumber, grid=FALSE, ...){
3
-		  linesCNSet(x, y, batch, copynumber, grid=grid, ...)
4
-	  })
5
-
6
-linesCNSet <- function(x, y, batch, copynumber, x.axis="A", grid=FALSE, ...){
7
-	require(ellipse)
8
-	object <- x
9
-	marker.index <- y
10
-	stopifnot(length(marker.index) == 1)
11
-	batch.index <- match(batch, batchNames(object))
12
-	stopifnot(length(batch.index) == 1)
13
-	nuA <- nu(object, "A")[marker.index, batch.index]
14
-	nuB <- nu(object, "B")[marker.index, batch.index]
15
-	phiA <- phi(object, "A")[marker.index, batch.index]
16
-	phiB <- phi(object, "B")[marker.index, batch.index]
17
-
18
-	taus <- tau2(object, i=marker.index, j=batch.index)
19
-	tau2A <- taus[, "A", "BB", ]
20
-	tau2B <- taus[, "B", "AA", ]
21
-	sigma2A <- taus[, "A", "AA", ]
22
-	sigma2B <- taus[, "B", "BB", ]
23
-	cors <- corr(object, i=marker.index, j=batch.index)[, , ]
24
-	corrAB <- cors[["AB"]]
25
-	corrAA <- cors[["AA"]]
26
-	corrBB <- cors[["BB"]]
27
-	for(CN in copynumber){
28
-		for(CA in 0:CN){
29
-			CB <- CN-CA
30
-			A.scale <- sqrt(tau2A*(CA==0) + sigma2A*(CA > 0))
31
-			B.scale <- sqrt(tau2B*(CB==0) + sigma2B*(CB > 0))
32
-			scale <- c(A.scale, B.scale)
33
-			if(CA == 0 & CB > 0) rho <- corrBB
34
-			if(CA > 0 & CB == 0) rho <- corrAA
35
-			if(CA > 0 & CB > 0) rho <- corrAB
36
-			if(CA == 0 & CB == 0) rho <- 0
37
-			if(x.axis=="A"){
38
-				dat.ellipse <- ellipse(x=rho, centre=c(log2(nuA+CA*phiA),
39
-							      log2(nuB+CB*phiB)),
40
-						       scale=scale)
41
-				if(!grid){
42
-					lines(dat.ellipse, ...)
43
-				} else {
44
-					llines(dat.ellipse[, 1], dat.ellipse[, 2], ...)
45
-				}
46
-			} else {
47
-				dat.ellipse <- ellipse(x=rho, centre=c(log2(nuB+CB*phiB),
48
-							      log2(nuA+CA*phiA)), scale=rev(scale))
49
-				if(!grid){
50
-					lines(dat.ellipse, ...)
51
-				} else {
52
-					llines(dat.ellipse[, 1], dat.ellipse[, 2], ...)
53
-				}
54
-			}
55
-		}
56
-	}
57
-}
58
-
59
-
60
-##cnPanel <- function(x, y, ..., pch.cols, gt, cbs.segs, hmm.segs=NULL, shades, subscripts, add.ideogram=TRUE){
61
-##	##if(panel.number() == 2) browser()
62
-##	add.ideogram <- add.ideogram[[panel.number()]]
63
-##	##cbs.segs <- cbs.segs[[panel.number()]]
64
-##	draw.hmm.states <- ifelse(panel.number() <= length(hmm.segs), TRUE, FALSE)
65
-##	panel.grid(h=6, v=10)
66
-##	which.hom <- which(gt[subscripts] == 1 | gt[subscripts]==3)
67
-##	which.het <- which(gt[subscripts] == 2)
68
-##	panel.xyplot(x, y, col="grey60", ...)
69
-##	lpoints(x[which.hom], y[which.hom], col=pch.cols[1], ...)
70
-##	lpoints(x[which.het], y[which.het], col=pch.cols[2], ...)
71
-##	lsegments(x0=start(cbs.segs)/1e6, x1=end(cbs.segs)/1e6,
72
-##		  y0=cbs.segs$seg.mean,
73
-##		  y1=cbs.segs$seg.mean, ...)
74
-##	if(draw.hmm.states){
75
-##		hmm.segs <- hmm.segs[order(width(hmm.segs), decreasing=TRUE), ]
76
-##		lrect(xleft=start(hmm.segs)/1e6,
77
-##		      xright=end(hmm.segs)/1e6,
78
-##		      ybottom=-0.4,
79
-##		      ytop=0,
80
-##		      border=shades[hmm.segs$state],
81
-##		      col=shades[hmm.segs$state])
82
-##	}
83
-##	ltext(130, 5, paste("MAD:", round(mad(y, na.rm=TRUE), 2)))
84
-##	if(add.ideogram){
85
-##		pathto <- system.file("hg18", package="SNPchip")
86
-##		cytoband <- read.table(file.path(pathto, "cytoBand.txt"), as.is=TRUE)
87
-##		cytoband$V2 <- cytoband$V2/1e6
88
-##		cytoband$V3 <- cytoband$V3/1e6
89
-##		colnames(cytoband) <- c("chrom", "start", "end", "name", "gieStain")
90
-##		plotCytoband(unique(hmm.segs$chrom),
91
-##			     cytoband=cytoband,
92
-##			     cytoband.ycoords=c(5.6, 5.9),
93
-##			     new=FALSE,
94
-##			     label.cytoband=FALSE,
95
-##			     build="hg18",
96
-##			     use.lattice=TRUE)
97
-##	}
98
-##}
... ...
@@ -38,32 +38,15 @@ data(sample.CNSet2)
38 38
 table(batch(sample.CNSet2))
39 39
 sample.index <- which(batch(sample.CNSet2) == "CUPID")
40 40
 ## A single SNP
41
-pr <- predictionRegion(sample.CNSet2[1:50, sample.index], copyNumber=0:4)
42
-gt <- calls(sample.CNSet2[1:50, sample.index])
41
+pr <- predictionRegion(sample.CNSet2[1:4, sample.index], copyNumber=0:4)
42
+gt <- calls(sample.CNSet2[1:4, sample.index])
43 43
 lim <- c(6,13)
44
-for(i in 1:50){
45
-res <- xyplot(B~A, data=sample.CNSet2[i, sample.index],
46
-       predictRegion=pr[i,],
47
-       panel=ABpanel,
48
-       pch=21,
49
-       fill=c("red", "blue", "green3")[gt[i, ]],
50
-       xlim=lim, ylim=lim)
51
-print(res)
52
-}
53
-
54
-## The posterior mean for the above markers
55
-pp <- posteriorProbability(sample.CNSet2[1, sample.index], predictRegion=pr, copyNumber=0:4)
56
-pm <- calculatePosteriorMean(sample.CNSet2[1, sample.index], posteriorProb=pp)
57
-
58
-## Muliple SNPs
59
-pr <- predictionRegion(sample.CNSet2[1:10, sample.index], copyNumber=0:4)
60
-gt <- as.integer(calls(sample.CNSet2[1:10, sample.index]))
61
-xyplot(B~A|snpid, data=sample.CNSet2[1:10, sample.index],
44
+xyplot(B~A|snpid, data=sample.CNSet2[1:4, sample.index],
62 45
        predictRegion=pr,
63 46
        panel=ABpanel,
64 47
        pch=21,
65 48
        fill=c("red", "blue", "green3")[gt],
66
-       xlim=c(6,12), ylim=c(6,12))
49
+       xlim=lim, ylim=lim)
67 50
 
68 51
 ## multiple SNPs, prediction regions for 3 batches
69 52
 \dontrun{