Browse code

Fixed bug in call to fit.wls from fit.lm3. Added Ns argument.

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

Rob Scharp authored on 21/08/2010 02:48:46
Showing 1 changed files

... ...
@@ -733,45 +733,45 @@ crlmmCopynumberLD <- function(object,
733 733
 	snpBatches <- splitIndicesByLength(XIndex.snps, ocProbesets())
734 734
 	if(verbose) message("Estimating allele-specific copy number at polymorphic loci on chromosome X")
735 735
 	ocLapply(seq(along=snpBatches),
736
-			fit.lm3,
737
-			marker.index=XIndex.snps,
738
-			object=object,
739
-			Ns=Ns,
740
-			normal=normal,
741
-			snpflags=snpflags,
742
-			snpBatches=snpBatches,
743
-			batchSize=ocProbesets(),
744
-			SNRMin=SNRMin,
745
-			MIN.SAMPLES=MIN.SAMPLES,
746
-			MIN.OBS=MIN.OBS,
747
-			DF=DF.PRIOR,
748
-			GT.CONF.THR=GT.CONF.THR,
749
-			THR.NU.PHI=THR.NU.PHI,
750
-			MIN.NU=MIN.NU,
751
-			MIN.PHI=MIN.PHI,
752
-			verbose=verbose,
736
+		 fit.lm3,
737
+		 marker.index=XIndex.snps,
738
+		 object=object,
739
+		 Ns=Ns,
740
+		 normal=normal,
741
+		 snpflags=snpflags,
742
+		 snpBatches=snpBatches,
743
+		 batchSize=ocProbesets(),
744
+		 SNRMin=SNRMin,
745
+		 MIN.SAMPLES=MIN.SAMPLES,
746
+		 MIN.OBS=MIN.OBS,
747
+		 DF=DF.PRIOR,
748
+		 GT.CONF.THR=GT.CONF.THR,
749
+		 THR.NU.PHI=THR.NU.PHI,
750
+		 MIN.NU=MIN.NU,
751
+		 MIN.PHI=MIN.PHI,
752
+		 verbose=verbose,
753 753
 		 neededPkgs="crlmm")
754 754
 	if(verbose) message("Estimating total copy number for nonpolymorphic loci on chromosome X")
755 755
 	snpBatches <- splitIndicesByLength(XIndex.nps, ocProbesets())
756
-	tmp <- ocLapply(seq(along=snpBatches),
757
-			fit.lm4,
758
-			marker.index=XIndex.nps,
759
-			object=object,
760
-			Ns=Ns,
761
-			normal=normal,
762
-			snpflags=snpflags,
763
-			snpBatches=snpBatches,
764
-			batchSize=ocProbesets(),
765
-			SNRMin=SNRMin,
766
-			MIN.SAMPLES=MIN.SAMPLES,
767
-			MIN.OBS=MIN.OBS,
768
-			DF=DF.PRIOR,
769
-			GT.CONF.THR=GT.CONF.THR,
770
-			THR.NU.PHI=THR.NU.PHI,
771
-			MIN.NU=MIN.NU,
772
-			MIN.PHI=MIN.PHI,
773
-			verbose=verbose,
774
-			neededPkgs="crlmm")
756
+	ocLapply(seq(along=snpBatches),
757
+		 fit.lm4,
758
+		 marker.index=XIndex.nps,
759
+		 object=object,
760
+		 Ns=Ns,
761
+		 normal=normal,
762
+		 snpflags=snpflags,
763
+		 snpBatches=snpBatches,
764
+		 batchSize=ocProbesets(),
765
+		 SNRMin=SNRMin,
766
+		 MIN.SAMPLES=MIN.SAMPLES,
767
+		 MIN.OBS=MIN.OBS,
768
+		 DF=DF.PRIOR,
769
+		 GT.CONF.THR=GT.CONF.THR,
770
+		 THR.NU.PHI=THR.NU.PHI,
771
+		 MIN.NU=MIN.NU,
772
+		 MIN.PHI=MIN.PHI,
773
+		 verbose=verbose,
774
+		 neededPkgs="crlmm")
775 775
 	return(object)
776 776
 }
777 777
 crlmmCopynumber2 <- crlmmCopynumberLD
... ...
@@ -1248,12 +1248,12 @@ fit.lm3 <- function(idxBatch,
1248 1248
 		YA <- muA*wA
1249 1249
 		YB <- muB*wB
1250 1250
 		##res <- nuphiAlleleX(allele="A", Ystar=YA, W=wA)
1251
-		betas <- fit.wls(allele="A", Ystar=YA, W=wA, autosome=FALSE)
1251
+		betas <- fit.wls(allele="A", Ystar=YA, W=wA, Ns=Ns, autosome=FALSE)
1252 1252
 		nuA[, J] <- betas[1, ]
1253 1253
 		phiA[, J] <- betas[2, ]
1254 1254
 		phiA2[, J] <- betas[3, ]
1255 1255
 		rm(betas)
1256
-		betas <- fit.wls(allele="B", Ystar=YB, W=wB, autosome=FALSE)
1256
+		betas <- fit.wls(allele="B", Ystar=YB, W=wB, Ns=Ns, autosome=FALSE)
1257 1257
 		nuB[, J] <- betas[1, ]
1258 1258
 		phiB[, J] <- betas[2, ]
1259 1259
 		phiB2[, J] <- betas[3, ]