MarchR Multiome (ATAC + RNA) Tutorial
Eric Liu
marchr_multiome.RmdIntroduction
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.
Setup
First, load MarchR. If this fails, we recommend revisiting the MarchR installation instructions.
set_threads() sets a session-wide thread count for
operations that benefit from parallelization (Certain functions will
remain single-threaded).
set_threads(4)Output
## Set default MarchR threads to 4.Downloads, references and the project are kept in
cache_dir, so they persist across sessions and runs. To
keep the project in R’s temporary directory instead, set
project_dir <- file.path(tempdir(), "marchr_project").
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(cache_dir, "project")Download Data
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")
}Initialize a MarchRProject
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), overwrite = TRUE)
proj <- add_fragments(proj, frags, frags_name = "ATAC", dataset_name = sample_name)
projOutput
## MarchRProject Object
## Directory: ~/.cache/marchr_multiome/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 objectGenome Annotations
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)Quality Control
Filter cells on fragment count and TSS enrichment with
qc_fragments().
proj <- qc_fragments(proj, frags_name = "ATAC", n_frags = 1000, tss_enrichment = 4)Tile Matrix
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)Doublet Scoring and Filtering
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)Output
## 2026-12-04 01:56:26 Doublet scoring: 1 dataset, 13,164 cells, 4 threads
## [PBMC_10k]
## Simulated 65,000 doublets (1,000 x 65 trials)
## Iterative LSI: 13,164 cells, 2 iterations, 30 dims, 4 threads
## [Iteration 1/2]
## Selected 25,000 features (top accessible) [3.5s]
## Fit LSI on 10,000 cells [10.0s]
## 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
## Found 29 clusters, merged to 6 [2.0s]
## Pseudobulked 6 clusters [1.5s]
## Iteration finished [17.2s]
## [Iteration 2/2]
## Selected 25,000 variable features [0.6s]
## Fit LSI on 13,164 cells [10.1s]
## Iteration finished [10.8s]
## Iterative LSI finished [28.2s]: 13,164 x 30 embedding
## Projected 65,000 doublets into LSI [57.9s]
## Fit UMAP, re-projection R^2 = 0.902 [8.4s]
## Projected 65,000 doublets into UMAP [4.1s]
## Scored 13,164 cells by doublet neighbors in UMAP [2.3s]
## Dataset finished [102.2s]
## 2026-12-04 01:58:04 Doublet scoring finished [102.2s]: added doublet scores to 1 dataset (13,164 cells)
## 2026-12-04 01:58:04 Doublet filtering: 1 dataset, 13,164 cells (enrichment >= 1, filter ratio 1)
## PBMC_10k: removed 1,732 of 13,164 cells (13.2%) [1.5s]
## 2026-12-04 01:58:05 Doublet filtering finished [1.5s]: removed 1,732 of 13,164 cells (13.2%), cleared doublet dataImport RNA
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, verbose = TRUE)
proj <- align_cells(proj)
head(get_feature_metadata(proj, assay_names = "GeneExpressionMatrix"))Output
## 2026-12-04 01:58:05 Feature import: 'pbmc_10k_filtered_feature_bc_matrix.h5' (Gene Expression) into 'PBMC_10k'
## Matched 10,010 barcodes, dropped 1,422 ATAC-only and 2,002 RNA-only cells
## 2026-12-04 01:58:08 Feature import finished [2.4s]: added assay 'GeneExpressionMatrix' (36,601 features x 10,010 cells), feature metadata 'gene_symbol'
## 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 GeneExpressionMatrixIterative LSI
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
)Output
## 2026-12-04 01:58:08 Iterative LSI: 10,010 cells, 2 iterations, 30 dims, 4 threads
## [Iteration 1/2]
## Selected 25,000 features (top accessible) [3.4s]
## Fit LSI on 9,599 cells, projected 401 depth outliers [17.5s]
## Dropped LSI component 1 (r = 0.95 with log10(nFrags))
## 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
## Found 22 clusters, merged to 6 [1.5s]
## Pseudobulked 6 clusters [2.1s]
## Iteration finished [24.5s]
## [Iteration 2/2]
## Selected 25,000 variable features [0.3s]
## Fit LSI on 9,608 cells, projected 402 depth outliers [10.5s]
## Dropped LSI component 1 (r = 0.96 with log10(nFrags))
## Iteration finished [11.1s]
## 2026-12-04 01:58:43 Iterative LSI finished [36.8s]: added dim reduction 'LSI_ATAC' (10,010 x 29)
## 2026-12-04 01:58:43 Iterative LSI: 10,010 cells, 2 iterations, 30 dims, 4 threads
## [Iteration 1/2]
## Selected 2,500 variable features [24.4s]
## Fit LSI on 9,598 cells, projected 402 depth outliers [10.8s]
## Found 27 clusters, merged to 6 [1.7s]
## Pseudobulked 6 clusters [3.1s]
## Iteration finished [40.1s]
## [Iteration 2/2]
## Selected 2,500 variable features [0.0s]
## Fit LSI on 9,608 cells, projected 402 depth outliers [52.7s]
## Iteration finished [52.7s]
## 2026-12-04 02:00:35 Iterative LSI finished [117.5s]: added dim reduction 'LSI_RNA' (10,010 x 30)Combining Modalities
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"
)Clustering
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)Output
## 2026-12-04 02:00:36 Clustering: 10,010 cells on 'LSI_Combined' (59 dims)
## 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 [2.8s]
## 2026-12-04 02:00:38 Clustering finished [2.8s]: added cell metadata column 'clusters' (16 clusters)
##
## 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 164UMAP Embedding
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
)
}Output
## 2026-12-04 02:00:38 UMAP: 10,010 cells on 'LSI_ATAC' (29 dims), 4 threads
## Fit 2D UMAP (40 neighbors, min_dist 0.8, cosine) [5.9s]
## Saved UMAP model [0.2s]
## 2026-12-04 02:00:45 UMAP finished [6.1s]: added cell metadata columns 'UMAP_ATAC_1', 'UMAP_ATAC_2', embedding model 'UMAP_ATAC'
## 2026-12-04 02:00:45 UMAP: 10,010 cells on 'LSI_RNA' (30 dims), 4 threads
## Fit 2D UMAP (40 neighbors, min_dist 0.8, cosine) [5.5s]
## Saved UMAP model [0.2s]
## 2026-12-04 02:00:49 UMAP finished [5.7s]: added cell metadata columns 'UMAP_RNA_1', 'UMAP_RNA_2', embedding model 'UMAP_RNA'
## 2026-12-04 02:00:49 UMAP: 10,010 cells on 'LSI_Combined' (59 dims), 4 threads
## Fit 2D UMAP (40 neighbors, min_dist 0.8, cosine) [5.8s]
## Saved UMAP model [0.2s]
## 2026-12-04 02:00:55 UMAP finished [6.0s]: added cell metadata columns 'UMAP_Combined_1', 'UMAP_Combined_2', embedding model 'UMAP_Combined'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")