Browse code

Bug fix in summarizeSnps -- median intensity not recorded correctly for BB genotype B allele

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

Rob Scharp authored on 16/02/2011 15:57:17
Showing1 changed files

... ...
@@ -349,8 +349,8 @@ shrinkGenotypeSummaries <- function(strata, index.list, object, MIN.OBS, MIN.SAM
349 349
 	shrink.corrBB <- corrBB <- as.matrix(corrBB(object)[marker.index, ])
350 350
 	flags <- as.matrix(flags(object)[marker.index, ])
351 351
 	for(k in seq(along=batches)){
352
-		B <- batches[[k]]
353
-		this.batch <- unique(as.character(batch(object)[B]))
352
+		sample.index <- batches[[k]]
353
+		this.batch <- unique(as.character(batch(object)[sample.index]))
354 354
 		medianA[[k]] <- cbind(medianA.AA[, k], medianA.AB[, k], medianA.BB[, k])
355 355
 		medianB[[k]] <- cbind(medianB.AA[, k], medianB.AB[, k], medianB.BB[, k])
356 356
 		madA <- cbind(madA.AA[, k], madA.AB[, k], madA.BB[, k])
... ...
@@ -359,7 +359,6 @@ shrinkGenotypeSummaries <- function(strata, index.list, object, MIN.OBS, MIN.SAM
359 359
 		##RS: estimate DF.PRIOR
360 360
 		shrink.madA[[k]] <- shrink(madA, NN, DF.PRIOR)
361 361
 		shrink.madB[[k]] <- shrink(madB, NN, DF.PRIOR)
362
-
363 362
 		## an estimate of the background variance is the MAD
364 363
 		## of the log2(allele A) intensities among subjects with
365 364
 		## genotypes BB
... ...
@@ -1425,7 +1424,7 @@ summarizeNps <- function(strata, index.list, object, batchSize,
1425 1424
 			gender <- object$gender[sample.index]
1426 1425
 			sample.index <- sample.index[gender == 2]
1427 1426
 			if(length(sample.index) == 0) next()
1428
-s		}
1427
+		}
1429 1428
 		this.batch <- unique(as.character(batch(object)[sample.index]))
1430 1429
 		j <- match(this.batch, batchnames)
1431 1430
 		I.A <- AA[, sample.index]
... ...
@@ -1515,6 +1514,7 @@ summarizeSnps <- function(strata,
1515 1514
 		stats <- summaryStats(G.AA, A, FUNS=c("rowMedians", "rowMAD"))
1516 1515
 		medianA.AA(object)[index, k] <- stats[, 1]
1517 1516
 		madA.AA(object)[index, k] <- stats[, 2]
1517
+
1518 1518
 		stats <- summaryStats(G.AB, A, FUNS=c("rowMedians", "rowMAD"))
1519 1519
 		medianA.AB(object)[index, k] <- stats[, 1]
1520 1520
 		madA.AB(object)[index, k] <- stats[, 2]
... ...
@@ -1531,7 +1531,7 @@ summarizeSnps <- function(strata,
1531 1531
 		medianB.AB(object)[index, k] <- stats[, 1]
1532 1532
 		madB.AB(object)[index, k] <- stats[, 2]
1533 1533
 
1534
-		statsB.BB[[k]] <- summaryStats(G.BB, B, FUNS=c("rowMedians", "rowMAD"))
1534
+		stats <- summaryStats(G.BB, B, FUNS=c("rowMedians", "rowMAD"))
1535 1535
 		medianB.BB(object)[index, k] <- stats[, 1]
1536 1536
 		madB.BB(object)[index, k] <- stats[, 2]
1537 1537