Browse code

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

unknown authored on 25/08/2010 04:07:29
Showing 2 changed files

... ...
@@ -546,4 +546,5 @@ function (which expects ff objects and supports parallel processing)
546 546
 2010-08-25 M. Ritchie 1.7.12
547 547
 ** Renamed functions readIdatFiles2() -> readIdatFiles(), RGtoXY2() -> RGtoXY(), preprocessInfinium2v2() -> preprocessInfinium2(), crlmmIllumina2() -> crlmmIllumina().  These make use of ff objects to store data.
548 548
 ** Exported crlmmIlluminaV2(), which combines reading in of idats and genotyping in one.  Also added a man page for this function
549
-** tidied up crlmm-illumina.R, removing commented out code.
550 549
\ No newline at end of file
550
+** Added a check for whether an object is an 'ff_matrix' before running open() or close() to several functions.  Added close() statements to readIdatFiles(), RGtoXY() and stripNormalize().  Added open() statement to stripNormalize().
551
+** tidied up crlmm-illumina.R, removing commented out code.
... ...
@@ -142,6 +142,11 @@ readIdatFiles <- function(sampleSheet=NULL,
142 142
 	       protocolData(RG)[["ScanDate"]] = dates$scan
143 143
        }
144 144
        storageMode(RG) = "lockedEnvironment"
145
+       if(class(RG@assayData$R)[1]=="ff_matrix") {
146
+         close(RG@assayData$R)
147
+         close(RG@assayData$G)
148
+         close(RG@assayData$zero)         
149
+       }
145 150
        RG
146 151
 }
147 152
 
... ...
@@ -493,6 +498,12 @@ RGtoXY = function(RG, chipType, verbose=TRUE) {
493 498
   XY@assayData$zero[infI,] = 0  
494 499
   gc()
495 500
 
501
+  if(class(XY@assayData$X)[1]=="ff_matrix") {
502
+    close(XY@assayData$X)
503
+    close(XY@assayData$Y)
504
+    close(XY@assayData$zero)
505
+  }
506
+  
496 507
 #  storageMode(XY) = "lockedEnvironment"
497 508
   XY
498 509
 }
... ...
@@ -518,7 +529,12 @@ stripNormalize = function(XY, useTarget=TRUE, verbose=TRUE) {
518 529
   if(verbose){
519 530
     message("Quantile normalizing ", ncol(XY), " arrays by ", max(stripnum), " strips.")
520 531
     if (getRversion() > '2.7.0') pb <- txtProgressBar(min=0, max=max(stripnum), style=3)
521
-  } 
532
+  }
533
+  
534
+  if(class(XY@assayData$X)[1]=="ff_matrix") {
535
+    open(XY@assayData$X)
536
+    open(XY@assayData$Y)
537
+  }
522 538
   for(s in 1:max(stripnum)) {
523 539
     if(verbose) {
524 540
       if (getRversion() > '2.7.0') setTxtProgressBar(pb, s)
... ...
@@ -538,6 +554,11 @@ stripNormalize = function(XY, useTarget=TRUE, verbose=TRUE) {
538 554
     rm(subX, subY, tmp, sel)
539 555
     gc()
540 556
   }
557
+  if(class(XY@assayData$X)[1]=="ff_matrix") {
558
+    close(XY@assayData$X)
559
+    close(XY@assayData$Y)
560
+  }
561
+  
541 562
   if(verbose)
542 563
     cat("\n")
543 564
   XY
... ...
@@ -673,12 +694,14 @@ preprocessInfinium2 <- function(XY, mixtureSampleSize=10^5,
673 694
     t0 <- proc.time()-t0
674 695
     if(verbose) message("Used ", round(t0[3],1), " seconds to save ", snpFile, ".")
675 696
   }
676
-  close(A)
677
-  close(B)
678
-  close(zero)
679
-  close(SKW)
680
-  close(mixtureParams)
681
-  close(SNR)
697
+  if(class(A)[1]=="ff_matrix") {
698
+    close(A)
699
+    close(B)
700
+    close(zero)
701
+    close(SKW)
702
+    close(mixtureParams)
703
+    close(SNR)
704
+  }
682 705
   return(res)
683 706
 }
684 707