From 6ebaddd72d88f959f031ccef1621b17a40dfd601 Mon Sep 17 00:00:00 2001 From: erliuu Date: Mon, 26 Oct 2026 15:41:01 -0700 Subject: [PATCH 1/2] fix([r] add_tile_matrix): Fixed issue running add_tile_matrix() without frags_name, as.data.frame() on marker results --- NAMESPACE | 2 +- R/fragment_ops.R | 4 ++-- R/markers.R | 1 + man/add_tile_matrix.Rd | 4 ++-- tests/testthat/test-fragment_ops.R | 8 ++++++++ tests/testthat/test-utils.R | 2 ++ 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index b1b10d1..efe6df3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -59,6 +59,7 @@ S3method(align_cells,MarchRDataset) S3method(align_cells,MarchRProject) S3method(apply_to_assay,MarchRDataset) S3method(apply_to_assay,MarchRProject) +S3method(as.data.frame,MarkerResult) S3method(cell_names,MarchRDataset) S3method(cell_names,MarchRProject) S3method(custom_enrichment,MarchRProject) @@ -249,7 +250,6 @@ export(add_umap) export(align_assays) export(align_cells) export(apply_to_assay) -export(as.data.frame.MarkerResult) export(assert_that) export(cell_names) export(create_example_project) diff --git a/R/fragment_ops.R b/R/fragment_ops.R index 0000096..62ebe7f 100644 --- a/R/fragment_ops.R +++ b/R/fragment_ops.R @@ -182,7 +182,7 @@ add_tile_matrix <- function( #' @export add_tile_matrix.MarchRDataset <- function( proj, - frags_name = NULL, + frags_name = character(0), output_assay_name = "TileMatrix", genome = NULL, ranges = NULL, @@ -255,7 +255,7 @@ add_tile_matrix.MarchRDataset <- function( #' @export add_tile_matrix.MarchRProject <- function( proj, - frags_name = NULL, + frags_name = character(0), dataset_names = character(0), output_assay_name = "TileMatrix", ranges = NULL, diff --git a/R/markers.R b/R/markers.R index a741153..7c36705 100644 --- a/R/markers.R +++ b/R/markers.R @@ -39,6 +39,7 @@ print.MarkerResult <- function(x, ...) { )) } +#' @method as.data.frame MarkerResult #' @export as.data.frame.MarkerResult <- function(x, ...) { as.data.frame(x$results) diff --git a/man/add_tile_matrix.Rd b/man/add_tile_matrix.Rd index 05943df..3edbdd2 100644 --- a/man/add_tile_matrix.Rd +++ b/man/add_tile_matrix.Rd @@ -8,7 +8,7 @@ \usage{ \method{add_tile_matrix}{MarchRDataset}( proj, - frags_name = NULL, + frags_name = character(0), output_assay_name = "TileMatrix", genome = NULL, ranges = NULL, @@ -25,7 +25,7 @@ \method{add_tile_matrix}{MarchRProject}( proj, - frags_name = NULL, + frags_name = character(0), dataset_names = character(0), output_assay_name = "TileMatrix", ranges = NULL, diff --git a/tests/testthat/test-fragment_ops.R b/tests/testthat/test-fragment_ops.R index de757ca..4c8defb 100644 --- a/tests/testthat/test-fragment_ops.R +++ b/tests/testthat/test-fragment_ops.R @@ -22,6 +22,14 @@ test_that("add_tile_matrix stores a column-major TileMatrix in the project direc expect_identical(as(stored, "dgCMatrix"), as(lazy, "dgCMatrix")) }) +test_that("add_tile_matrix auto-selects the only fragment set", { + ds <- .add_test_tiles(create_test_dataset(include_fragments = TRUE)) + proj <- .add_test_tiles(.tile_test_project()) + + expect_true("TileMatrix" %in% names(ds$matrices)) + expect_true("TileMatrix" %in% names(proj$datasets$d1$matrices)) +}) + test_that("add_tile_matrix keeps the existing matrix when overwrite = FALSE", { proj <- .add_test_tiles(.tile_test_project(), frags_name = "ATAC") before <- as(proj$datasets$d1$matrices$TileMatrix, "dgCMatrix") diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index ae2d48d..0f92075 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -18,6 +18,8 @@ test_that("partial_apply keeps new arguments when re-wrapping its own partial", s3 <- partial_apply(LSI(n_dimensions = 5L), threads = 2L, .missing_args_error = FALSE) expect_identical(attr(s3, "fn"), LSI) expect_identical(attr(s3, "args")$n_dimensions, 5L) +}) + test_that("log_progress prints a timestamp and the message", { expect_null(.log_clock$start) msgs <- capture_messages(log_progress("Computing LSI")) From 684f18203c0db4f40ca96439bac542f4af6f5d1d Mon Sep 17 00:00:00 2001 From: erliuu Date: Mon, 26 Oct 2026 15:43:44 -0700 Subject: [PATCH 2/2] docs([md] release): Update README and docs for prepared MarchR alpha release v0.3.0 --- DESCRIPTION | 4 ++-- LICENSE | 42 +++++++++++++++++++++--------------------- NEWS.md | 29 ++++++++++++++++++++++++++++- README.md | 9 ++++++--- 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8174cbb..f38a927 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,12 +1,12 @@ Package: MarchR Type: Package Title: Multi-Assay Multi-Dataset Disk-Backed Analysis -Version: 0.2.0 +Version: 0.3.0 Authors@R: c( person("Eric", "Liu", , "erliu1@stanford.edu", role = c("aut", "cre")), person("Immanuel", "Abdi", , "iabdi@stanford.edu", role = c("aut")), person("Stanford University", role=c("cph", "fnd"))) -Date: 2026-09-29 +Date: 2026-10-26 Description: Multi-Assay Multi-Dataset Disk-Backed Analysis. License: MIT + file LICENSE Encoding: UTF-8 diff --git a/LICENSE b/LICENSE index 9054396..34a8139 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2026 MarchR Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2026 MarchR Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NEWS.md b/NEWS.md index 51d4d87..b9cf4ea 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1 +1,28 @@ -# MarchR 0.2.0 +# MarchR 0.3.0 + +## New features + +* Reworked progress logging across modules, with per-step and total elapsed times. set `options(MarchR.verbose = TRUE)` to enable `verbose` logging in session globally. +* `write_sce2g_inputs()` exports project data for the scE2G enhancer-gene linkage pipeline. +* `add_background_peaks()` reimplements betterChromVAR on BPCells streaming, with chunked on-disk output to cap memory. +* `get_tutorial_data()` downloads the hematopoiesis tutorial fragment files. +* New tutorials: scE2G, ChromBPNet pseudobulk export, and multiome (work in progress). + +## Performance + +* `TileMatrix` is stored column-major by default, speeding up IterativeLSI. +* Per-assay feature totals are stored and reused by doublet scoring and IterativeLSI, and are updated when cells are removed. + +## Behavior changes + +* UMAP uses `uwot::umap2()` and accepts `batch`; requires uwot >= 0.2.5. +* An assay must use one storage order across datasets; `add_matrix()` errors otherwise. +* `get_values()` returns a single assay. +* Default doublet simulation trials are now `5 * max(floor(n_cells / n_doublets), 1)`. +* `project()`, `project_bulk_atac()`, `add_module_score()`, and `add_gene_integration_matrix()` + run their BPCells matrix passes single-threaded by default. + +## Bug fixes + +* Gene tracks merge exons within the plotting window and warn when a gene has no exon annotations. +* `add_marker_features()` bias matching now searches `k` neighbors (capped at the background pool size); previously it used the KNN method's own default (10 for `knn_hnsw()`). diff --git a/README.md b/README.md index df71e83..c291eee 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,13 @@ options(repos = BiocManager::repositories()) remotes::install_github("bnprks/BPCells/r") # Installs MarchR and the packages required by the tutorial. -remotes::install_github("GreenleafLab/MarchR@v0.2.0", upgrade = "never") +install.packages("uwot") # Upgraded needed for v0.2.0 --> v0.3.0 +remotes::install_github("GreenleafLab/MarchR@v0.3.0", upgrade = "never") # For Alpha-users, you may need to clone this repo and install locally: -# remotes::install_local("~/software/MarchR", upgrade = "never") +# git clone https://github.com/GreenleafLab/MarchR.git ~/software/MarchR +# git -C ~/software/MarchR fetch --tags && git -C ~/software/MarchR checkout v0.3.0 +remotes::install_local("~/software/MarchR", upgrade = "never") # Replace CRAN igraph with development build, which fixes a memory overflow # in cluster_graph_leiden() on large datasets (igraph PR #2627, not yet on CRAN) @@ -166,5 +169,5 @@ If you use MarchR in your research, please cite: ``` Liu E, Abdi I. (2026). MarchR: Multi-Assay Multi-Dataset Disk-Backed Analysis. -R package version 0.2.0. https://github.com/GreenleafLab/MarchR +R package version 0.3.0. https://github.com/GreenleafLab/MarchR ```