Hi everyone,
Dose anyone know how can I make a plot like snap.pl.scrublet() (link below) through scanpy or scrublet?
https://kzhang.org/SnapATAC2/tutorials/pbmc.html
Thanks
Hi everyone,
Dose anyone know how can I make a plot like snap.pl.scrublet() (link below) through scanpy or scrublet?
https://kzhang.org/SnapATAC2/tutorials/pbmc.html
Thanks
Here is a small example (you can always add more colors if you want):
import scanpy as sc
import scanpy.external as sce
import matplotlib.pyplot as plt
# Load data
adata = sc.datasets.pbmc3k()
# Compute scrublet scores
sce.pp.scrublet(adata, verbose=False)
# Define plotting function
def plot_scrublet_scores(adata, ax):
thr = adata.uns['scrublet']['threshold']
# Plot histogram
ax.hist(adata.obs['doublet_score'], bins=100, color='gray')
ax.axvline(x=thr, linestyle='--', color="black")
ax.set_xlabel('Scrublet score distribution')
# Plot
fig, ax = plt.subplots(1, 1)
plot_scrublet_scores(adata, ax)
The result looks like this:
Thanks for reply, I knew about this plot, but I did not know that I can add colours and thresholds!
Thanks