Browse code

Fixed conflict

Joshua D. Campbell authored on 03/10/2021 21:45:17
Showing 3 changed files

... ...
@@ -30,7 +30,7 @@ LinkingTo: Rcpp, RcppEigen
30 30
 License: MIT + file LICENSE
31 31
 Encoding: UTF-8
32 32
 LazyData: true
33
-RoxygenNote: 7.1.1
33
+RoxygenNote: 7.1.2
34 34
 BugReports: https://github.com/campbio/celda/issues
35 35
 biocViews: SingleCell, GeneExpression, Clustering, Sequencing, Bayesian
36 36
 NeedsCompilation: yes
... ...
@@ -507,8 +507,18 @@ setMethod(
507 507
       pseudocount = 1e-20
508 508
     )
509 509
 
510
-    # This part needs to be optimized
511
-    estRmat[seq(nrow(counts)), which(batch == bat)] <- estRmat.temp
510
+    # Speed up sparse matrix value assignment by cbind -> order recovery
511
+    allCol <- paste0("col_", seq_len(ncol(estRmat)))
512
+    colnames(estRmat) <- allCol
513
+
514
+    subCol <- paste0("col_", which(batch == bat))
515
+    colnames(estRmat.temp) <- subCol
516
+
517
+    estRmat <- estRmat[, !(allCol %in% subCol)]
518
+    estRmat <- cbind(estRmat, estRmat.temp)
519
+
520
+    # Recover order and set names
521
+    estRmat <- estRmat[, allCol]
512 522
     dimnames(estRmat) <- list(geneNames, allCellNames)
513 523
 
514 524
     resBatch[[bat]] <- list(
... ...
@@ -6,6 +6,11 @@
6 6
 
7 7
 using namespace Rcpp;
8 8
 
9
+#ifdef RCPP_USE_GLOBAL_ROSTREAM
10
+Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
11
+Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
12
+#endif
13
+
9 14
 // decontXEM
10 15
 Rcpp::List decontXEM(const Eigen::MappedSparseMatrix<double>& counts, const NumericVector& counts_colsums, const NumericVector& theta, const bool& estimate_eta, const NumericMatrix& eta, const NumericMatrix& phi, const IntegerVector& z, const bool& estimate_delta, const NumericVector& delta, const double& pseudocount);
11 16
 RcppExport SEXP _celda_decontXEM(SEXP countsSEXP, SEXP counts_colsumsSEXP, SEXP thetaSEXP, SEXP estimate_etaSEXP, SEXP etaSEXP, SEXP phiSEXP, SEXP zSEXP, SEXP estimate_deltaSEXP, SEXP deltaSEXP, SEXP pseudocountSEXP) {