Browse code

add corr arguments to .posterior

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

Rob Scharp authored on 01/10/2011 04:45:41
Showing1 changed files

... ...
@@ -2547,8 +2547,16 @@ numberGenotypes <- function(CT){
2547 2547
 		       tau2B,
2548 2548
 		       sig2A,
2549 2549
 		       sig2B,
2550
+		       nuA,
2551
+		       nuB,
2552
+		       phiA,
2553
+		       phiB,
2554
+		       corrAA,
2555
+		       corrAB,
2556
+		       corrBB,
2550 2557
 		       a,
2551
-		       b){
2558
+		       b,
2559
+		       scale.sd){
2552 2560
 	## 5: AAAAA, AAAAB, AAABB, AABBB, ABBBB, BBBBB
2553 2561
 	##CN=4
2554 2562
 	## AAAA, AAAB, AABB, ABBB, BBBB:  L = 4
... ...
@@ -2604,7 +2612,7 @@ posteriorMean.snp <- function(stratum, object, index.list, CN,
2604 2612
 	if(verbose) message("Probe stratum ", stratum, " of ", length(index.list))
2605 2613
 	index <- index.list[[stratum]]
2606 2614
 	test <- tryCatch(open(A(object)), error=function(e) NULL)
2607
-	if(!is.null(test)) .open(object)
2615
+	if(!is.null(test)) invisible(.open(object))
2608 2616
 	a <- log2(as.matrix(A(object)[index, ]))
2609 2617
 	b <- log2(as.matrix(B(object)[index, ]))
2610 2618
 	NN <- Ns(object, i=index)[, , 1]
... ...
@@ -2619,7 +2627,7 @@ posteriorMean.snp <- function(stratum, object, index.list, CN,
2619 2627
 	phiA <- as.matrix(phiA(object)[index, ])
2620 2628
 	nuB <- as.matrix(nuB(object)[index, ])
2621 2629
 	phiB <- as.matrix(phiB(object)[index, ])
2622
-	if(!is.null(test)) .close(object)
2630
+	if(!is.null(test)) invisible(.close(object))
2623 2631
 	S <- length(prior.prob)
2624 2632
 	emit <- array(NA, dim=c(nrow(a), ncol(a), S))##SNPs x sample x 'truth'
2625 2633
 	sample.index <- split(1:ncol(object), batch(object))
... ...
@@ -2630,13 +2638,21 @@ posteriorMean.snp <- function(stratum, object, index.list, CN,
2630 2638
 		probs <- array(NA, dim=c(nrow(a), length(J), S))
2631 2639
 		for(k in seq_along(CN)){
2632 2640
 			##CT <- CN[k]
2633
-			probs[, , k] <- .posterior(CN[k],
2634
-						   tau2A,
2635
-						   tau2B,
2636
-						   sig2A,
2637
-						   sig2B,
2638
-						   a[, J],
2639
-						   b[, J])
2641
+			probs[, , k] <- .posterior(CT=CN[k],
2642
+						   tau2A=tau2A,
2643
+						   tau2B=tau2B,
2644
+						   sig2A=sig2A,
2645
+						   sig2B=sig2B,
2646
+						   nuA=nuA,
2647
+						   nuB=nuB,
2648
+						   phiA=phiA,
2649
+						   phiB=phiB,
2650
+						   corrAA=corrAA,
2651
+						   corrAB=corrAB,
2652
+						   corrBB=corrBB,
2653
+						   a=a[, J],
2654
+						   b=b[, J],
2655
+						   scale.sd=scale.sd)
2640 2656
 			##probs[, , k] <- do.call("sum", f.x.y)
2641 2657
 			##if none of the states are likely (outlier), assign NA
2642 2658
 			##		emit[, , counter] <- f.x.y