Browse code

Remove snpNames method and generic

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

Rob Scharp authored on 01/10/2011 04:50:30
Showing6 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.40
4
+Version: 1.11.41
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>
... ...
@@ -29,7 +29,7 @@ importMethodsFrom(oligoClasses, allele, calls, "calls<-", confs,
29 29
 		  "A<-", "B<-", open, close, flags,
30 30
 		  openff, closeff,
31 31
 		  batchStatistics, "batchStatistics<-", updateObject,
32
-		  order, checkOrder, snpNames)
32
+		  order, checkOrder)
33 33
 importFrom(oligoClasses, chromosome2integer, celfileDate, list.celfiles,
34 34
            copyNumber, initializeBigMatrix, initializeBigVector, isPackageLoaded)
35 35
 
... ...
@@ -5,7 +5,7 @@ setGeneric("cnNames", function(object) standardGeneric("cnNames"))
5 5
 ##setGeneric("computeCopynumber", function(object, ...) standardGeneric("computeCopynumber"))
6 6
 ##setGeneric("pr", function(object, name, batch, value) standardGeneric("pr"))
7 7
 setGeneric("snpIndex", function(object) standardGeneric("snpIndex"))
8
-setGeneric("snpNames", function(object) standardGeneric("snpNames"))
8
+##setGeneric("snpNames", function(object) standardGeneric("snpNames"))
9 9
 
10 10
 setGeneric("CA", function(object, ...) standardGeneric("CA"))
11 11
 setGeneric("CB", function(object, ...) standardGeneric("CB"))
... ...
@@ -10,16 +10,16 @@ getProtocolData.Affy <- function(filenames){
10 10
 	return(protocoldata)
11 11
 }
12 12
 
13
-setMethod("snpNames", signature(object="character"),
14
-	  function(object){
15
-		  nm <- grep("Crlmm", object)
16
-		  if(length(nm)==0){
17
-			  pkgname <- paste(object, "Crlmm", sep="")
18
-		  } else pkgname <- object
19
-		  loader("preprocStuff.rda", .crlmmPkgEnv, object)
20
-		  gns <- getVarInEnv("gns")
21
-		  return(gns)
22
-	  })
13
+##setMethod("snpNames", signature(object="character"),
14
+##	  function(object){
15
+##		  nm <- grep("Crlmm", object)
16
+##		  if(length(nm)==0){
17
+##			  pkgname <- paste(object, "Crlmm", sep="")
18
+##		  } else pkgname <- object
19
+##		  loader("preprocStuff.rda", .crlmmPkgEnv, object)
20
+##		  gns <- getVarInEnv("gns")
21
+##		  return(gns)
22
+##	  })
23 23
 
24 24
 getFeatureData <- function(cdfName, copynumber=FALSE){
25 25
 	pkgname <- getCrlmmAnnotationName(cdfName)
... ...
@@ -219,10 +219,12 @@ genotype <- function(filenames,
219 219
 		     gender=NULL,
220 220
 		     returnParams=TRUE,
221 221
 		     badSNP=0.7){
222
-	stopifnot(require("ff"))
223 222
 	cnSet <- constructAffy(filenames=filenames,
224 223
 			       cdfName=cdfName,
225 224
 			       batch=batch, verbose=verbose)
225
+	if(!(is(A(cnSet), "ff") || is(A(cnSet), "ffdf"))){
226
+		stop("The ff package is required for this function.")
227
+	}
226 228
 	mixtureParams <- snprmaAffy(cnSet, filenames=filenames,
227 229
 				    mixtureSampleSize=mixtureSampleSize,
228 230
 				    eps=eps,
... ...
@@ -12,20 +12,14 @@ crlmmGT2 <- function(A, B, SNR, mixtureParams, cdfName, row.names=NULL,
12 12
 	## expect objects to be ff
13 13
 	keepIndex <- which( SNR[] > SNRMin)
14 14
 	if(length(keepIndex)==0) stop("No arrays above quality threshold!")
15
+	loader("preprocStuff.rda", .crlmmPkgEnv, pkgname)
16
+	gns <- getVarInEnv("gns", .crlmmPkgEnv)
15 17
 	if(is.null(rownames(A))){
16
-		loader("preprocStuff.rda", .crlmmPkgEnv, pkgname)
17
-		gns <- getVarInEnv("gns", .crlmmPkgEnv)
18 18
 		stopifnot(nrow(A) == length(gns))
19
-		index <- seq(length=nrow(A))
19
+		index <- seq_len(nrow(A))
20
+	} else {
21
+		index <- match(gns, rownames(A))
20 22
 	}
21
-	snp.names <- snpNames(pkgname)
22
-	stopifnot(!is.null(rownames(A)))
23
-	index <- match(snp.names, rownames(A))
24
-##	if(!missing(snp.names)){
25
-##
26
-##		##verify that A has only snps.  otherwise, calling function must pass rownames
27
-##		index <- match(snp.names, rownames(A))
28
-##	}
29 23
 	snpBatches <- splitIndicesByLength(index, ocProbesets())
30 24
 	NR <- length(unlist(snpBatches))
31 25
 	if(verbose) message("Calling ", NR, " SNPs for recalibration... ")
... ...
@@ -15,21 +15,22 @@ setMethod("cnNames", "eSet", function(object) {
15 15
   })
16 16
 
17 17
 
18
-setMethod("snpIndex", "eSet", function(object){
19
-	index <- match(snpNames(object), featureNames(object), nomatch=0)
20
-	index[index != 0]
21
-})
18
+##setMethod("snpIndex", "eSet", function(object){
19
+##	index <- match(snpNames(object), featureNames(object), nomatch=0)
20
+##	index[index != 0]
21
+##})
22
+##
23
+##setMethod("snpNames", "eSet", function(object){
24
+##	path <- system.file("extdata", package=paste(annotation(object), "Crlmm", sep=""))
25
+##	load(file.path(path, "snpProbes.rda"))
26
+##	snpProbes <- get("snpProbes")
27
+##	snps <- rownames(snpProbes)
28
+##	snps <- snps[snps %in% featureNames(object)]
29
+##	index <- match(snps, featureNames(object), nomatch=0)
30
+##	index <- index[index != 0]
31
+##	featureNames(object)[index]
32
+##})
22 33
 
23
-setMethod("snpNames", "eSet", function(object){
24
-	path <- system.file("extdata", package=paste(annotation(object), "Crlmm", sep=""))
25
-	load(file.path(path, "snpProbes.rda"))
26
-	snpProbes <- get("snpProbes")
27
-	snps <- rownames(snpProbes)
28
-	snps <- snps[snps %in% featureNames(object)]
29
-	index <- match(snps, featureNames(object), nomatch=0)
30
-	index <- index[index != 0]
31
-	featureNames(object)[index]
32
-})
33 34
 ##setMethod("combine", signature=signature(x="eSet", y="eSet"),
34 35
 ##	  function(x, y, ...){
35 36
 ##		  ##Check that both x and y are valid objects