Browse code

Updated decontX messages

Joshua D. Campbell authored on 30/09/2021 20:32:31
Showing 1 changed files

... ...
@@ -487,6 +487,17 @@ setMethod(
487 487
         )
488 488
       )
489 489
     }
490
+
491
+    ## Try to convert class of new matrix to class of original matrix
492
+    
493
+    .logMessages(
494
+      date(),
495
+      ".. Calculating final decontaminated matrix",
496
+      logfile = logfile,
497
+      append = TRUE,
498
+      verbose = verbose
499
+    )
500
+
490 501
     estRmat.temp <- calculateNativeMatrix(
491 502
       counts = countsBat,
492 503
       theta = res$theta,
... ...
@@ -495,6 +506,8 @@ setMethod(
495 506
       z = as.integer(res$z),
496 507
       pseudocount = 1e-20
497 508
     )
509
+
510
+    # This part needs to be optimized
498 511
     estRmat[seq(nrow(counts)), which(batch == bat)] <- estRmat.temp
499 512
     dimnames(estRmat) <- list(geneNames, allCellNames)
500 513
 
... ...
@@ -528,19 +541,17 @@ setMethod(
528 541
     "z" = returnZ
529 542
   )
530 543
 
531
-  ## Try to convert class of new matrix to class of original matrix
532
-  if (inherits(counts, "dgCMatrix")) {
544
+
545
+  if (inherits(counts, c("DelayedMatrix", "DelayedArray"))) {
546
+
533 547
     .logMessages(
534 548
       date(),
535
-      ".. Finalizing decontaminated matrix",
549
+      ".. Converting decontaminated matrix to ", class(counts),
536 550
       logfile = logfile,
537 551
       append = TRUE,
538 552
       verbose = verbose
539 553
     )
540
-  }
541
-
542
-  if (inherits(counts, c("DelayedMatrix", "DelayedArray"))) {
543
-
554
+    
544 555
     ## Determine class of seed in DelayedArray
545 556
     seed.class <- unique(DelayedArray::seedApply(counts, class))[[1]]
546 557
     if (seed.class == "HDF5ArraySeed") {