Browse code

update ACN function

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

Rob Scharp authored on 16/02/2011 15:56:27
Showing1 changed files

... ...
@@ -474,7 +474,6 @@ ACN <- function(object, allele, i , j){
474 474
 					jj <- which(object$gender[j] == 2)
475 475
 					acn[acn.index, jj] <- C1(object, marker.index, female.batch.index, female.index)
476 476
 				}
477
-##				## 4. CHR X NPs: men
478 477
 				male.index <- j[object$gender[j] == 1]
479 478
 				if(length(male.index) > 0){
480 479
 					if(is.ff){
... ...
@@ -508,32 +507,27 @@ ACN <- function(object, allele, i , j){
508 507
 			acn[acn.index, ] <- 0
509 508
 		}
510 509
 		if(any(is.auto)){
511
-			auto.index <- which(is.auto & is.snp)
512
-			if(length(auto.index) > 0){
513
-				marker.index <- i[auto.index]
514
-				acn[auto.index, ] <- C2(object, marker.index, batch.index, j)
515
-			}
510
+			auto.index <- which(is.auto)
511
+			marker.index <- i[is.auto]
512
+			acn[auto.index, ] <- C2(object, marker.index, batch.index, j)
516 513
 		}
517 514
 		if(any(is.X)){
518
-			##Chr X SNPs
519
-			if(any(is.snp)){
520
-				if(is.ff) {
521
-					open(phiPrimeA(object))
522
-					open(phiPrimeB(object))
523
-					open(phiA(object))
524
-					open(nuA(object))
525
-					open(A(object))
526
-				}
527
-				marker.index <- i[is.X & is.snp]
528
-				acn.index <- which(is.X & is.snp)
529
-				acn[acn.index, ] <- C3(object, allele="B", marker.index, batch.index, j)
530
-				if(is.ff) {
531
-					close(phiPrimeA(object))
532
-					close(phiPrimeB(object))
533
-					close(phiA(object))
534
-					close(nuA(object))
535
-					close(A(object))
536
-				}
515
+			if(is.ff){
516
+				open(phiPrimeA(object))
517
+				open(phiPrimeB(object))
518
+				open(phiA(object))
519
+				open(nuA(object))
520
+				open(A(object))
521
+			}
522
+			marker.index <- i[is.X & is.snp]
523
+			acn.index <- which(is.X & is.snp)
524
+			acn[acn.index, ] <- C3(object, allele="B", marker.index, batch.index, j)
525
+			if(is.ff){
526
+				close(phiPrimeA(object))
527
+				close(phiPrimeB(object))
528
+				close(phiA(object))
529
+				close(nuA(object))
530
+				close(A(object))
537 531
 			}
538 532
 			if(any(!is.snp)){
539 533
 				acn.index <- which(!is.snp)