Browse code

update sample.CNSet

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

Rob Scharp authored on 10/03/2011 19:31:11
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,136 +0,0 @@
1
-\name{sample.CNSetLM}
2
-\alias{sample.CNSetLM}
3
-\docType{data}
4
-\title{
5
-	Dataset of class 'CNSetLM'
6
-}
7
-\description{
8
-
9
-	The data for 2119 polymorphic and nonpolymorphic markers on
10
-	chromosome 1 for the CEPH and Yoruban HapMap samples.
11
-
12
-}
13
-\usage{data(sample.CNSetLM)}
14
-\format{
15
-
16
-	This class has been deprecated.  See example below for how to
17
-	update an existing 'CNSetLM' object to class 'CNSet'.
18
-
19
-	The data illustrates the \code{CNSetLM-class}, with
20
-	\code{assayData} containing the quantile-normalized
21
-	intensities for the A and B alleles, genotype calls and
22
-	confidence scores (call and callProbability), and
23
-	allele-specific copy number (CA and CB). The parameters from
24
-	the linear model are stored in the lM slot.
25
-
26
-}
27
-\examples{
28
-## class CNSetLM has been deprecated
29
-data(sample.CNSetLM)
30
-## update to class CNSet
31
-cnSet <- as(sample.CNSetLM, "CNSet")
32
-all(isCurrent(cnSet)) ## is the cnSet object current?
33
-##subsetting
34
-cnSet2 <- cnSet[, 1:5]
35
-stopifnot(batchNames(cnSet2) == "C")
36
-\dontrun{
37
-	## updating class CNSetLM using ff objects
38
-	## a bigger object with multiple batches
39
-	if(require(ff)){
40
-		outdir <- "/amber1/scratch/rscharpf/jss/hapmap2"
41
-		load(file.path(outdir, "container.rda"))
42
-		container <- object; rm(object); gc()
43
-		container2 <- as(container, "CNSet")
44
-		all(isCurrent(container2))
45
-		## test replacement methods, subset methods
46
-		table(batch(container2))
47
-		##generates warning ... would need open, close in the '[' method
48
-		invisible(open(nuA(container2)))
49
-		xx <- nu(container2, "A")[1:5, ]
50
-		nuA(container2)[1:5, ] <- xx
51
-		invisible(close(nuA(container2)))
52
-	}
53
-}
54
-## --------------------------------------------------
55
-## accessors for the feature-level info
56
-## --------------------------------------------------
57
-chromosome(cnSet)[1:5]
58
-position(cnSet)[1:5]
59
-isSnp(cnSet)[1:5]
60
-## 980 nonpolymorphic markers and 1139 polymoprhic markers
61
-table(isSnp(cnSet))
62
-## --------------------------------------------------
63
-## sample-level statistics computed by crlmm
64
-## --------------------------------------------------
65
-varLabels(cnSet)
66
-## accessors for sample-level statistics
67
-## The signal to noise ratio (SNR)
68
-cnSet$SNR[1:5]
69
-## the skew
70
-cnSet$SKW[1:5]
71
-## the gender (gender is imputed unless specified in the call to crlmm)
72
-table(cnSet$gender)  ## 1=male, 2=female
73
-## --------------------------------------------------
74
-## --------------------------------------------------
75
-##
76
-## accessors for parameters estimated from the linear model for copy
77
-## number (note that the parameters have dimension R x C, where R
78
-## corresponds to the number of features and C corresponds to the
79
-## number of batches)
80
-## -------------------------------------------------- estimate of
81
-## background
82
-dim(nu(cnSet, "A"))
83
-## background for the A allele in the 2 batches for the
84
-## first 5 markers
85
-nu(cnSet, "A")[1:5, ]
86
-## background for the B allele in the 2 batches for the
87
-## first 5 markers
88
-nu(cnSet, "B")[1:5, ]
89
-## the slope
90
-phi(cnSet, "A")[1:5, ]
91
-## correlation within genotype cluster AA
92
-##corr(cnSet, "AA")[1:5, ]
93
-#### correlation within genotype cluster AB
94
-##corr(cnSet, "AB")[1:5, ]
95
-#### correlation within genotype cluster BB
96
-##corr(cnSet, "BB")[1:5, ]
97
-## --------------------------------------------------
98
-
99
-## --------------------------------------------------
100
-## calculating allele-specific copy number
101
-## --------------------------------------------------
102
-## copy number for allele A, first 5 markers, first 2 samples
103
-(ca <- CA(cnSet, i=1:5, j=1:2))
104
-## copy number for allele B, first 5 markers, first 2 samples
105
-(cb <- CB(cnSet, i=1:5, j=1:2))
106
-## total copy number for first 5 markers, first 2 samples
107
-(cn1 <- ca+cb)
108
-
109
-## total copy number at first 5 nonpolymorphic loci
110
-index <- which(!isSnp(cnSet))[1:5]
111
-cn2 <- CA(cnSet, i=index, j=1:2)
112
-## note, cb is NA at nonpolymorphic loci
113
-(cb <- CB(cnSet, i=index, j=1:2))
114
-## note, ca+cb will give NAs at nonpolymorphic loci
115
-CA(cnSet, i=index, j=1:2) + cb
116
-## A shortcut for total copy number
117
-cn3 <- totalCopynumber(cnSet, i=1:5, j=1:2)
118
-all.equal(cn3, cn1)
119
-cn4 <- totalCopynumber(cnSet, i=index, j=1:2)
120
-all.equal(cn4, cn2)
121
-
122
-## markers 1-5, all samples
123
-cn5 <- totalCopynumber(cnSet, i=1:5)
124
-## all markers, samples 1-5
125
-cn6 <- totalCopynumber(cnSet, j=1:5)
126
-
127
-## NOTE: subsetting the object before extracting copy number
128
-##       can be very inefficient when the data set is very large,
129
-##       particularly if using ff objects.  IN particular, subsetting
130
-##       the CNSet object will subset all of the assay data elements
131
-##       and all of the elements in the LinearModelParameter slot
132
-\dontrun{
133
-	cnsubset <- cnSet[1:5, ]
134
-}
135
-}
136
-\keyword{datasets}
Browse code

CB estimates were NA for SNP indices were mixed with NP indices. Bug was fixed in the ACN function

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

Rob Scharp authored on 30/08/2010 19:40:54
Showing 1 changed files
... ...
@@ -30,7 +30,9 @@ data(sample.CNSetLM)
30 30
 ## update to class CNSet
31 31
 cnSet <- as(sample.CNSetLM, "CNSet")
32 32
 all(isCurrent(cnSet)) ## is the cnSet object current?
33
-
33
+##subsetting
34
+cnSet2 <- cnSet[, 1:5]
35
+stopifnot(batchNames(cnSet2) == "C")
34 36
 \dontrun{
35 37
 	## updating class CNSetLM using ff objects
36 38
 	## a bigger object with multiple batches
Browse code

A few edits to copynumber vignette and sample.CNSetLM Rd file

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

Rob Scharp authored on 21/08/2010 02:50:25
Showing 1 changed files
... ...
@@ -31,28 +31,23 @@ data(sample.CNSetLM)
31 31
 cnSet <- as(sample.CNSetLM, "CNSet")
32 32
 all(isCurrent(cnSet)) ## is the cnSet object current?
33 33
 
34
-## updating class CNSetLM using ff objects
35
-library(ff)
36
-path <- system.file("extdata", package="crlmm")
37
-ldPath(path)
38
-data(sample.CNSetLMff)
39
-cnSetff <- as(sample.CNSetLMff, "CNSet")
40
-all(isCurrent(cnSet))
41
-
42
-## a bigger object with multiple batches
43 34
 \dontrun{
44
-	outdir <- "/amber1/scratch/rscharpf/jss/hapmap2"
45
-	load(file.path(outdir, "container.rda"))
46
-	container <- object; rm(object); gc()
47
-	container2 <- as(container, "CNSet")
48
-	all(isCurrent(container2))
49
-	## test replacement methods, subset methods
50
-	table(batch(container2))
51
-	##generates warning ... would need open, close in the '[' method
52
-	invisible(open(nuA(container2)))
53
-	xx <- nu(container2, "A")[1:5, ]
54
-	nuA(container2)[1:5, ] <- xx
55
-	invisible(close(nuA(container2)))
35
+	## updating class CNSetLM using ff objects
36
+	## a bigger object with multiple batches
37
+	if(require(ff)){
38
+		outdir <- "/amber1/scratch/rscharpf/jss/hapmap2"
39
+		load(file.path(outdir, "container.rda"))
40
+		container <- object; rm(object); gc()
41
+		container2 <- as(container, "CNSet")
42
+		all(isCurrent(container2))
43
+		## test replacement methods, subset methods
44
+		table(batch(container2))
45
+		##generates warning ... would need open, close in the '[' method
46
+		invisible(open(nuA(container2)))
47
+		xx <- nu(container2, "A")[1:5, ]
48
+		nuA(container2)[1:5, ] <- xx
49
+		invisible(close(nuA(container2)))
50
+	}
56 51
 }
57 52
 ## --------------------------------------------------
58 53
 ## accessors for the feature-level info
Browse code

methods Ns, medians, corr, and mads return arrays.

Ns and corr return an array with dimension: features x genotype x batch

medians and mads return an array with dimension: features x allele x genotype x batch

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

Rob Scharp authored on 21/08/2010 02:50:19
Showing 1 changed files
... ...
@@ -36,7 +36,7 @@ library(ff)
36 36
 path <- system.file("extdata", package="crlmm")
37 37
 ldPath(path)
38 38
 data(sample.CNSetLMff)
39
-cnSet <- as(sample.CNSetLMff, "CNSet")
39
+cnSetff <- as(sample.CNSetLMff, "CNSet")
40 40
 all(isCurrent(cnSet))
41 41
 
42 42
 ## a bigger object with multiple batches
... ...
@@ -91,18 +91,12 @@ nu(cnSet, "A")[1:5, ]
91 91
 nu(cnSet, "B")[1:5, ]
92 92
 ## the slope
93 93
 phi(cnSet, "A")[1:5, ]
94
-## the variance for CN > 0 (log2-scale)
95
-sigma2(cnSet, "A")[1:5, ]
96
-sigma2(cnSet, "B")[1:5, ]
97
-## background variance (log2-scale)
98
-tau2(cnSet, "A")[1:5, ]
99
-tau2(cnSet, "B")[1:5, ]
100 94
 ## correlation within genotype cluster AA
101
-corr(cnSet, "AA")[1:5, ]
102
-## correlation within genotype cluster AB
103
-corr(cnSet, "AB")[1:5, ]
104
-## correlation within genotype cluster BB
105
-corr(cnSet, "BB")[1:5, ]
95
+##corr(cnSet, "AA")[1:5, ]
96
+#### correlation within genotype cluster AB
97
+##corr(cnSet, "AB")[1:5, ]
98
+#### correlation within genotype cluster BB
99
+##corr(cnSet, "BB")[1:5, ]
106 100
 ## --------------------------------------------------
107 101
 
108 102
 ## --------------------------------------------------
Browse code

Added citation to crlmmCopynumber. Deleted many of the commented functions in cnrma-functions.R

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

Rob Scharp authored on 21/08/2010 02:50:15
Showing 1 changed files
... ...
@@ -54,25 +54,6 @@ all(isCurrent(cnSet))
54 54
 	nuA(container2)[1:5, ] <- xx
55 55
 	invisible(close(nuA(container2)))
56 56
 }
57
-
58
-
59
-
60
-
61
-nms <- names(lM(sample.CNSetLMff))
62
-##names must be tau2A, tau2B, ...
63
-nms2 <- sapply(nms, function(x) strsplit(x, "\\.1")[[1]][[1]], USE.NAMES=FALSE)
64
-names(sample.CNSetLMff@lM) <- nms2
65
-cnSetff <- as(sample.CNSetLMff, "CNSet")
66
-## try replacement method without warning
67
-nuA(cnSetff)[1:10, ] <- matrix(1:10, 10, 1)
68
-
69
-## try subset method without warning
70
-
71
-
72
-
73
-## information on the features
74
-fvarLabels(cnSet)
75
-##
76 57
 ## --------------------------------------------------
77 58
 ## accessors for the feature-level info
78 59
 ## --------------------------------------------------
... ...
@@ -81,8 +62,6 @@ position(cnSet)[1:5]
81 62
 isSnp(cnSet)[1:5]
82 63
 ## 980 nonpolymorphic markers and 1139 polymoprhic markers
83 64
 table(isSnp(cnSet))
84
-## --------------------------------------------------
85
-
86 65
 ## --------------------------------------------------
87 66
 ## sample-level statistics computed by crlmm
88 67
 ## --------------------------------------------------
... ...
@@ -95,16 +74,14 @@ cnSet$SKW[1:5]
95 74
 ## the gender (gender is imputed unless specified in the call to crlmm)
96 75
 table(cnSet$gender)  ## 1=male, 2=female
97 76
 ## --------------------------------------------------
98
-
99
-
100
-## --------------------------------------------------
101
-## accessors for linear model parameters estimated from
102
-## the linear model for copy number
103
-## (note that the parameters have dimension R x C, where
104
-##  R corresponds to the number of features and C corresponds
105
-##  to the number of batches)
106 77
 ## --------------------------------------------------
107
-## estimate of background
78
+##
79
+## accessors for parameters estimated from the linear model for copy
80
+## number (note that the parameters have dimension R x C, where R
81
+## corresponds to the number of features and C corresponds to the
82
+## number of batches)
83
+## -------------------------------------------------- estimate of
84
+## background
108 85
 dim(nu(cnSet, "A"))
109 86
 ## background for the A allele in the 2 batches for the
110 87
 ## first 5 markers
... ...
@@ -146,15 +123,15 @@ cn2 <- CA(cnSet, i=index, j=1:2)
146 123
 ## note, ca+cb will give NAs at nonpolymorphic loci
147 124
 CA(cnSet, i=index, j=1:2) + cb
148 125
 ## A shortcut for total copy number
149
-cn3 <- totalCopyNumber(cnSet, i=1:5, j=1:2)
126
+cn3 <- totalCopynumber(cnSet, i=1:5, j=1:2)
150 127
 all.equal(cn3, cn1)
151
-cn4 <- totalCopyNumber(cnSet, i=index, j=1:2)
128
+cn4 <- totalCopynumber(cnSet, i=index, j=1:2)
152 129
 all.equal(cn4, cn2)
153 130
 
154 131
 ## markers 1-5, all samples
155
-cn5 <- totalCopyNumber(cnSet, i=1:5)
132
+cn5 <- totalCopynumber(cnSet, i=1:5)
156 133
 ## all markers, samples 1-5
157
-cn6 <- totalCopyNumber(cnSet, j=1:5)
134
+cn6 <- totalCopynumber(cnSet, j=1:5)
158 135
 
159 136
 ## NOTE: subsetting the object before extracting copy number
160 137
 ##       can be very inefficient when the data set is very large,
Browse code

Changed totalCopyNumber to totalCopynumber to be consistent with caps in crlmmCopynumber. Fixed a few bugs in the .Rd files

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

Rob Scharp authored on 21/08/2010 02:50:10
Showing 1 changed files
... ...
@@ -31,13 +31,13 @@ data(sample.CNSetLM)
31 31
 cnSet <- as(sample.CNSetLM, "CNSet")
32 32
 all(isCurrent(cnSet)) ## is the cnSet object current?
33 33
 
34
-library(crlmm)
34
+## updating class CNSetLM using ff objects
35 35
 library(ff)
36
-outdir <- "~/madman/Rpacks/crlmm/inst/extdata"
37
-ldPath(outdir)
36
+path <- system.file("extdata", package="crlmm")
37
+ldPath(path)
38 38
 data(sample.CNSetLMff)
39
-cnSetff <- as(sample.CNSetLMff, "CNSet")
40
-all(isCurrent(cnSetff))
39
+cnSet <- as(sample.CNSetLMff, "CNSet")
40
+all(isCurrent(cnSet))
41 41
 
42 42
 ## a bigger object with multiple batches
43 43
 \dontrun{
Browse code

Numerous changed to copy number estimation detailed below.

Added the following functions:
o summarizeMaleXGenotypes
- impute genotype 'A' and genotype 'B' location when unobserved
- shrink within genotype variances
o shrinkGenotypeSummaries
- impute unobserved genotype 'AA', 'AB' and 'BB' genotypes
- shrink within genotype variances
o summarizeSnps
- within genotype location and scale. Genotype frequencies
o summarizeNps
- location and scale at nonpolymorphic loci
o genotypeSummary
- wrapper for summarizeSnps and summarizeNps

Extensively edited the following functions:
o fit.lm1 - fit.lm4
(these functions only fit the linear model to the within/genotype location scale)

Requires oligoClasses 1.11.7

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

Rob Scharp authored on 21/08/2010 02:49:54
Showing 1 changed files
... ...
@@ -41,18 +41,18 @@ all(isCurrent(cnSetff))
41 41
 
42 42
 ## a bigger object with multiple batches
43 43
 \dontrun{
44
-outdir <- "/amber1/scratch/rscharpf/jss/hapmap2"
45
-load(file.path(outdir, "container.rda"))
46
-container <- object; rm(object)
47
-container2 <- as(container, "CNSet")
48
-all(isCurrent(container2))
49
-## test replacement methods, subset methods
50
-table(batch(container2))
51
-##generates warning ... would need open, close in the '[' method
52
-invisible(open(nuA(container2)))
53
-xx <- nu(container2, "A")[1:5, ]
54
-nuA(container2)[1:5, ] <- xx
55
-invisible(close(nuA(container2)))
44
+	outdir <- "/amber1/scratch/rscharpf/jss/hapmap2"
45
+	load(file.path(outdir, "container.rda"))
46
+	container <- object; rm(object); gc()
47
+	container2 <- as(container, "CNSet")
48
+	all(isCurrent(container2))
49
+	## test replacement methods, subset methods
50
+	table(batch(container2))
51
+	##generates warning ... would need open, close in the '[' method
52
+	invisible(open(nuA(container2)))
53
+	xx <- nu(container2, "A")[1:5, ]
54
+	nuA(container2)[1:5, ] <- xx
55
+	invisible(close(nuA(container2)))
56 56
 }
57 57
 
58 58
 
Browse code

A number of changes to fit.lm1 and crlmmCopynumber. The number of genotypes is now stored as part of the CNSet class object.

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

Rob Scharp authored on 21/08/2010 02:49:47
Showing 1 changed files
... ...
@@ -31,6 +31,45 @@ data(sample.CNSetLM)
31 31
 cnSet <- as(sample.CNSetLM, "CNSet")
32 32
 all(isCurrent(cnSet)) ## is the cnSet object current?
33 33
 
34
+library(crlmm)
35
+library(ff)
36
+outdir <- "~/madman/Rpacks/crlmm/inst/extdata"
37
+ldPath(outdir)
38
+data(sample.CNSetLMff)
39
+cnSetff <- as(sample.CNSetLMff, "CNSet")
40
+all(isCurrent(cnSetff))
41
+
42
+## a bigger object with multiple batches
43
+\dontrun{
44
+outdir <- "/amber1/scratch/rscharpf/jss/hapmap2"
45
+load(file.path(outdir, "container.rda"))
46
+container <- object; rm(object)
47
+container2 <- as(container, "CNSet")
48
+all(isCurrent(container2))
49
+## test replacement methods, subset methods
50
+table(batch(container2))
51
+##generates warning ... would need open, close in the '[' method
52
+invisible(open(nuA(container2)))
53
+xx <- nu(container2, "A")[1:5, ]
54
+nuA(container2)[1:5, ] <- xx
55
+invisible(close(nuA(container2)))
56
+}
57
+
58
+
59
+
60
+
61
+nms <- names(lM(sample.CNSetLMff))
62
+##names must be tau2A, tau2B, ...
63
+nms2 <- sapply(nms, function(x) strsplit(x, "\\.1")[[1]][[1]], USE.NAMES=FALSE)
64
+names(sample.CNSetLMff@lM) <- nms2
65
+cnSetff <- as(sample.CNSetLMff, "CNSet")
66
+## try replacement method without warning
67
+nuA(cnSetff)[1:10, ] <- matrix(1:10, 10, 1)
68
+
69
+## try subset method without warning
70
+
71
+
72
+
34 73
 ## information on the features
35 74
 fvarLabels(cnSet)
36 75
 ##
Browse code

Added help files for copy number accessors. Fixed bugs in CA, CB, and total copy number methods.

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

Rob Scharp authored on 21/08/2010 02:49:14
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 \alias{sample.CNSetLM}
3 3
 \docType{data}
4 4
 \title{
5
-	Dataset of class 'CNSetLM'	
5
+	Dataset of class 'CNSetLM'
6 6
 }
7 7
 \description{
8 8
 
... ...
@@ -15,20 +15,115 @@
15 15
 
16 16
 	This class has been deprecated.  See example below for how to
17 17
 	update an existing 'CNSetLM' object to class 'CNSet'.
18
- 
18
+
19 19
 	The data illustrates the \code{CNSetLM-class}, with
20 20
 	\code{assayData} containing the quantile-normalized
21 21
 	intensities for the A and B alleles, genotype calls and
22 22
 	confidence scores (call and callProbability), and
23 23
 	allele-specific copy number (CA and CB). The parameters from
24 24
 	the linear model are stored in the lM slot.
25
-	
25
+
26 26
 }
27 27
 \examples{
28 28
 ## class CNSetLM has been deprecated
29 29
 data(sample.CNSetLM)
30 30
 ## update to class CNSet
31 31
 cnSet <- as(sample.CNSetLM, "CNSet")
32
-all(isCurrent(cnSet))
32
+all(isCurrent(cnSet)) ## is the cnSet object current?
33
+
34
+## information on the features
35
+fvarLabels(cnSet)
36
+##
37
+## --------------------------------------------------
38
+## accessors for the feature-level info
39
+## --------------------------------------------------
40
+chromosome(cnSet)[1:5]
41
+position(cnSet)[1:5]
42
+isSnp(cnSet)[1:5]
43
+## 980 nonpolymorphic markers and 1139 polymoprhic markers
44
+table(isSnp(cnSet))
45
+## --------------------------------------------------
46
+
47
+## --------------------------------------------------
48
+## sample-level statistics computed by crlmm
49
+## --------------------------------------------------
50
+varLabels(cnSet)
51
+## accessors for sample-level statistics
52
+## The signal to noise ratio (SNR)
53
+cnSet$SNR[1:5]
54
+## the skew
55
+cnSet$SKW[1:5]
56
+## the gender (gender is imputed unless specified in the call to crlmm)
57
+table(cnSet$gender)  ## 1=male, 2=female
58
+## --------------------------------------------------
59
+
60
+
61
+## --------------------------------------------------
62
+## accessors for linear model parameters estimated from
63
+## the linear model for copy number
64
+## (note that the parameters have dimension R x C, where
65
+##  R corresponds to the number of features and C corresponds
66
+##  to the number of batches)
67
+## --------------------------------------------------
68
+## estimate of background
69
+dim(nu(cnSet, "A"))
70
+## background for the A allele in the 2 batches for the
71
+## first 5 markers
72
+nu(cnSet, "A")[1:5, ]
73
+## background for the B allele in the 2 batches for the
74
+## first 5 markers
75
+nu(cnSet, "B")[1:5, ]
76
+## the slope
77
+phi(cnSet, "A")[1:5, ]
78
+## the variance for CN > 0 (log2-scale)
79
+sigma2(cnSet, "A")[1:5, ]
80
+sigma2(cnSet, "B")[1:5, ]
81
+## background variance (log2-scale)
82
+tau2(cnSet, "A")[1:5, ]
83
+tau2(cnSet, "B")[1:5, ]
84
+## correlation within genotype cluster AA
85
+corr(cnSet, "AA")[1:5, ]
86
+## correlation within genotype cluster AB
87
+corr(cnSet, "AB")[1:5, ]
88
+## correlation within genotype cluster BB
89
+corr(cnSet, "BB")[1:5, ]
90
+## --------------------------------------------------
91
+
92
+## --------------------------------------------------
93
+## calculating allele-specific copy number
94
+## --------------------------------------------------
95
+## copy number for allele A, first 5 markers, first 2 samples
96
+(ca <- CA(cnSet, i=1:5, j=1:2))
97
+## copy number for allele B, first 5 markers, first 2 samples
98
+(cb <- CB(cnSet, i=1:5, j=1:2))
99
+## total copy number for first 5 markers, first 2 samples
100
+(cn1 <- ca+cb)
101
+
102
+## total copy number at first 5 nonpolymorphic loci
103
+index <- which(!isSnp(cnSet))[1:5]
104
+cn2 <- CA(cnSet, i=index, j=1:2)
105
+## note, cb is NA at nonpolymorphic loci
106
+(cb <- CB(cnSet, i=index, j=1:2))
107
+## note, ca+cb will give NAs at nonpolymorphic loci
108
+CA(cnSet, i=index, j=1:2) + cb
109
+## A shortcut for total copy number
110
+cn3 <- totalCopyNumber(cnSet, i=1:5, j=1:2)
111
+all.equal(cn3, cn1)
112
+cn4 <- totalCopyNumber(cnSet, i=index, j=1:2)
113
+all.equal(cn4, cn2)
114
+
115
+## markers 1-5, all samples
116
+cn5 <- totalCopyNumber(cnSet, i=1:5)
117
+## all markers, samples 1-5
118
+cn6 <- totalCopyNumber(cnSet, j=1:5)
119
+
120
+## NOTE: subsetting the object before extracting copy number
121
+##       can be very inefficient when the data set is very large,
122
+##       particularly if using ff objects.  IN particular, subsetting
123
+##       the CNSet object will subset all of the assay data elements
124
+##       and all of the elements in the LinearModelParameter slot
125
+\dontrun{
126
+	cnsubset <- cnSet[1:5, ]
127
+}
33 128
 }
34 129
 \keyword{datasets}
Browse code

Updated sample.CNSetLM helpfile with coercion to v1.0.1 of the CNSet class definition

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

Rob Scharp authored on 21/08/2010 02:49:06
Showing 1 changed files
... ...
@@ -13,6 +13,9 @@
13 13
 \usage{data(sample.CNSetLM)}
14 14
 \format{
15 15
 
16
+	This class has been deprecated.  See example below for how to
17
+	update an existing 'CNSetLM' object to class 'CNSet'.
18
+ 
16 19
 	The data illustrates the \code{CNSetLM-class}, with
17 20
 	\code{assayData} containing the quantile-normalized
18 21
 	intensities for the A and B alleles, genotype calls and
... ...
@@ -22,6 +25,10 @@
22 25
 	
23 26
 }
24 27
 \examples{
28
+## class CNSetLM has been deprecated
25 29
 data(sample.CNSetLM)
30
+## update to class CNSet
31
+cnSet <- as(sample.CNSetLM, "CNSet")
32
+all(isCurrent(cnSet))
26 33
 }
27 34
 \keyword{datasets}
Browse code

Added methods for LinearModelParameter class. removed methods for SnpSuperSet class.

Added a lot of generics for accessing and updating elements in the
LinearModelParameter class.

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

Rob Scharp authored on 21/08/2010 02:48:57
Showing 1 changed files
... ...
@@ -13,7 +13,7 @@
13 13
 \usage{data(sample.CNSetLM)}
14 14
 \format{
15 15
 
16
-	The data illustrates the \code{\link{CNSetLM-class}}, with
16
+	The data illustrates the \code{CNSetLM-class}, with
17 17
 	\code{assayData} containing the quantile-normalized
18 18
 	intensities for the A and B alleles, genotype calls and
19 19
 	confidence scores (call and callProbability), and
Browse code

updated copynumber vignette in inst/scripts. Added example datasets

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

Rob Scharp authored on 25/05/2010 13:07:43
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,27 @@
1
+\name{sample.CNSetLM}
2
+\alias{sample.CNSetLM}
3
+\docType{data}
4
+\title{
5
+	Dataset of class 'CNSetLM'	
6
+}
7
+\description{
8
+
9
+	The data for 2119 polymorphic and nonpolymorphic markers on
10
+	chromosome 1 for the CEPH and Yoruban HapMap samples.
11
+
12
+}
13
+\usage{data(sample.CNSetLM)}
14
+\format{
15
+
16
+	The data illustrates the \code{\link{CNSetLM-class}}, with
17
+	\code{assayData} containing the quantile-normalized
18
+	intensities for the A and B alleles, genotype calls and
19
+	confidence scores (call and callProbability), and
20
+	allele-specific copy number (CA and CB). The parameters from
21
+	the linear model are stored in the lM slot.
22
+	
23
+}
24
+\examples{
25
+data(sample.CNSetLM)
26
+}
27
+\keyword{datasets}