diff --git a/_pkgdown.yml b/_pkgdown.yml
index fbad0ae..3438efc 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -63,6 +63,8 @@ navbar:
menu:
- text: Hematopoiesis
href: articles/marchr_hematopoiesis.html
+ - text: Multiome
+ href: articles/marchr_multiome.html
repo:
url:
home: https://github.com/GreenleafLab/MarchR
@@ -72,6 +74,7 @@ articles:
- title: Tutorials
contents:
- marchr_hematopoiesis
+ - marchr_multiome
reference:
- title: All Functions
- subtitle: Package Overview
@@ -83,6 +86,7 @@ reference:
- subtitle: Project & Dataset Management
contents:
- create_example_project
+ - get_tutorial_data
- insert_dataset
- select_dataset
- load_project
@@ -131,6 +135,7 @@ reference:
- IterativeLSI
- marchRproject-dimreduction-methods
- add_combined_dims
+ - project_bulk_atac
- subtitle: Integration
contents:
- run_harmony
@@ -189,11 +194,22 @@ reference:
- add_peak_matrix
- add_peak_gc
- get_peak_set
+- subtitle: Pseudobulk Export
+ contents:
+ - pseudobulk_fragments
+ - write_pseudobulk_fragments
+ - write_pseudobulk_coverage
+ - write_pseudobulk_bigwig
+ - write_pseudobulk_peaks
+ - write_pseudobulk_chrom_sizes
+ - write_pseudobulk_manifest
- subtitle: Peak & Motif Annotations
contents:
- add_peak_annotations
- get_peak_annotation
- add_motif_annotations
+ - get_motifs
+ - plot_motif_logo
- peak_annotation_enrichment
- custom_enrichment
- get_matches
diff --git a/development/vignettes/marchr_multiome.Rmd b/development/vignettes/marchr_multiome.Rmd
deleted file mode 100644
index 959788a..0000000
--- a/development/vignettes/marchr_multiome.Rmd
+++ /dev/null
@@ -1,437 +0,0 @@
----
-title: "MarchR Multiome (ATAC + RNA) tutorial"
-author: "Eric Liu"
-output:
- html_document:
- toc: true
- toc_float: true
- toc_depth: 2
-vignette: >
- %\VignetteIndexEntry{MarchR Multiome (ATAC + RNA) tutorial}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-
-
-```{r setup, include=FALSE}
-knitr::opts_chunk$set(collapse = FALSE)
-
-# Collect each chunk's printed output, messages, and warnings into a single
-# collapsible "Output" box rendered after the code, keeping code and logs
-# visually separate.
-local({
- buf <- new.env(parent = emptyenv())
- buf$txt <- character(0)
- collect <- function(x, options) {
- buf$txt <- c(buf$txt, x)
- ""
- }
- esc <- function(x) {
- x <- gsub("&", "&", x, fixed = TRUE)
- x <- gsub("<", "<", x, fixed = TRUE)
- gsub(">", ">", x, fixed = TRUE)
- }
- default_chunk <- knitr::knit_hooks$get("chunk")
- knitr::knit_hooks$set(
- output = collect,
- message = collect,
- warning = collect,
- chunk = function(x, options) {
- out <- default_chunk(x, options)
- if (length(buf$txt)) {
- body <- esc(paste(buf$txt, collapse = ""))
- buf$txt <- character(0)
- out <- paste0(
- out, "\n\n```{=html}\n",
- "Output
",
- "", body, "Output
",
+ "", body, "
This is a brief MarchR multiome tutorial, based upon the ArchR “Analyze Multiome” tutorial. It uses the 10x Genomics PBMC unsorted 10k Multiome sample (hg38), which measures scATAC-seq and scRNA-seq in the same nuclei. Importantly, this tutorial assumes that you are running MarchR locally. It downloads a ~2.9 GB fragments file and a ~150 MB RNA HDF5.
+First, load MarchR. If this fails, we recommend revisiting the MarchR installation instructions.
+library(MarchR)
+set_threads() sets a session-wide thread count for operations that benefit from parallelization (Certain functions will remain single-threaded).
set_threads(4)
+## Set default MarchR threads to 4.
+Downloads and references are cached in cache_dir so they are reused across runs; the project itself is written to a temporary directory.
sample_name <- "PBMC_10k"
+cache_dir <- path.expand("~/.cache/marchr_multiome")
+data_dir <- file.path(cache_dir, "data")
+ref_dir <- file.path(cache_dir, "references")
+project_dir <- file.path(tempdir(), "marchr_project")
+Both modalities come from the same 10x Multiome sample: the ATAC fragments and the RNA feature-barcode HDF5. Files already in data_dir are not downloaded again.
url_base <- "https://cf.10xgenomics.com/samples/cell-arc/2.0.0/pbmc_unsorted_10k/pbmc_unsorted_10k_"
+atac_gz <- file.path(data_dir, "pbmc_10k_atac_fragments.tsv.gz")
+rna_h5 <- file.path(data_dir, "pbmc_10k_filtered_feature_bc_matrix.h5")
+
+dir.create(data_dir, recursive = TRUE, showWarnings = FALSE)
+options(timeout = 3600)
+if (!file.exists(atac_gz)) {
+ download.file(paste0(url_base, "atac_fragments.tsv.gz"), atac_gz, mode = "wb")
+}
+if (!file.exists(rna_h5)) {
+ download.file(paste0(url_base, "filtered_feature_bc_matrix.h5"), rna_h5, mode = "wb")
+}
+The ATAC fragments become a single MarchRDataset; the RNA modality is added to the same dataset later.
proj <- MarchRProject(dir = project_dir)
+frags <- open_fragments_10x(atac_gz) %>%
+ write_fragments_dir(file.path(project_dir, "fragments", sample_name))
+proj <- add_fragments(proj, frags, frags_name = "ATAC", dataset_name = sample_name)
+proj
+## MarchRProject Object
+## Directory: /tmp/RtmpwPUqnD/marchr_project
+## 1 Dataset:
+## PBMC_10k:
+## 671397 cells: PBMC_10k#GTAGGTGCATAACGGG-1, PBMC_10k#CCAACCCGTGGAAGGC-1, PBMC_10k#ACGGGAAGTTTACGTC-1, PBMC_10k#TAGGTTGGTTTGTGGA-1 ... PBMC_10k#GTTTCCTCACCTACGG-1
+## Fragments: ATAC
+## All datasets aligned.
+## Empty genome object
+The sample is aligned to hg38. Transcripts are used for TSS enrichment QC.
+proj <- set_gene_annotations(
+ proj,
+ annotation_type = "transcripts",
+ name = "transcripts",
+ dir_name = ref_dir,
+ release = "44",
+ transcript_choice = "all",
+ annotation_set = "comprehensive"
+)
+proj <- set_blacklist(proj, genome = "hg38", dir_name = ref_dir)
+proj <- set_chrom_sizes(proj, genome = "hg38", dir_name = ref_dir)
+Filter cells on fragment count and TSS enrichment with qc_fragments().
proj <- qc_fragments(proj, frags_name = "ATAC", n_frags = 1000, tss_enrichment = 4)
+Build a genome-wide 500bp tile matrix, then align_cells() reconciles the fragments and matrix onto a single, consistent set of cells.
proj <- add_tile_matrix(proj, frags_name = "ATAC")
+proj <- align_cells(proj)
+add_doublet_scores() simulates synthetic doublets and scores each real cell by its local doublet enrichment; filter_doublets() removes the highest-enrichment predicted doublets.
proj <- add_doublet_scores(proj, assay_name = "TileMatrix", verbose = TRUE)
+proj <- filter_doublets(proj, verbose = TRUE)
+## 2026-10-16 14:21:25 Processing dataset 1 of 1: PBMC_10k
+## 2026-10-16 14:21:39 Simulating 65000 synthetic doublets (1000 doublets x 65 trials)
+## 2026-10-16 14:21:39 Running Iterative LSI on input matrix
+## 2026-10-16 14:21:42 Starting Iterative LSI
+## 2026-10-16 14:21:42 Starting Iterative LSI iteration 1 of 2
+## 2026-10-16 14:21:42 Selecting features
+## 2026-10-16 14:21:46 Running LSI
+## 2026-10-16 14:21:46 Starting LSI
+## 2026-10-16 14:21:48 Normalizing matrix
+## Warning: Matrix compression performs poorly with non-integers.
+## • Consider calling convert_matrix_type if a compressed integer matrix is intended.
+## 2026-10-16 14:21:50 Calculating SVD
+##
+## 2026-10-16 14:21:57 Clustering LSI results
+##
+## This message is displayed once every 8 hours.
+## Warning in .fn(threads = 1L, verbose = FALSE, k = 20L, metric = "euclidean", :
+## KNN search didn't find self-neighbor for 371 datapoints. Try higher ef value
+## 2026-10-16 14:21:59 Merging 29 clusters down to 6 via hierarchical clustering
+## 2026-10-16 14:21:59 Pseudobulking matrix
+## 2026-10-16 14:22:00 Starting Iterative LSI iteration 2 of 2
+## 2026-10-16 14:22:00 Selecting features
+## 2026-10-16 14:22:01 Running LSI
+## 2026-10-16 14:22:01 Starting LSI
+## 2026-10-16 14:22:02 Normalizing matrix
+## 2026-10-16 14:22:05 Calculating SVD
+## 2026-10-16 14:22:10 Finished running Iterative LSI
+## 2026-10-16 14:22:10 Projecting simulated doublets on LSI space
+## 2026-10-16 14:23:03 Running UMAP fitting on LSI matrix
+## 14:23:03 Using HNSW for nearest neighbor search
+## 14:23:03 UMAP embedding parameters a = 0.7669 b = 1.223
+## 14:23:03 Setting random seed 1
+## 14:23:03 Read 13164 rows and found 30 numeric columns
+## 14:23:03 Building HNSW index with metric 'l2' ef = 200 M = 16 using 1 threads
+## 14:23:04 Finished building index
+## 14:23:04 Searching HNSW index with ef = 40 and 4 threads
+## 14:23:05 Finished searching
+## 14:23:06 Commencing smooth kNN distance calibration using 4 threads with target n_neighbors = 40
+## 14:23:07 Initializing from normalized Laplacian + noise (using RSpectra)
+## 14:23:07 Range-scaling initial input columns to 0-10
+## 14:23:07 Commencing optimization for 500 epochs, with 946616 positive edges using 4 threads
+## 14:23:07 Using rng type: pcg
+## 14:23:10 Optimization finished
+## 2026-10-16 14:23:10 Validating re-projection Pearson correlation
+## 14:23:10 Setting model random seed 1
+## 14:23:10 Read 13164 rows and found 30 numeric columns
+## 14:23:10 Processing block 1 of 1
+## 14:23:10 Searching HNSW index with ef = 40 and 4 threads
+## 14:23:10 Finished searching
+## 14:23:10 Commencing smooth kNN distance calibration using 4 threads with target n_neighbors = 40
+## 14:23:10 Initializing by weighted average of neighbor coordinates using 4 threads
+## 14:23:10 Commencing optimization for 167 epochs, with 526560 positive edges using 4 threads
+## 14:23:11 Finished
+## 2026-10-16 14:23:11 UMAP Re-projection Correlation: R^2 = 0.902
+## 2026-10-16 14:23:11 Projecting simulated doublets on UMAP space
+## 14:23:11 Setting model random seed 1
+## 14:23:11 Read 65000 rows and found 30 numeric columns
+## 14:23:11 Processing block 1 of 1
+## 14:23:11 Searching HNSW index with ef = 40 and 4 threads
+## 14:23:11 Finished searching
+## 14:23:11 Commencing smooth kNN distance calibration using 4 threads with target n_neighbors = 40
+## 14:23:11 Initializing by weighted average of neighbor coordinates using 4 threads
+## 14:23:12 Commencing optimization for 167 epochs, with 2600000 positive edges using 4 threads
+## 14:23:13 Finished
+## 2026-10-16 14:23:13 Compute doublet scores and enrichments from UMAP
+## 14:23:13 Building HNSW index with metric 'euclidean' ef = 200 M = 16 using 1 threads
+## 14:23:14 Finished building index
+## 14:23:14 Searching HNSW index with ef = 200 and 1 threads
+## 14:23:15 Finished searching
+## Filtering doublets in 1 dataset(s): PBMC_10k
+## 2026-10-16 14:23:16 filtering dataset: PBMC_10k.
+## 2026-10-16 14:23:16 Filtering 1732 doublets from 13164 cells (13.2%)
+## 2026-10-16 14:23:16 Dataset successfully filtered.
+## 2026-10-16 14:23:16 Removing stale doublet data
+## 2026-10-16 14:23:16 doublet filtering complete.
+import_feature_matrix_10x() adds the Gene Expression features as a GeneExpressionMatrix assay in the existing ATAC dataset, keeping only barcodes shared by both modalities. Rows are Ensembl IDs, with gene symbols stored in the feature metadata.
proj <- import_feature_matrix_10x(proj, input = rna_h5)
+proj <- align_cells(proj)
+head(get_feature_metadata(proj, assay_names = "GeneExpressionMatrix"))
+## 2026-10-16 14:23:16 Barcode intersection: 10010 shared, 1422 ATAC-only dropped, 2002 RNA-only dropped.
+## gene_symbol assay_name
+## ENSG00000243485 MIR1302-2HG GeneExpressionMatrix
+## ENSG00000237613 FAM138A GeneExpressionMatrix
+## ENSG00000186092 OR4F5 GeneExpressionMatrix
+## ENSG00000238009 AL627309.1 GeneExpressionMatrix
+## ENSG00000239945 AL627309.3 GeneExpressionMatrix
+## ENSG00000239906 AL627309.2 GeneExpressionMatrix
+Each modality is reduced separately with IterativeLSI(). ATAC uses the defaults; RNA uses non-binarized counts and selects 2,500 variable genes from the first iteration.
proj <- IterativeLSI(
+ proj,
+ assay_name = "TileMatrix",
+ output_assay_name = "LSI_ATAC",
+ dim_reduction_name = "LSI_ATAC",
+ verbose = TRUE
+)
+proj <- IterativeLSI(
+ proj,
+ assay_name = "GeneExpressionMatrix",
+ output_assay_name = "LSI_RNA",
+ dim_reduction_name = "LSI_RNA",
+ binarize = FALSE,
+ first_selection = "var",
+ feature_selection_method = select_features_variance(num_feats = 2500L),
+ verbose = TRUE
+)
+## 2026-10-16 14:23:25 Starting Iterative LSI
+## 2026-10-16 14:23:25 Starting Iterative LSI iteration 1 of 2
+## 2026-10-16 14:23:25 Selecting features
+## 2026-10-16 14:23:27 Running LSI
+## 2026-10-16 14:23:27 Starting LSI
+## 2026-10-16 14:23:31 Filtering 401 outlier cells (colSum quantiles 0.02-0.98) before SVD
+## 2026-10-16 14:23:35 Normalizing matrix
+## 2026-10-16 14:23:43 Calculating SVD
+## 2026-10-16 14:23:55 Dropping PCs 1 due to high correlation with sequencing depth
+## 2026-10-16 14:23:55 Re-projecting outlier cells into LSI space
+## 2026-10-16 14:24:05 Clustering LSI results
+## Warning in .fn(threads = 1L, verbose = FALSE, k = 20L, metric = "euclidean", :
+## KNN search didn't find self-neighbor for 1 datapoints. Try higher ef value
+## 2026-10-16 14:24:07 Merging 22 clusters down to 6 via hierarchical clustering
+## 2026-10-16 14:24:07 Pseudobulking matrix
+## 2026-10-16 14:24:13 Starting Iterative LSI iteration 2 of 2
+## 2026-10-16 14:24:13 Selecting features
+## 2026-10-16 14:24:13 Running LSI
+## 2026-10-16 14:24:14 Starting LSI
+## 2026-10-16 14:24:16 Filtering 402 outlier cells (colSum quantiles 0.02-0.98) before SVD
+## 2026-10-16 14:24:20 Normalizing matrix
+## 2026-10-16 14:24:28 Calculating SVD
+## 2026-10-16 14:24:35 Dropping PCs 1 due to high correlation with sequencing depth
+## 2026-10-16 14:24:35 Re-projecting outlier cells into LSI space
+## 2026-10-16 14:24:44 Finished running Iterative LSI
+## 2026-10-16 14:25:07 Starting Iterative LSI
+## 2026-10-16 14:25:07 Starting Iterative LSI iteration 1 of 2
+## 2026-10-16 14:25:07 Selecting features
+## 2026-10-16 14:25:30 Running LSI
+## 2026-10-16 14:25:30 Starting LSI
+## 2026-10-16 14:25:33 Filtering 402 outlier cells (colSum quantiles 0.02-0.98) before SVD
+## 2026-10-16 14:25:36 Normalizing matrix
+## 2026-10-16 14:25:42 Calculating SVD
+## 2026-10-16 14:25:44 Re-projecting outlier cells into LSI space
+## 2026-10-16 14:25:46 Clustering LSI results
+## 2026-10-16 14:25:48 Merging 27 clusters down to 6 via hierarchical clustering
+## 2026-10-16 14:25:48 Pseudobulking matrix
+## 2026-10-16 14:25:50 Starting Iterative LSI iteration 2 of 2
+## 2026-10-16 14:25:50 Selecting features
+## 2026-10-16 14:25:50 Running LSI
+## 2026-10-16 14:25:50 Starting LSI
+## 2026-10-16 14:26:13 Filtering 402 outlier cells (colSum quantiles 0.02-0.98) before SVD
+## 2026-10-16 14:26:35 Normalizing matrix
+## 2026-10-16 14:27:19 Calculating SVD
+## 2026-10-16 14:27:20 Re-projecting outlier cells into LSI space
+## 2026-10-16 14:27:22 Finished running Iterative LSI
+add_combined_dims() variance-normalizes each modality’s reduction and concatenates them into a single joint embedding.
proj <- add_combined_dims(
+ proj,
+ embedding_names = c("LSI_ATAC", "LSI_RNA"),
+ output_name = "LSI_Combined"
+)
+## Warning: Converting to a dense matrix may use excessive memory
+## This message is displayed once every 8 hours.
+Call clusters on the joint embedding with add_clusters(); raise resolution for finer clusters.
proj <- add_clusters(
+ proj,
+ embedding_name = "LSI_Combined",
+ cluster_graph_method = cluster_graph_leiden(resolution = 0.4),
+ verbose = TRUE
+)
+table(get_cell_metadata(proj)$clusters)
+## 2026-10-16 14:27:23 Extracting embedding 'LSI_Combined'
+## 2026-10-16 14:27:23 Clustering 10010 cells with 59 dimensions
+## Warning in .fn(threads = 1L, verbose = FALSE, k = 20L, metric = "euclidean", :
+## KNN search didn't find self-neighbor for 2 datapoints. Try higher ef value
+## Found 16 clusters
+## 2026-10-16 14:27:24 Added 16 clusters as 'clusters' in cell metadata
+##
+## C1 C10 C11 C12 C13 C14 C15 C16 C2 C3 C4 C5 C6 C7 C8 C9
+## 228 2852 477 98 34 338 364 401 1092 1143 1128 343 657 124 567 164
+Compute a UMAP for each modality and for the joint embedding.
+for (emb in c("ATAC", "RNA", "Combined")) {
+ proj <- add_umap(
+ proj,
+ embedding_name = paste0("LSI_", emb),
+ output_assay_name = paste0("UMAP_", emb),
+ min_dist = 0.8,
+ verbose = TRUE
+ )
+}
+## 2026-10-16 14:27:24 Extracting embedding 'LSI_ATAC'
+## 2026-10-16 14:27:24 Computing UMAP on 10010 cells with 29 dimensions
+## 14:27:24 Using HNSW for nearest neighbor search
+## 14:27:24 UMAP embedding parameters a = 0.2321 b = 1.681
+## 14:27:24 Setting random seed 1
+## 14:27:24 Read 10010 rows and found 29 numeric columns
+## 14:27:24 Building HNSW index with metric 'cosine' ef = 200 M = 16 using 1 threads
+## 14:27:25 Finished building index
+## 14:27:25 Searching HNSW index with ef = 40 and 4 threads
+## 14:27:25 Finished searching
+## 14:27:26 Commencing smooth kNN distance calibration using 4 threads with target n_neighbors = 40
+## 14:27:27 Initializing from normalized Laplacian + noise (using RSpectra)
+## 14:27:27 Range-scaling initial input columns to 0-10
+## 14:27:27 Commencing optimization for 500 epochs, with 586026 positive edges using 4 threads
+## 14:27:27 Using rng type: pcg
+## 14:27:30 Optimization finished
+## 2026-10-16 14:27:30 Added UMAP embedding as 'UMAP_ATAC' (2 components)
+## 2026-10-16 14:27:30 Extracting embedding 'LSI_RNA'
+## 2026-10-16 14:27:30 Computing UMAP on 10010 cells with 30 dimensions
+## 14:27:30 Using HNSW for nearest neighbor search
+## 14:27:30 UMAP embedding parameters a = 0.2321 b = 1.681
+## 14:27:30 Setting random seed 1
+## 14:27:30 Read 10010 rows and found 30 numeric columns
+## 14:27:30 Building HNSW index with metric 'cosine' ef = 200 M = 16 using 1 threads
+## 14:27:31 Finished building index
+## 14:27:31 Searching HNSW index with ef = 40 and 4 threads
+## 14:27:31 Finished searching
+## 14:27:32 Commencing smooth kNN distance calibration using 4 threads with target n_neighbors = 40
+## 14:27:33 Initializing from normalized Laplacian + noise (using RSpectra)
+## 14:27:33 Range-scaling initial input columns to 0-10
+## 14:27:33 Commencing optimization for 500 epochs, with 573228 positive edges using 4 threads
+## 14:27:33 Using rng type: pcg
+## 14:27:36 Optimization finished
+## 2026-10-16 14:27:36 Added UMAP embedding as 'UMAP_RNA' (2 components)
+## 2026-10-16 14:27:36 Extracting embedding 'LSI_Combined'
+## 2026-10-16 14:27:36 Computing UMAP on 10010 cells with 59 dimensions
+## 14:27:36 Using HNSW for nearest neighbor search
+## 14:27:36 UMAP embedding parameters a = 0.2321 b = 1.681
+## 14:27:36 Setting random seed 1
+## 14:27:36 Read 10010 rows and found 59 numeric columns
+## 14:27:36 Building HNSW index with metric 'cosine' ef = 200 M = 16 using 1 threads
+## 14:27:37 Finished building index
+## 14:27:37 Searching HNSW index with ef = 40 and 4 threads
+## 14:27:37 Finished searching
+## 14:27:38 Commencing smooth kNN distance calibration using 4 threads with target n_neighbors = 40
+## 14:27:39 Initializing from normalized Laplacian + noise (using RSpectra)
+## 14:27:39 Range-scaling initial input columns to 0-10
+## 14:27:39 Commencing optimization for 500 epochs, with 587204 positive edges using 4 threads
+## 14:27:39 Using rng type: pcg
+## 14:27:42 Optimization finished
+## 2026-10-16 14:27:42 Added UMAP embedding as 'UMAP_Combined' (2 components)
+All three embeddings, colored by the joint clusters:
+plot_embedding(proj, embedding = "UMAP_ATAC", title = "ATAC") +
+ plot_embedding(proj, embedding = "UMAP_RNA", title = "RNA") +
+ plot_embedding(proj, embedding = "UMAP_Combined", title = "Combined") +
+ patchwork::plot_layout(guides = "collect")
+