Cluster replicability in single-cell and single-nucleus atlases of the mouse brain.
The 18 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § Results › Characterization of the reciprocal best hit cluster pairs ↔ R/Figure_3_examine_MERFISH_calls_for_recips.R, lines 145–218 · score 0.79 · Reproducible cell calls, detected reciprocally, diversity mismatch, clusters detected, posterior, cells mapped
- [2] § Results › Characterization of the reciprocal best hit cluster pairs ↔ R/Figure_3_examine_MERFISH_calls_for_recips.R, lines 145–218 · score 0.76 · reciprocal best hit, diversity mismatch, clusters detected, MERFISH cells, posterior, anterior
- [3] § Methods › MERFISH spatial data ↔ R/centroid_correlations.bigcat.R, lines 1–40 · score 0.76 · scrattch.bigcat, MERFISH C57BL6J, log2, Allen, centroids, correlated
- [4] § Results › Replicability of reciprocal clusters in additional mouse brain datasets ↔ R/examine_barseq_pretrained_results.R, lines 61–148 · score 0.75 · odds ratios, Slide seq, BARseq, reciprocal pair, CC, abbreviations
- [5] § Results › Replicability of reciprocal clusters in additional mouse brain datasets ↔ R/examine_barseq_pretrained_results.R, lines 61–148 · score 0.73 · odds ratio, Slide seq, BARseq clusters, CTX, pretrained, MERFISH
- [6] § Methods › Gene Ontology gene sets ↔ R/Figure_4_coordinated_expression_GO.R, lines 61–134 · score 0.72 · SynGO, 15–150, Ontology, mm, filtered, Gene
- [7] § Results › Evolutionary conservation of reciprocal clusters ↔ R/Figure_5_get_cross_species_results.R, lines 42–79 · score 0.68 · progenitor cells, cross species, reciprocal hit, evolutionary, coarse, conservation
- [8] § Methods › MERFISH spatial data ↔ R/Figure_3_examine_MERFISH_calls_for_recips.R, lines 1–45 · score 0.65 · MERFISH C57BL6J, space, bigcat, threshold, Allen, centroids
- [9] § Results › Evolutionary conservation of reciprocal clusters ↔ R/Figure_5_plot_boxplot_clustergraph.R, lines 47–129 · score 0.65 · cross species, MetaNeighbor, reciprocal hit, progenitor, evolutionary, distance
- [10] § Results › Replicability of reciprocal clusters in additional mouse brain datasets ↔ R/Figure_5_plot_boxplot_clustergraph.R, lines 47–129 · score 0.61 · clusters mapping, MetaNeighbor, CGE, MGE, Boxplots, Evolutionary
- [11] § Results › MetaNeighbor reveals cross-atlas cluster relationships ↔ python_notebooks/retina_split_half/compare_split_halves.R, the whole file · a weak match · score 0.59 · split half, split halves, reciprocal top hits, retina, HVG, match
- [12] § Results › Coordinated gene expression across the matched clusters ↔ R/Figure_4_coordinated_expression_GO.R, lines 61–134 · score 0.59 · gene expression correlation, SynGO annotated, HVG, Figure 4, matched, reciprocal
- [13] § Results › Coordinated gene expression across the matched clusters ↔ R/Figure_1_centroid_expression.R, lines 86–124 · score 0.57 · expression centroids, genome wide, Spearman correlation, cell
- [14] § Methods › Integration results from other studies ↔ R/Figure_1_and_2_compare_other_mappings.R, lines 45–92 · score 0.56 · AIBS_cluster_id, transfer, RNA, mappings, score, Matched
- [15] § Results › While effective in the whole brain context, marker genes do not separate similar clusters ↔ R/Figure_1_and_2_compare_other_mappings.R, lines 45–92 · score 0.55 · scRNA, snATAC, seq, median, mouse brain, mapped
- [16] § Results › Replicability of reciprocal clusters in additional mouse brain datasets ↔ R/run_on_barseq_pretrained.R, lines 41–124 · score 0.52 · BARseq, pretrained models, fast, mouse brain, single nucleus, cross
- [17] § Methods › Single-nucleus expression data ↔ R/Figure_1_and_2_compare_other_mappings.R, lines 142–199 · score 0.52 · braincelldata.org, Slide seq, nucleus, mice
- [18] § Results › MetaNeighbor reveals cross-atlas cluster relationships ↔ R/run_mix_HVG.R, the whole file · a weak match · score 0.52 · memory limits, Seurat, MixHVG, subset, genes, cells
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 442 lines · 26 KB · MIT · 3 matches
- library(tidyr)
- library(dplyr)
- library(ggplot2)
- library(readr)
- library(here)
- library(magrittr)
- library(conflicted)
- conflict_prefer("first", "dplyr")
- conflict_prefer("rename", "dplyr")
- conflict_prefer("select", "dplyr")
- conflict_prefer("filter", "dplyr")
- conflict_prefer("count", "dplyr")
- conflicts_prefer(base::union)
- base_folder <- here("results/full_run_ZengAWS.1698256033/") #updated Allen data - 2009 recips
- h5ad_base <- read_csv(here("results", "MERFISH500", "H5ad_calls.csv.gz")) #written out by centroid_correlations.bigcat.R
- h5ad_base %<>% mutate(slice = as.numeric(gsub(".*[.]", "", brain_section_label)))
- h5ad_base
- #uncomment/comment the below lines to generate data for the different top hit sets
- top_hits <- read_csv(paste0(base_folder, "top_hits.0.95.csv"))
- #top_hits <- read_csv(paste0(base_folder, "top_hits_asymmetric.0.99.best_vs_next.0.6.filtered.csv"))
- #Zeng_markers_on_Macosko_one_to_one_mapping.csv
- #top_hits <- read_csv(here("results/marker_results/Top_hit_format_for_Zeng_markers_on_Macosko_one_to_one_mapping.csv"))
- if ("...1" %in% colnames(top_hits)) { top_hits %<>% select(-`...1`) }
- top_hits %<>% rowwise() %>% mutate(first = sort(c(`Study_ID|Celltype_1`, `Study_ID|Celltype_2`))[2],
- second = sort(c(`Study_ID|Celltype_1`, `Study_ID|Celltype_2`))[1])
- top_hits %<>% mutate(`Study_ID|Celltype_1` = first, `Study_ID|Celltype_2` = second)
- top_hits %<>% select(-first, -second)
- top_hits %>% group_by(Match_type) %>% count()
- top_hits %<>% filter(Match_type == "Reciprocal_top_hit")
- top_hits %>% nrow()
- top_hits %<>% mutate(merged_name = paste0(`Study_ID|Celltype_1`, "__", `Study_ID|Celltype_2`))
- Zeng_calls_direct <- read_csv(here("data","whole_mouse_brain", "zeng", "MERFISH-C57BL6J-638850", "20230830", "cell_metadata.csv"))
- Zeng_calls_direct %>% pull(cluster_alias) %>% max() #confirm it's in the cl ID space
- Zeng_calls_direct %<>% mutate(cluster_alias = as.character(cluster_alias))
- Zeng_calls_direct %>% pull(cluster_alias) %>% unique() %>% length()
- Zeng_calls_direct %>% pull(average_correlation_score) %>% min() #confirm the threshold
- Zeng_calls_direct %<>% mutate(cluster_alias = paste0("Zeng|", cluster_alias))
- Zeng_calls_direct %<>% left_join(top_hits %>% select(cluster_alias = `Study_ID|Celltype_1`, merged_name))
- #add in merged name
- Zeng_calls_direct %<>% select(cell_label, x, y, z, Celltype_Zeng = cluster_alias, Zeng_merged_name = merged_name)
- #join with h5ad to cover all cells
- joined <- left_join(h5ad_base, Zeng_calls_direct)
- Macosko_calls_direct <- read_csv(here("results/MERFISH500/Macosko_predictions/joined_scores.df.full.csv"))
- Macosko_calls_direct %>% pull(prob) %>% min()
- Macosko_calls_direct %<>% filter(average_correlation_score > 0.5) #mirroring the Zeng threshold
- Macosko_calls_direct %>% pull(prob) %>% min()
- Macosko_calls_direct %>% pull(prob) %>% hist()
- Macosko_calls_direct %>% pull(average_correlation_score) %>% min()
- Macosko_calls_direct %<>% rename(cell_label = cell_id)
- Macosko_calls_direct %<>%
- separate(pred.cl, into = c("id", "Celltype_Macosko"), sep = "=")
- Macosko_calls_direct %<>% mutate(Celltype_Macosko = paste0("Macosko|", Celltype_Macosko))
- Macosko_calls_direct %<>% left_join(top_hits %>% select(Celltype_Macosko = `Study_ID|Celltype_2`, merged_name))
- Macosko_calls_direct %>% filter(!is.na(merged_name))
- Macosko_calls_direct %<>% select(cell_label, Celltype_Macosko, Macosko_merged_name = merged_name)
- joined <- left_join(joined, Macosko_calls_direct)
- joined %>% group_by(Zeng_merged_name == Macosko_merged_name) %>% count()
- joined %>% pull(Celltype_Macosko) %>% unique() %>% length()
- joined %>% pull(Celltype_Zeng) %>% unique() %>% length()
- joined %>% filter(!is.na(Celltype_Zeng)) %>% nrow()
- joined %>% filter(!is.na(Celltype_Macosko)) %>% nrow()
- #add in CCF annotations from the API
- ccf_annotations <- read_csv(here("data", "whole_mouse_brain", "zeng", "from_API", "ccf_coordinates_MERFISH-C57BL6J-638850.csv.gz"))
- base::intersect(joined$cell_label, ccf_annotations$cell_label) %>% length()
- ccf_annotations %>% group_by(parcellation_category) %>% count() %>% arrange(-n)
- ccf_annotations %>% group_by(parcellation_division) %>% count() %>% arrange(-n) %>% as.data.frame()
- ccf_annotations %>% group_by(parcellation_division, parcellation_category) %>% count() %>% arrange(-n) %>% as.data.frame()
- ccf_annotations %>% group_by(parcellation_division, parcellation_division_color, parcellation_category) %>% count() %>% arrange(-n) %>% as.data.frame()
- #group annotations with same color
- ccf_annotations %<>% mutate(parcellation_division_remap = parcellation_division)
- #VS is ventricular systems
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(parcellation_category == "VS", "VS", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(parcellation_category == "fiber tracts", "fiber tracts", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(parcellation_category == "brain-unassigned", "unassigned", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_color = if_else(parcellation_category == "brain-unassigned", "#000000", parcellation_division_color))
- #manual mapping to match up with disscetion regions
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(grepl("^ACA", parcellation_structure), "ACA", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(grepl("^RSP", parcellation_structure), "RSP", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(grepl("^AUD", parcellation_structure), "AUD", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(grepl("^ENT", parcellation_structure), "ENT", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else("MOp" == parcellation_structure, "MOp", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else("SUB" == parcellation_structure, "SUB", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(grepl("^SSp", parcellation_structure), "S1", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(grepl("^VIS", parcellation_structure), "VIS", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else("VISp" == parcellation_structure, "VISP", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else("MY" == parcellation_division, "BS", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else("P" == parcellation_division, "BS", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(parcellation_division == "STR"& parcellation_structure %in% c("LSc","LSr","LSv","SF","SH"),
- "LSX", parcellation_division_remap))
- ccf_annotations %<>% mutate(parcellation_division_remap = if_else(parcellation_division == "STR"& parcellation_structure %in% c("CP"),
- "STRd", parcellation_division_remap))
- ccf_annotations %>% group_by(parcellation_division, parcellation_division_color, parcellation_category, parcellation_division_remap) %>% count() %>% arrange(-n) %>% as.data.frame()
- ccf_annotations %>% group_by(parcellation_division_color, parcellation_division_remap) %>% count() %>% arrange(-n) %>% as.data.frame()
- colnames(ccf_annotations)
- joined %<>% left_join(ccf_annotations)
- #write out for Figure_3_examine_MERFISH_recip_centroids.R - could be reduced in size by filtering NA's
- joined %>% write_csv(paste0(base_folder, "spatial_per_cell_data.", top_hits %>% nrow(), "_pairs.csv.gz"))
- joined %<>% mutate(matching_reciprocal = Zeng_merged_name == Macosko_merged_name)
- joined %>% pull(matching_reciprocal) %>% sum(na.rm=T)
- joined %>% filter(matching_reciprocal) %>% group_by(Macosko_merged_name) %>% count() %>% arrange(-n)
- joined %>% group_by(is.na(parcellation_index), matching_reciprocal) %>% count()
- #this is filtered on the Zeng side
- slice_summary <- joined %>% group_by(slice) %>% summarize(total_cells = n(),
- Zeng_calls = sum(!is.na(Celltype_Zeng))/total_cells,
- Mac_calls = sum(!is.na(Celltype_Macosko))/total_cells,
- Zeng_recip_calls = sum(!is.na(Zeng_merged_name))/total_cells,
- Mac_recip_calls = sum(!is.na(Macosko_merged_name))/total_cells,
- matching_reciprocal = sum(matching_reciprocal, na.rm=T)/total_cells,
- unique_merged_names = na.omit(union(Zeng_merged_name, Macosko_merged_name)) %>% unique() %>% length(),
- unique_clusters_all = na.omit(union(Celltype_Zeng, Celltype_Macosko)) %>% unique() %>% length(),
- proportion_merged_names = unique_merged_names/na.omit(union(joined$Zeng_merged_name, joined$Macosko_merged_name)) %>% unique() %>% length(),
- proportion_clusters_seen = unique_clusters_all/na.omit(union(joined$Celltype_Zeng, joined$Celltype_Macosko)) %>% unique() %>% length()
- )
- cor.test(slice_summary$proportion_clusters_seen, slice_summary$proportion_merged_names) #0.96 correlation
- cor.test(slice_summary$proportion_clusters_seen, slice_summary$matching_reciprocal, m='s') #0.5 correlation
- #write out
- slice_summary %>% select(slice, total_cells, proportion_Zeng_recip_calls = Zeng_recip_calls, proportion_Mac_recip_calls = Mac_recip_calls, cells_with_matching_reciprocal_calls = matching_reciprocal,
- detected_reciprocal_clusters = unique_merged_names, proportion_of_all_reciprocals = proportion_merged_names) %>% write_csv(paste0(base_folder, "spatial_slice_stats.", top_hits %>% nrow(), "_pairs.csv"))
- correlation <- cor(slice_summary$unique_clusters_all, slice_summary$matching_reciprocal,m='s')
- for_line_plot <- slice_summary %>% select(slice,matching_reciprocal,proportion_clusters_seen) %>% pivot_longer(cols=c(matching_reciprocal, proportion_clusters_seen))
- for_line_plot %<>% mutate(name = if_else(name == "matching_reciprocal", "MERFISH cells mapped to reciprocal pairs","Clusters detected"))
- for_line_plot %<>% mutate(slice_factor = factor(slice, levels = for_line_plot %>% pull(slice) %>% unique() %>% sort(decreasing = T)))
- for_line_plot %<>% mutate(slice_numeric = as.numeric(slice_factor))
- target_slices <- for_line_plot %>% filter(slice_factor %in% c(14, 24, 40, 60)) %>% pull(slice_factor) %>% unique()
- target_slices_numeric <- for_line_plot %>% filter(slice_factor %in% c(14, 24, 40, 60)) %>% pull(slice_numeric) %>% unique()
- pdf(paste0(base_folder, "spatial_slice_stats.", top_hits %>% nrow(), "_pairs.pdf"), height=5, width = 11)
- ggplot(data= for_line_plot, aes(x=slice_numeric, y=value, color = name)) +
- #geom_vline(xintercept = target_slices_numeric, color="darkgray") +
- geom_line() + geom_point() +
- theme_bw() + theme(legend.position = "right") + labs(color="") + ylab("Proportion") +
- xlab("Slice") + scale_x_continuous(labels = c("Anterior", "Posterior"), breaks = c(1,59)) +
- annotate("text",
- x = 1,
- y = 0.6,
- label = paste0("r: ", correlation %>% format(digits = 2)),
- hjust = 0,
- vjust = 1
- ) + scale_color_manual(values=c("#795695", "#f2ba88"))
- dev.off()
- for_line_plot %>% write_csv(paste0(base_folder, "/figure_source_data_files/Figure_3d.csv"))
- #split by the two datasets
- total_Zeng <- joined$Celltype_Zeng %>% unique() %>% length()
- total_Mac <- joined$Celltype_Macosko %>% unique() %>% length()
- #need to set some Zeng cell types to NA to match size
- joined_cell_count_matched <- joined
- joined_cell_count_matched %<>% select(cell_label, slice, Celltype_Zeng, Celltype_Macosko)
- IDs_to_remove_calls <- joined_cell_count_matched %>% filter(!is.na(Celltype_Zeng)) %>% sample_n(joined_cell_count_matched %>% filter(!is.na(Celltype_Macosko)) %>% nrow()) %>% pull(cell_label)
- joined_cell_count_matched %<>% mutate(Celltype_Zeng = if_else(cell_label %in% IDs_to_remove_calls, Celltype_Zeng, NA))
- joined_cell_count_matched %>% group_by(!is.na(Celltype_Zeng)) %>% count()
- joined_cell_count_matched %>% group_by(!is.na(Celltype_Macosko)) %>% count()
- #need to match the same number of cells for Zeng as Macosko
- slice_summary_extra_counts <- joined_cell_count_matched %>% group_by(slice) %>% summarize(
- unique_clusters_Zeng = na.omit(Celltype_Zeng) %>% unique() %>% length(),
- unique_clusters_Mac = na.omit(Celltype_Macosko) %>% unique() %>% length(),
- value = unique_clusters_Zeng/total_Zeng,
- unique_clusters_Mac_prop = unique_clusters_Mac/total_Mac,
- detected_cluster_difference = unique_clusters_Zeng - unique_clusters_Mac
- )
- cor.test(slice_summary_extra_counts$unique_clusters_Mac, slice_summary_extra_counts$unique_clusters_Zeng,m='s')
- #add in reciprocal best hits
- slice_summary_extra_counts %<>% inner_join(slice_summary %>% select(slice, matching_reciprocal))
- cor.test(slice_summary_extra_counts$detected_cluster_difference, slice_summary_extra_counts$matching_reciprocal, m='s')
- cor.test(slice_summary_extra_counts$unique_clusters_Zeng, slice_summary_extra_counts$matching_reciprocal, m='s')
- cor.test(slice_summary_extra_counts$unique_clusters_Mac, slice_summary_extra_counts$matching_reciprocal, m='s')
- plot(slice_summary_extra_counts$detected_cluster_difference, slice_summary_extra_counts$matching_reciprocal, m='s')
- correlation <- cor(slice_summary_extra_counts$detected_cluster_difference, slice_summary_extra_counts$matching_reciprocal, m='s')
- pdf(paste0(base_folder, "spatial_cluster_count_vs_recips.pdf"), height=5, width = 5)
- ggplot(data = slice_summary_extra_counts, aes(x = detected_cluster_difference, y = matching_reciprocal)) +
- geom_point() + theme_bw() +
- xlab("Diversity mismatch\n(excess clusters detected in cells vs. nuclei derived mappings)") +
- ylab("Reproducable cell calls\n(proportion of cells with matching reciprocal status)") +
- annotate("text",
- x = 700,
- y = 0.45,
- label = paste0("r: ", correlation %>% format(digits = 2)),
- hjust = 0,
- vjust = 1
- )
- dev.off()
- slice_summary_extra_counts %>% write_csv(paste0(base_folder, "/figure_source_data_files/Figure_3e.csv"))
- #it would be better if we had x y z for all cells - missing 394k that weren't mapped in Zeng
- joined %>% filter(is.na(x)) %>% nrow()
- for_plot <- joined %>% filter(!is.na(x)) %>% select(cell_label, x, y, Celltype_Macosko, Celltype_Zeng, Zeng_merged_name, Macosko_merged_name, slice, matching_reciprocal)
- # Plot one reciprocal
- for_plot %<>% filter(slice %in% c(18,19))
- for_plot %<>% mutate(slice = paste0("Slice ", slice))
- for_plot %>% filter(Zeng_merged_name == "Zeng|2670__Macosko|CholEx_Tcf24_Oxtr")
- #find small set of cells with recip match
- #CholEx_Tcf24_Oxtr
- joined %>% filter(Celltype_Macosko == "Macosko|CholEx_Tcf24_Oxtr") %>% pull(Zeng_merged_name) %>% length()
- joined %>% filter(Celltype_Macosko == "Macosko|CholEx_Tcf24_Oxtr") %>% group_by(Celltype_Zeng) %>% count()
- joined %>% filter(Celltype_Macosko == "Macosko|CholEx_Tcf24_Oxtr") %>% group_by(slice) %>% count()
- joined %>% filter(Zeng_merged_name == "Zeng|2670__Macosko|CholEx_Tcf24_Oxtr")%>% group_by(slice) %>% count()
- joined %>% filter(Celltype_Zeng == "Zeng|2670") %>% group_by(Celltype_Zeng) %>% count()
- pdf(paste0(base_folder, "spatial_CholEx_Tcf24_Oxtr.pdf"), height=5, width = 10)
- ggplot(data = for_plot, aes(x=x, y=-1*y)) + geom_point(size=.03, color ="gray90") + theme_classic() +
- #geom_point(data = for_plot %>% filter(Celltype_Macosko == "Macosko|CholEx_Tcf24_Oxtr", Zeng_merged_name != "Zeng|2670__Macosko|CholEx_Tcf24_Oxtr"), size = 0.7, color="#E21E25") + #c("#4450A2", "#E21E25"))
- geom_point(data = for_plot %>% filter(Zeng_merged_name == "Zeng|2670__Macosko|CholEx_Tcf24_Oxtr"), size = 0.9, color="black") +
- geom_point(data = for_plot %>% filter(Celltype_Zeng == "Zeng|2670", is.na(Celltype_Macosko) | Celltype_Macosko != "Macosko|CholEx_Tcf24_Oxtr"), size = 0.9, color="#4450A2") + #c("#4450A2", "#E21E25"))
- coord_equal() + theme(legend.position="none") +
- facet_wrap(. ~ slice) +
- theme(axis.title.x=element_blank(),
- axis.text.x=element_blank(),
- axis.ticks.x=element_blank()) +
- theme(axis.title.y=element_blank(),
- axis.text.y=element_blank(),
- axis.ticks.y=element_blank()) +
- theme(
- axis.line = element_line(color = 'white'),
- plot.background = element_blank(),
- panel.grid.minor = element_blank(),
- panel.grid.major = element_blank(),
- panel.border = element_blank()
- )
- dev.off()
- #Figure 5 plotting three clusters that lined up with the BARseq data. The Macosko data is pulled manually from the website.
- for_plot <- joined %>% filter(!is.na(x)) %>% select(cell_label, x, y, Celltype_Macosko, Celltype_Zeng, Zeng_merged_name, Macosko_merged_name, slice, matching_reciprocal)
- target_clusters_for_pdf <- c("2866", "5231", "4218")
- target_cluster <- "4218"
- target_cluster <- paste0("Zeng|", target_cluster)
- max_slice <- for_plot %>% filter(Celltype_Zeng == target_cluster) %>% group_by(slice) %>% count() %>% ungroup() %>% slice_max(n) %>% pull(slice)
- if (target_cluster == "Zeng|4218") { max_slice <- 24 } #this slice best fits the barseq
- if (target_cluster == "Zeng|5231") { max_slice <- 30 } #this slice best fits the barseq
- pdf(paste0(base_folder, "spatial_", target_cluster,"_slice_", max_slice,".pdf"), height=5, width = 6)
- for_plot <- joined %>% filter(!is.na(x)) %>% select(cell_label, x, y, Celltype_Macosko, Celltype_Zeng, Zeng_merged_name, Macosko_merged_name, slice, matching_reciprocal)
- for_plot %<>% filter(slice == max_slice)
- ggplot(data = for_plot, aes(x=x, y=-1*y)) + geom_point(size=.03, color ="gray90") + theme_classic() +
- geom_point(data = for_plot %>% filter(Celltype_Zeng == target_cluster), size = 0.15, color="#4450A2") +
- coord_equal() + theme(legend.position="none") +
- theme(axis.title.x=element_blank(),
- axis.text.x=element_blank(),
- axis.ticks.x=element_blank()) +
- theme(axis.title.y=element_blank(),
- axis.text.y=element_blank(),
- axis.ticks.y=element_blank()) +
- theme(
- axis.line = element_line(color = 'white'),
- plot.background = element_blank(),
- panel.grid.minor = element_blank(),
- panel.grid.major = element_blank(),
- panel.border = element_blank()
- )
- dev.off()
- ## plot the reciprocal hit cells
- for_plot <- joined %>% filter(!is.na(x)) %>% select(cell_label, x, y, Zeng_merged_name, Macosko_merged_name, slice, matching_reciprocal, parcellation_division_remap, parcellation_division_color)
- #convert na's to unassigned
- for_plot %<>% mutate(parcellation_division_remap = if_else(is.na(parcellation_division_remap), "unassigned", parcellation_division_remap))
- for_plot %<>% mutate(parcellation_division_color = if_else(is.na(parcellation_division_color), "#000000", parcellation_division_color))
- set.seed(42)
- for_plot %>% filter(slice == 40) %>% group_by(matching_reciprocal) %>% count()
- #target_slices <- c(14, 24, 40, 60)
- #target_slices <- c("46", '45', '43', '42' ,"40", '39','38', "37")
- for_plot %<>% filter(slice %in% target_slices)
- for_plot %>% pull(slice) %>% unique() %>% length()
- for_plot %<>% mutate(slice_factor = factor(slice, levels = for_plot %>% pull(slice) %>% unique() %>% sort(decreasing = T)))
- for_plot %<>% mutate(matching_reciprocal = if_else(is.na(matching_reciprocal), FALSE, matching_reciprocal))
- pdf(paste0(base_folder, "spatial_four_recips.", top_hits %>% nrow(), "_pairs.pdf"), height=7, width = 30)
- ggplot(data = for_plot, aes(x = x, y = -1 * y, color = factor(matching_reciprocal))) +
- geom_point(size=.02) +
- geom_point(data = for_plot %>% filter(matching_reciprocal), size = 0.02, color="black") +
- theme_classic() +
- coord_equal() +
- facet_wrap(. ~ slice_factor, nrow = 1) +
- theme(
- axis.title.x = element_blank(),
- axis.text.x = element_blank(),
- axis.ticks.x = element_blank(),
- axis.title.y = element_blank(),
- axis.text.y = element_blank(),
- axis.ticks.y = element_blank(),
- axis.line = element_line(color = 'white'),
- plot.background = element_blank(),
- panel.grid.minor = element_blank(),
- panel.grid.major = element_blank(),
- panel.border = element_blank()
- ) +
- scale_color_manual(
- values = c("gray", "black"),
- labels = c("Non-matching", "Matching"),
- name = "Reciprocal status",
- guide = guide_legend(override.aes = list(size = 5))
- )
- dev.off()
- #Coarse region atlas color
- for_plot %<>% filter(!parcellation_division_remap %in% c("fiber tracts", "unassigned", "VS"))
- region_colors <- for_plot %>% select(parcellation_division_remap, parcellation_division_color) %>% distinct() %>% as.data.frame()
- #division colored, all points with data
- pdf(paste0(base_folder, "MERFISH_colored_divsions.pdf"), height=7, width = 30)
- ggplot(data = for_plot, aes(x = x, y = -1 * y, color = parcellation_division_color)) +
- geom_point(size = 0.02) +
- scale_color_identity(
- name = "Structure",
- labels = region_colors$parcellation_division_remap,
- breaks = region_colors$parcellation_division_color,
- guide = guide_legend(override.aes = list(size = 5))
- #guide = 'legend'
- ) +
- coord_equal() +
- theme_classic() +
- facet_wrap(. ~ slice_factor, nrow = 1) +
- theme(
- axis.title.x = element_blank(),
- axis.text.x = element_blank(),
- axis.ticks.x = element_blank(),
- axis.title.y = element_blank(),
- axis.text.y = element_blank(),
- axis.ticks.y = element_blank(),
- axis.line = element_line(color = 'white'),
- plot.background = element_blank(),
- panel.grid.minor = element_blank(),
- panel.grid.major = element_blank(),
- panel.border = element_blank()
- )
- dev.off()
- ################################
- ################################
- #cut up into bins for heatmap view
- ################################
- ################################
- for_plot <- joined %>% filter(!is.na(x)) %>% select(cell_label, x, y, slice, matching_reciprocal)
- for_plot %>% pull(x) %>% range()
- for_plot %>% pull(y) %>% range()
- ratio <- (max(for_plot %>% pull(y)) - min(for_plot %>% pull(y)))/(max(for_plot %>% pull(x)) - min(for_plot %>% pull(x)))
- x_bins = 110
- y_bins = round(x_bins * ratio)
- for_plot %<>% mutate(bin_x = cut_interval(x, n = x_bins))
- for_plot %<>% mutate(bin_y = cut_interval(-1*y, n = y_bins))
- for_plot %<>% group_by(bin_x, bin_y, slice) %>% summarize(n=n(), prop_recip = sum(matching_reciprocal, na.rm=T)/n())
- for_plot %<>% filter(slice %in% target_slices)
- for_plot %<>% mutate(slice_factor = factor(slice, levels = for_plot %>% pull(slice) %>% unique() %>% sort(decreasing = T)))
- pdf(paste0(base_folder, "spatial_four_recips_proportions.", top_hits %>% nrow(), "_pairs.pdf"), height=7, width = 32)
- ggplot(data=for_plot, aes(x=bin_x, y=bin_y, fill = prop_recip) ) +
- geom_tile() + scale_fill_continuous(type = "viridis", na.value='white') + theme_bw() +
- labs(fill = "P(reciprocal match)") + coord_equal(expand=FALSE) +
- theme(axis.title.x=element_blank(),
- axis.text.x=element_blank(),
- axis.ticks.x=element_blank()) +
- theme(axis.title.y=element_blank(),
- axis.text.y=element_blank(),
- axis.ticks.y=element_blank()) +
- theme(
- axis.line = element_line(color = 'white'),
- plot.background = element_blank(),
- panel.grid.minor = element_blank(),
- panel.grid.major = element_blank(),
- panel.border = element_blank()
- ) + facet_wrap(.~slice_factor, nrow=1)
- dev.off()
- ##########################
- #test enrichment by coarse region
- ###########################
- joined %<>% mutate(matching_reciprocal = if_else(is.na(matching_reciprocal), FALSE, matching_reciprocal))
- whole_dataset <- joined %>% group_by(matching_reciprocal) %>% count()
- whole_dataset %<>% pivot_wider(names_from=matching_reciprocal, values_from=n, names_prefix = "dataset_recip_hit_")
- by_region <- joined %>% mutate(parcellation_division_remap = if_else(is.na(parcellation_division_remap), "unassigned", parcellation_division_remap)) %>%
- group_by(parcellation_division_remap, matching_reciprocal) %>% count()
- by_region %<>% pivot_wider(names_from=matching_reciprocal, values_from=n, names_prefix = "recip_hit_")
- by_region %<>% mutate(dataset_recip_hit_FALSE = whole_dataset %>% pull(dataset_recip_hit_FALSE))
- by_region %<>% mutate(dataset_recip_hit_TRUE = whole_dataset %>% pull(dataset_recip_hit_TRUE))
- by_region %<>% mutate(total_cells_in_region = recip_hit_TRUE + recip_hit_FALSE)
- by_region %<>% mutate(percent_recip = recip_hit_TRUE / total_cells_in_region)
- by_region %<>% ungroup() %>% mutate(dataset_total_cells = sum(total_cells_in_region))
- by_region %<>% mutate(dataset_prop_recip = dataset_recip_hit_TRUE/ dataset_total_cells)
- #duplicaed code from regional_enrichment_tests
- by_region %<>% mutate(p_enriched = phyper(recip_hit_TRUE, dataset_recip_hit_TRUE, dataset_recip_hit_FALSE, total_cells_in_region, lower.tail = FALSE) +
- dhyper(recip_hit_TRUE, dataset_recip_hit_TRUE, dataset_recip_hit_FALSE, total_cells_in_region))
- by_region %<>% mutate(p_depleted = phyper(recip_hit_TRUE, dataset_recip_hit_TRUE, dataset_recip_hit_FALSE, total_cells_in_region, lower.tail = TRUE))
- by_region %<>% mutate(difference_from_dataset_average = percent_recip-dataset_prop_recip)
- by_region %>% as.data.frame()
- by_region %<>% mutate(Dataset= "MERFISH")
- by_region %<>% mutate(fold_change = percent_recip/dataset_prop_recip) #not used
- by_region %<>% ungroup()
- dir.create(here(base_folder, "top_hit_enrichments"))
- #used for plotting in regional_enrichment_tests.R
- by_region %>% write_csv(here(base_folder, "top_hit_enrichments", paste0("MERFISH_regional_enrichment_results.", top_hits %>% nrow(), "_pairs.csv")))
Figure_3_examine_MERFISH_calls_for_recips.R at commit 36d803e, under MIT · at the source
Overview
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repositories
Its files are read in the Code ↔ Paper reader above, with 18 matches between paragraphs and lines of code.
gillislab/mouse_brain_cluster_replicability
36d803ebff43d0df95c01c94a7d832f15af28a58, 29 April 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
52 files
- R/
Figure_1_and_2_compare_o , R, 199 lines, 3 matchesther_mappings.R - R/
Figure_1_centroid_expres , R, 124 lines, 1 matchsion.R - R/
Figure_1_descriptive.R , R, 92 lines - R/
Figure_1_markers.R , R, 170 lines - R/
Figure_2_metaneighbor_he , R, 163 linesatmaps.R - R/
Figure_2_metaneighbor_pl , R, 257 linesots.R - R/
Figure_3_coarse_regional , R, 90 lines_enrichment_tests.R - R/
Figure_3_examine_MERFISH , R, 442 lines, 3 matches_calls_for_recips.R - R/
Figure_3_examine_MERFISH , R, 154 lines_recip_centroids.R - R/
Figure_4_coordinated_exp , R, 135 lines, 2 matchesression_GO.R - R/
Figure_4_coordinated_exp , R, 295 linesression_in_recips_and_me an_exp.R - R/
Figure_5_get_cross_speci , R, 135 lines, 1 matches_results.R - R/
Figure_5_plot_AUROC_vs_p , R, 53 lineshylo.R - R/
Figure_5_plot_BARseq_clu , R, 115 linessters.R - R/
Figure_5_plot_boxplot_cl , R, 129 lines, 2 matchesustergraph.R - R/
Figure_5_plot_region_hea , R, 35 linestmap.R - R/
Table_annotation_for_top , R, 114 lineshits.R - R/
Table_for_high_confidenc , R, 81 linese_filters.R - R/
centroid_correlations.bi , R, 185 lines, 1 matchgcat.R - R/
compare_split_halves.R , R, 182 lines - R/
examine_barseq_pretraine , R, 149 lines, 2 matchesd_results.R - R/
examine_greeedy_runs_met , R, 32 linesa_markers.R - R/
make_centroids_mean_cpm_ , R, 78 linesfrom_parts.R - R/
meta_markers_in_parts.R , R, 91 lines - R/
meta_markers_in_reciproc , R, 66 linesals.R - R/
run_mix_HVG.R , R, 27 lines, 1 match - R/
run_on_barseq_pretrained , R, 124 lines, 1 match.R - R/
tophit_enrichment_tests. , R, 230 linesR - python_notebooks/
Macosko_all_marker_AUROC , Jupyter, 340 liness.ipynb - python_notebooks/
Marker_set_intersections , Jupyter, 535 lines.ipynb - python_notebooks/
MetaMarkers_greedy_AUC_t , Jupyter, 507 linesests.ipynb - python_notebooks/
Zeng_all_marker_AUROCs.i , Jupyter, 359 linespynb - python_notebooks/
combine_MERFISH_calls_fr , Jupyter, 51 linesom_R.ipynb - python_notebooks/
compare_HVGs.ipynb , Jupyter, 255 lines - python_notebooks/
examine_region_overlap.i , Jupyter, 169 linespynb - python_notebooks/
full_merge_and_HVG_write , Jupyter, 118 lines.ipynb - python_notebooks/
full_merge_and_Seurat_HV , Jupyter, 262 linesG_write.ipynb - python_notebooks/
make_BARseq_subsets.ipyn , Jupyter, 66 linesb - python_notebooks/
make_pretrained_using_fu , Jupyter, 106 linesll_merged.ipynb - python_notebooks/
process_Macosko_all_gene , Jupyter, 64 liness_cpm.ipynb - python_notebooks/
process_Zeng_AWS_files.i , Jupyter, 177 linespynb - python_notebooks/
process_Zeng_AWS_files_a , Jupyter, 129 linesll_genes_cpm.ipynb - python_notebooks/
retina_split_half/ , R, 82 lines, 1 matchcompare_split_halves.R - python_notebooks/
retina_split_half/ , Jupyter, 135 linesrun_split_retina_dataset .ipynb - python_notebooks/
retina_split_half/ , Jupyter, 163 linessplit_retina_dataset.ipy nb - python_notebooks/
run_on_full_merged_ZengA , Jupyter, 98 linesWS.ipynb - python_notebooks/
run_on_split_datasets.ip , Jupyter, 188 linesynb - python_notebooks/
split_for_metamarkers.ip , Jupyter, 97 linesynb - python_notebooks/
split_into_halves.ipynb , Jupyter, 144 lines - python_notebooks/
write_halved_HVG_genes.i , Jupyter, 41 linespynb - LICENSE, License, 21 lines
- readme.md, Text, 142 lines
Zenodo 19901057
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
Code availability statement
The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: gillislab/
mouse_brain_cluster_repl , Zenodo 19901057icability
Read it in the paper: doi.org/10.1038/s41467-026-74171-0.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 50 scripts, each with its path and the digest of its content;
- 18 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- figshare:28462349, at figshare; found in “Data availability”
Data availability statement
The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to a dataset: figshare 28462349
Read it in the paper: doi.org/10.1038/s41467-026-74171-0.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 3 keywords, 10 MeSH terms, 1 funder, 40 references, 7 RRIDs.
Cite
This paper
French, L., Suresh, H., & Gillis, J. (2026). Cluster replicability in single-cell and single-nucleus atlases of the mouse brain. Nature communications, 17(1), 7869. https://
BibTeX
@article{french2026clust
author = {French, Leon and Suresh, Hamsini and Gillis, Jesse},
title = {{Cluster replicability in single-cell and single-nucleus atlases of the mouse brain}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {7869},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/
url = {https://
pmid = {42331798},
pmcid = {PMC13444128}
}
RIS
TY - JOUR
AU - French, Leon
AU - Suresh, Hamsini
AU - Gillis, Jesse
TI - Cluster replicability in single-cell and single-nucleus atlases of the mouse brain
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/
VL - 17
IS - 1
SP - 7869
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Cluster replicability in single-cell and single-nucleus atlases of the mouse brain",
"container-title": "Nature communications",
"author": [
{
"family": "French",
"given": "Leon"
},
{
"family": "Suresh",
"given": "Hamsini"
},
{
"family": "Gillis",
"given": "Jesse"
}
],
"container-title-short":
"volume": "17",
"issue": "1",
"page": "7869",
"DOI": "10.1038/
"PMID": "42331798",
"PMCID": "PMC13444128",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
23
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1126/sciadv.aeg3223 [code]
- The extreme diversity of retinal amacrine cells has deep evolutionary roots.Journal: Science advancesIn common: anndata, igraph, circlize, 10 other tools, genetics / omics, cellular / molecular, 4 references
- [2] doi:10.1371/journal.pbio.3003757 [code]
- Cell type-agnostic transcriptomic signatures enable uniform comparisons of neural maturation.Journal: PLoS biologyIn common: anndata, igraph, circlize, 8 other tools, genetics / omics, mouse, 2 references, author Jesse Gillis
- [3] doi:10.1038/s42003-026-10034-0 [code]
- Region- and cell type-specific changes in gene expression in the cerebellum after classical fear conditioning.Journal: Communications biologyIn common: SingleCellExperiment, anndata, circlize, 10 other tools, genetics / omics, mouse, cellular / molecular, 2 references
- [4] doi:10.1016/j.xcrm.2026.102766 [code]
- A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.Journal: Cell reports. MedicineIn common: SingleCellExperiment, anndata, igraph, 11 other tools, genetics / omics, cellular / molecular, 1 reference
- [5] doi:10.1186/s13059-026-04177-w [code]
- Genomic sequence evolution underlying human neocortical interareal diversification.Journal: Genome biologyIn common: anndata, igraph, circlize, 10 other tools, genetics / omics, mouse, cellular / molecular, 2 references
- [6] doi:10.1002/imt2.70163 [code]
- Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.Journal: iMetaIn common: SingleCellExperiment, anndata, igraph, 11 other tools, genetics / omics, mouse, cellular / molecular
- [7] doi:10.1038/s41586-026-10214-2 [code]
- Multidimensional profiling of heterogeneity in supratentorial ependymomas.Journal: NatureIn common: SingleCellExperiment, anndata, igraph, 11 other tools, genetics / omics, mouse
- [8] doi:10.1016/j.xcrm.2026.102651 [code]
- Integrative CSF profiling identifies disease-specific immune responses in leptomeningeal disease.Journal: Cell reports. MedicineIn common: SingleCellExperiment, anndata, igraph, 11 other tools, genetics / omics, cellular / molecular
- [9] doi:10.1038/s41586-026-10629-x [code]
- Whole-genome duplication shaped cell-type evolution in the vertebrate brain.Journal: NatureIn common: anndata, igraph, circlize, 8 other tools, genetics / omics, mouse, cellular / molecular, 3 references
- [10] doi:10.1038/s41592-026-03194-8 [code]
- Beyond benchmarking: an expert-guided consensus approach to spatially aware clustering.Journal: Nature methodsIn common: SingleCellExperiment, anndata, igraph, 9 other tools, genetics / omics, 3 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 50 scripts, and 18 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:dcb9973dda0c9aac…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
