Browse code

potential speed up in cland

Andrew McDavid authored on 28/09/2021 20:36:56
Showing 3 changed files

... ...
@@ -2,7 +2,7 @@ Type: Package
2 2
 Package: CellaRepertorium
3 3
 Title: Data structures, clustering and testing for single 
4 4
     cell immune receptor repertoires (scRNAseq RepSeq/AIRR-seq)
5
-Version: 1.3.0
5
+Version: 1.3.1
6 6
 Authors@R: 
7 7
     c(person(given = "Andrew",
8 8
              family = "McDavid",
... ...
@@ -72,7 +72,7 @@ VignetteBuilder:
72 72
     knitr
73 73
 Encoding: UTF-8
74 74
 NeedsCompilation: yes
75
-RoxygenNote: 7.1.1
75
+RoxygenNote: 7.1.2
76 76
 URL: https://github.com/amcdavid/CellaRepertorium
77 77
 BugReports: https://github.com/amcdavid/CellaRepertorium/issues
78 78
 Roxygen: list(markdown = TRUE)
... ...
@@ -151,7 +151,7 @@ cland = function(X, Y, new_pk){
151 151
                             Y$contig_tbl[c(Y$cluster_pk, Y$contig_pk)], join = dplyr::inner_join, by = X$contig_pk, overwrite = FALSE)
152 152
     contigs[[new_pk]] = interaction(contigs[[X$cluster_pk]], contigs[[Y$cluster_pk]])
153 153
     # I guess we have mostly been an integer, otherwise ?
154
-    contigs[[new_pk]] = as.numeric(as.character(factor(contigs[[new_pk]], labels = seq_along(unique(contigs[[new_pk]])))))
154
+    contigs[[new_pk]] = as.integer(factor(contigs[[new_pk]]))
155 155
     cluster_tblX = unique(contigs[c(new_pk, X$cluster_pk, Y$cluster_pk)]) %>% left_join_warn(X$cluster_tbl, by = X$cluster_pk, overwrite =  TRUE) %>% left_join_warn(Y$cluster_tbl, by = Y$cluster_pk, overwrite = TRUE)
156 156
     cdb = replace_cluster_tbl(X, cluster_tblX, contigs, new_pk, warn = FALSE)
157 157
     if (has_fineclustering(cdb)) warning("Rerun `fine_clustering` to update results.")
... ...
@@ -5,6 +5,11 @@
5 5
 
6 6
 using namespace Rcpp;
7 7
 
8
+#ifdef RCPP_USE_GLOBAL_ROSTREAM
9
+Rcpp::Rostream<true>&  Rcpp::Rcout = Rcpp::Rcpp_cout_get();
10
+Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
11
+#endif
12
+
8 13
 // cdhitestC
9 14
 IntegerVector cdhitestC(List opts, CharacterVector name, bool showProgress);
10 15
 RcppExport SEXP _CellaRepertorium_cdhitestC(SEXP optsSEXP, SEXP nameSEXP, SEXP showProgressSEXP) {