monocle3 Algorithm

Purpose

Use the monocle3 algorithm to perform trajectory inference on spatial transcriptomics and single-cell data, automatically outputting various trajectory-related results.

Usage

Use the h5ad after annotation, prepare the rds file:

SDAS dataProcess h5ad2rds -i st.h5ad -o outdir 

Run monocle3:

SDAS trajectory monocle3 -i st.rds -o outdir --root_key anno_spotlight --root CAF_DES \
--gene_symbol_key real_gene_name \
--batch_key sampleID

Input Parameter Description

Parameter
Required
Default Value
Description

-i / --input

Yes

rds file, must contain raw expression matrix

-o / --output

Yes

Output folder

--root_key

Yes

Column name in meta.data where the root node is located

--root

Yes

Name of the root node

--assay

No

Assay name, if not set uses default assay

--gene_symbol_key

No

real_gene_name

Column name for gene symbol in meta.features, _index means using matrix rownames

--batch_key

No

Column name in meta.data for batch correction, if not set, no batch correction

--resolution

No

Resolution parameter for leiden clustering, if not set, algorithm will auto-fit

--use_existing_umap_cluster

No

Use existing umap and cluster information in rds

--umap_key

No

umap

Name of the field storing umap information in input rds

--cluster_key

No

leiden

Name of the field storing cluster information in input rds

--deg

No

Analyze differentially expressed genes along pseudotime, specify "--deg" to enable

--n_cpus

No

8

Number of threads

--top_gene_num

No

5

Number of top differentially expressed genes to plot along pseudotime

--gene_file

No

Path to custom gene list file,draw gene expression along pseudotime, separated by commas

--gene_color_label

No

pseudotime

Column name to color gene plots

--pval_cutoff

No

0.05

Identified the genes that were significantly (pval < pval_cutoff) spatially autocorrelated along the trajectory

--qval_cutoff

No

0.05

Identified the genes that were significantly (qval < qval_cutoff) spatially autocorrelated along the trajectory

--seed

No

42

Random seed

Output Results Display

Result File
Description

<input_name>_dimension.png/pdf

Dimension reduction plot, shows cell distribution in low-dimensional space

<input_name>_dimension_color_by_batch.png/pdf

Dimension reduction plot colored by batch (output if batch correction is performed), used to evaluate batch effect

<input_name>_cluster.png/pdf

Clustering plot, shows cell cluster distribution

<input_name>_roots.png/pdf

Root plot, shows the location of the root node in trajectory analysis

<input_name>_pseudotime.png/pdf

Pseudotime plot, shows the distribution of cell pseudotime

<input_name>_top_genes_in_pseudotime.png/pdf

Expression trend plot of top genes along pseudotime

<input_name>_custom_genes_in_pseudotime.png/pdf

Expression trend plot of custom genes along pseudotime

<input_name>_monocle3.rds

rds file containing trajectory analysis results

<input_name>_pseudotime.csv

Pseudotime results for each cell, records the pseudotime value of each cell

<input_name>_deg_trajectory.xls

Results of all genes changing along pseudotime

  • Dimension reduction plot: <input_name>_dimension.png/pdf shows the cell distribution structure in low-dimensional space, reflecting overall heterogeneity and clustering structure

  • Clustering plot: <input_name>_cluster.png/pdf shows the distribution of cell clusters, reflecting overall heterogeneity and clustering structure

  • Root plot: <input_name>_roots.png/pdf shows the root node in trajectory analysis, marking the starting point (root node) of trajectory inference, used for subsequent pseudotime ordering

  • Pseudotime plot: <input_name>_pseudotime.png/pdf shows the distribution of cell pseudotime, cells are colored by predicted developmental/differentiation order, reflecting dynamic changes

  • Top gene expression trend plot along pseudotime: <input_name>_top_genes_in_pseudotime.png/pdf shows the most significant top gene expression trends along pseudotime

  • Custom gene expression trend plot along pseudotime: <input_name>_custom_genes_in_pseudotime.png/pdf shows the expression trends of user-specified genes along pseudotime

Parameter Tuning Recommendations

Trajectory analysis with monocle3 generally requires accurate annotation of cell subtypes. Through subtype partitioning, the algorithm can exclude irrelevant cell noise and focus on cell populations with developmental continuity, thereby inferring biologically logical differentiation paths. In practical analysis, it is recommended to select specific cell populations rather than analyzing the entire section, which can also reduce runtime and memory usage.

Last updated