Trajectory analysis using Monocle3 - full tutorial workflow

single-cell-scrna-case_monocle3-trajectories/trajectory-analysis-using-monocle3---full-tutorial-workflow

Author(s)
Julia Jakiela
version Version
1
last_modification Last updated
May 16, 2023
license License
CC-BY-4.0
galaxy-tags Tags
name:trajectory_analysis
name:transcriptomics
name:scRNA-seq
name:single_cell

Features

Tutorial
hands_on Inferring single cell trajectories with Monocle3
workflow Other workflows associated with this material
Workflow Testing
Tests: ✅
Results: Not yet automated
FAIRness purl PURL
https://gxy.io/GTN:W00201
RO-Crate logo with flask Download Workflow RO-Crate Workflowhub cloud with gears logo View on WorkflowHub
Launch in Tutorial Mode question
galaxy-download Download
flowchart TD
  0["ℹ️ Input Dataset\nAnnData to extract genes & cells annotations"];
  style 0 stroke:#2c3143,stroke-width:4px;
  1["ℹ️ Input Dataset\nAnnData before processing to extract clean expression matrix"];
  style 1 stroke:#2c3143,stroke-width:4px;
  2["Extract cell annotations"];
  0 -->|output| 2;
  0646798d-3a5d-420a-a7cf-cde6cec722d5["Output\nExtracted cell annotations (obs)"];
  2 --> 0646798d-3a5d-420a-a7cf-cde6cec722d5;
  style 0646798d-3a5d-420a-a7cf-cde6cec722d5 stroke:#2c3143,stroke-width:4px;
  3["Extract gene annotations"];
  0 -->|output| 3;
  84162745-68b0-41a5-b06e-a285440ba095["Output\nExtracted gene annotations (var)"];
  3 --> 84162745-68b0-41a5-b06e-a285440ba095;
  style 84162745-68b0-41a5-b06e-a285440ba095 stroke:#2c3143,stroke-width:4px;
  4["Extract clean expression matrix"];
  1 -->|output| 4;
  3f03af0c-ac41-4450-b5ba-639a79ea543b["Output\nUnprocessed expression matrix"];
  4 --> 3f03af0c-ac41-4450-b5ba-639a79ea543b;
  style 3f03af0c-ac41-4450-b5ba-639a79ea543b stroke:#2c3143,stroke-width:4px;
  5["Filter out macrophages"];
  2 -->|obs| 5;
  fb81e9a1-0603-419a-83f5-0c9f94939b16["Output\nCells without macrophages"];
  5 --> fb81e9a1-0603-419a-83f5-0c9f94939b16;
  style fb81e9a1-0603-419a-83f5-0c9f94939b16 stroke:#2c3143,stroke-width:4px;
  6["gene_short_name annotation"];
  3 -->|var| 6;
  94a60e6c-cdf7-48e5-8b55-d221cef22688["Output\nGenes table with gene_short_name colname"];
  6 --> 94a60e6c-cdf7-48e5-8b55-d221cef22688;
  style 94a60e6c-cdf7-48e5-8b55-d221cef22688 stroke:#2c3143,stroke-width:4px;
  7["Cut cells IDs"];
  5 -->|out_file1| 7;
  34146c30-2666-481f-8d49-a849d5d3aa91["Output\nFiltered cells IDs "];
  7 --> 34146c30-2666-481f-8d49-a849d5d3aa91;
  style 34146c30-2666-481f-8d49-a849d5d3aa91 stroke:#2c3143,stroke-width:4px;
  8["Cut genes IDs"];
  6 -->|out_file1| 8;
  8f38fb93-cb30-4fbc-90c5-7f6bd023feea["Output\nGenes IDs"];
  8 --> 8f38fb93-cb30-4fbc-90c5-7f6bd023feea;
  style 8f38fb93-cb30-4fbc-90c5-7f6bd023feea stroke:#2c3143,stroke-width:4px;
  9["Filter matrix by cells"];
  7 -->|out_file1| 9;
  4 -->|X| 9;
  f654c045-5fea-43f9-96d6-492c810593d2["Output\nPre-filtered matrix (by cells)"];
  9 --> f654c045-5fea-43f9-96d6-492c810593d2;
  style f654c045-5fea-43f9-96d6-492c810593d2 stroke:#2c3143,stroke-width:4px;
  10["Remove duplicate column cells IDs"];
  9 -->|out_file1| 10;
  f633c125-a4d0-4fa7-ab87-022349f4ac70["Output\nFiltered matrix (by cells) "];
  10 --> f633c125-a4d0-4fa7-ab87-022349f4ac70;
  style f633c125-a4d0-4fa7-ab87-022349f4ac70 stroke:#2c3143,stroke-width:4px;
  11["Transpose matrix"];
  10 -->|output| 11;
  3202091e-1afc-4f50-8922-1f9e50c490fc["Output\nfiltered matrix (by cells) transposed"];
  11 --> 3202091e-1afc-4f50-8922-1f9e50c490fc;
  style 3202091e-1afc-4f50-8922-1f9e50c490fc stroke:#2c3143,stroke-width:4px;
  12["Filter matrix by genes"];
  8 -->|out_file1| 12;
  11 -->|out_file| 12;
  6c23cbd5-a1b5-428e-8ff9-ebac4893ad88["Output\nPre-filtered matrix (by cells & genes)"];
  12 --> 6c23cbd5-a1b5-428e-8ff9-ebac4893ad88;
  style 6c23cbd5-a1b5-428e-8ff9-ebac4893ad88 stroke:#2c3143,stroke-width:4px;
  13["Remove duplicate column genes IDs"];
  12 -->|out_file1| 13;
  25839326-0b5d-4e74-91ec-24e22c08f7c5["Output\nFiltered matrix (by cells & genes)"];
  13 --> 25839326-0b5d-4e74-91ec-24e22c08f7c5;
  style 25839326-0b5d-4e74-91ec-24e22c08f7c5 stroke:#2c3143,stroke-width:4px;
  14["Monocle3 create"];
  5 -->|out_file1| 14;
  13 -->|output| 14;
  6 -->|out_file1| 14;
  f8c5589c-a70d-416e-a9de-ebc987f61fc3["Output\nMonocle3 create on input dataset(s): cds3"];
  14 --> f8c5589c-a70d-416e-a9de-ebc987f61fc3;
  style f8c5589c-a70d-416e-a9de-ebc987f61fc3 stroke:#2c3143,stroke-width:4px;
  15["Monocle3 preprocess"];
  14 -->|output_rds| 15;
  c134942f-60e7-4cd0-8c32-da4a303b879d["Output\nMonocle3 preprocess on input dataset(s): cds3"];
  15 --> c134942f-60e7-4cd0-8c32-da4a303b879d;
  style c134942f-60e7-4cd0-8c32-da4a303b879d stroke:#2c3143,stroke-width:4px;
  16["Monocle3 reduceDim"];
  15 -->|output_rds| 16;
  2c9fb108-2a1c-41df-a8d8-81a18b66d2a1["Output\nMonocle3 reduceDim on input dataset(s): cds3"];
  16 --> 2c9fb108-2a1c-41df-a8d8-81a18b66d2a1;
  style 2c9fb108-2a1c-41df-a8d8-81a18b66d2a1 stroke:#2c3143,stroke-width:4px;
  17["Monocle3 partition"];
  16 -->|output_rds| 17;
  93371c10-6583-47fc-830f-9a90dc980766["Output\nMonocle3 partition on input dataset(s): cds3"];
  17 --> 93371c10-6583-47fc-830f-9a90dc980766;
  style 93371c10-6583-47fc-830f-9a90dc980766 stroke:#2c3143,stroke-width:4px;
  18["Plot cell type"];
  16 -->|output_rds| 18;
  f096d060-82e8-4847-9e8f-b22c9288f565["Output\nCell type plot"];
  18 --> f096d060-82e8-4847-9e8f-b22c9288f565;
  style f096d060-82e8-4847-9e8f-b22c9288f565 stroke:#2c3143,stroke-width:4px;
  19["Plot genotype"];
  16 -->|output_rds| 19;
  aab28bb1-e2e7-4b7d-9b2b-1cab64bea287["Output\nGenotype plot"];
  19 --> aab28bb1-e2e7-4b7d-9b2b-1cab64bea287;
  style aab28bb1-e2e7-4b7d-9b2b-1cab64bea287 stroke:#2c3143,stroke-width:4px;
  20["Plot batch"];
  16 -->|output_rds| 20;
  9b362eee-9238-47c5-a4c2-85f3995430f4["Output\nBatch plot"];
  20 --> 9b362eee-9238-47c5-a4c2-85f3995430f4;
  style 9b362eee-9238-47c5-a4c2-85f3995430f4 stroke:#2c3143,stroke-width:4px;
  21["Plot sex"];
  16 -->|output_rds| 21;
  c2a1e104-ef2d-4b66-ac2b-bf0251714434["Output\nSex plot"];
  21 --> c2a1e104-ef2d-4b66-ac2b-bf0251714434;
  style c2a1e104-ef2d-4b66-ac2b-bf0251714434 stroke:#2c3143,stroke-width:4px;
  22["Monocle3 top markers"];
  17 -->|output_rds| 22;
  23["Plot genes"];
  17 -->|output_rds| 23;
  e8867379-82c6-4c32-a2d3-0b24670269ae["Output\nGene expression plot"];
  23 --> e8867379-82c6-4c32-a2d3-0b24670269ae;
  style e8867379-82c6-4c32-a2d3-0b24670269ae stroke:#2c3143,stroke-width:4px;
  24["Plot partition"];
  17 -->|output_rds| 24;
  3f7b0a7c-85d6-430b-8385-fa9a76385c0e["Output\nPartition plot"];
  24 --> 3f7b0a7c-85d6-430b-8385-fa9a76385c0e;
  style 3f7b0a7c-85d6-430b-8385-fa9a76385c0e stroke:#2c3143,stroke-width:4px;
  25["Plot cluster"];
  17 -->|output_rds| 25;
  40b65826-f73e-4054-a56d-b241985d6996["Output\nCluster plot"];
  25 --> 40b65826-f73e-4054-a56d-b241985d6996;
  style 40b65826-f73e-4054-a56d-b241985d6996 stroke:#2c3143,stroke-width:4px;
  26["Monocle3 learnGraph"];
  17 -->|output_rds| 26;
  294b1a49-cec6-49d0-bcd4-3a954da67bec["Output\nMonocle3 learnGraph on input dataset(s): cds3"];
  26 --> 294b1a49-cec6-49d0-bcd4-3a954da67bec;
  style 294b1a49-cec6-49d0-bcd4-3a954da67bec stroke:#2c3143,stroke-width:4px;
  27["Plot learned trajectory"];
  26 -->|output_rds| 27;
  c85ddefe-8eaf-4d21-93ed-ca0859286bf0["Output\nCell types & learned trajectory path plot"];
  27 --> c85ddefe-8eaf-4d21-93ed-ca0859286bf0;
  style c85ddefe-8eaf-4d21-93ed-ca0859286bf0 stroke:#2c3143,stroke-width:4px;
  28["Monocle3 orderCells"];
  26 -->|output_rds| 28;
  5aea5752-b767-4fc8-8741-1f4d1c659a41["Output\nMonocle3 orderCells on input dataset(s): cds3"];
  28 --> 5aea5752-b767-4fc8-8741-1f4d1c659a41;
  style 5aea5752-b767-4fc8-8741-1f4d1c659a41 stroke:#2c3143,stroke-width:4px;
  29["Monocle3 diffExp"];
  28 -->|output_rds| 29;
  3c298624-9f06-4e52-b2a8-fb834b87c296["Output\nDifferential expression of genes - table"];
  29 --> 3c298624-9f06-4e52-b2a8-fb834b87c296;
  style 3c298624-9f06-4e52-b2a8-fb834b87c296 stroke:#2c3143,stroke-width:4px;
  30["Plot pseudotime"];
  28 -->|output_rds| 30;
  813d15bb-0771-4aed-9226-4874c1ddba59["Output\nPseudotime plot"];
  30 --> 813d15bb-0771-4aed-9226-4874c1ddba59;
  style 813d15bb-0771-4aed-9226-4874c1ddba59 stroke:#2c3143,stroke-width:4px;

Inputs

Input Label
Input dataset AnnData to extract genes & cells annotations
Input dataset AnnData before processing to extract clean expression matrix

Outputs

From Output Label
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.7.5+galaxy1 Inspect AnnData Extract cell annotations
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.7.5+galaxy1 Inspect AnnData Extract gene annotations
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.7.5+galaxy1 Inspect AnnData Extract clean expression matrix
Filter1 Filter Filter out macrophages
toolshed.g2.bx.psu.edu/repos/galaxyp/regex_find_replace/regexColumn1/1.0.2 Column Regex Find And Replace gene_short_name annotation
Cut1 Cut Cut cells IDs
Cut1 Cut Cut genes IDs
join1 Join two Datasets Filter matrix (by cells)
toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_cut_tool/1.1.0 Advanced Cut Remove duplicate column (cells IDs)
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.1.0+galaxy2 Transpose Transpose matrix
join1 Join two Datasets Filter matrix (by genes)
toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_cut_tool/1.1.0 Advanced Cut Remove duplicate column (genes IDs)
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_create/monocle3_create/0.1.4+galaxy2 Monocle3 create
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_preprocess/monocle3_preprocess/0.1.4+galaxy0 Monocle3 preprocess
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_reducedim/monocle3_reduceDim/0.1.4+galaxy0 Monocle3 reduceDim
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_partition/monocle3_partition/0.1.4+galaxy0 Monocle3 partition
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot cell type
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot genotype
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot batch
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot sex
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_topmarkers/monocle3_topmarkers/0.1.5+galaxy0 Monocle3 top markers
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot genes
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot partition
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot cluster
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_learngraph/monocle3_learnGraph/0.1.4+galaxy0 Monocle3 learnGraph
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot learned trajectory
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_ordercells/monocle3_orderCells/0.1.4+galaxy0 Monocle3 orderCells
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_diffexp/monocle3_diffExp/0.1.4+galaxy1 Monocle3 diffExp
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 Monocle3 plotCells Plot pseudotime

Tools

Tool Links
Cut1
Filter1
join1
toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_cut_tool/1.1.0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_create/monocle3_create/0.1.4+galaxy2 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_diffexp/monocle3_diffExp/0.1.4+galaxy1 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_learngraph/monocle3_learnGraph/0.1.4+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_ordercells/monocle3_orderCells/0.1.4+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_partition/monocle3_partition/0.1.4+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_plotcells/monocle3_plotCells/0.1.5+galaxy1 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_preprocess/monocle3_preprocess/0.1.4+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_reducedim/monocle3_reduceDim/0.1.4+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/ebi-gxa/monocle3_topmarkers/monocle3_topmarkers/0.1.5+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/galaxyp/regex_find_replace/regexColumn1/1.0.2 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.7.5+galaxy1 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.1.0+galaxy2 View in ToolShed

To use these workflows in Galaxy you can either click the links to download the workflows, or you can right-click and copy the link to the workflow which can be used in the Galaxy form to import workflows.

Importing into Galaxy

Below are the instructions for importing these workflows directly into your Galaxy server of choice to start using them!
Hands-on: Importing a workflow
  • Click on Workflow on the top menu bar of Galaxy. You will see a list of all your workflows.
  • Click on galaxy-upload Import at the top-right of the screen
  • Provide your workflow
    • Option 1: Paste the URL of the workflow into the box labelled “Archived Workflow URL”
    • Option 2: Upload the workflow file in the box labelled “Archived Workflow File”
  • Click the Import workflow button

Below is a short video demonstrating how to import a workflow from GitHub using this procedure:

Video: Importing a workflow from URL

Version History

Version Commit Time Comments
1 aa56146e2 2023-05-15 19:11:50 add workflow tests

For Admins

Installing the workflow tools

wget https://training.galaxyproject.org/training-material/topics/single-cell/tutorials/scrna-case_monocle3-trajectories/workflows/Trajectory-analysis-using-Monocle3---full-tutorial-workflow.ga -O workflow.ga
workflow-to-tools -w workflow.ga -o tools.yaml
shed-tools install -g GALAXY -a API_KEY -t tools.yaml
workflow-install -g GALAXY -a API_KEY -w workflow.ga --publish-workflows