Clustering 3k PBMC with Scanpy

single-cell-scrna-scanpy-pbmc3k/clustering-3k-pbmc-with-scanpy

Author(s)
Bérénice Batut, Hans-Rudolf Hotz, Mehmet Tekman, Pavankumar Videm
version Version
2
last_modification Last updated
Oct 4, 2024
license License
CC-BY-4.0
galaxy-tags Tags
name:scRNA-seq
name:single-cell

Features
Tutorial
hands_on Clustering 3K PBMCs with Scanpy

Workflow Testing
Tests: ✅
Results: Not yet automated
FAIRness purl PURL
https://gxy.io/GTN:W00212
RO-Crate logo with flask Download Workflow RO-Crate Workflowhub cloud with gears logo View on (Dev) WorkflowHub
Launch in Tutorial Mode question
galaxy-download Download
flowchart TD
  0["ℹ️ Input Dataset\nBarcodes"];
  style 0 stroke:#2c3143,stroke-width:4px;
  1["ℹ️ Input Dataset\nGenes"];
  style 1 stroke:#2c3143,stroke-width:4px;
  2["ℹ️ Input Dataset\nMatrix"];
  style 2 stroke:#2c3143,stroke-width:4px;
  3["Import Anndata"];
  2 -->|output| 3;
  0 -->|output| 3;
  1 -->|output| 3;
  4["Inspect AnnData"];
  3 -->|anndata| 4;
  5["Scanpy filter"];
  3 -->|anndata| 5;
  6["Inspect AnnData"];
  3 -->|anndata| 6;
  7["Inspect AnnData"];
  3 -->|anndata| 7;
  8["Inspect AnnData"];
  3 -->|anndata| 8;
  9["Manipulate AnnData"];
  5 -->|anndata_out| 9;
  10["Scanpy Inspect and manipulate"];
  9 -->|anndata| 10;
  11["Inspect AnnData"];
  9 -->|anndata| 11;
  12["Scanpy plot"];
  10 -->|anndata_out| 12;
  a13ef439-dade-4aa1-91d3-0e050da961af["Output\npl_scatter_total_counts_vs_n_genes_by_counts"];
  12 --> a13ef439-dade-4aa1-91d3-0e050da961af;
  style a13ef439-dade-4aa1-91d3-0e050da961af stroke:#2c3143,stroke-width:4px;
  13["Scanpy filter"];
  10 -->|anndata_out| 13;
  14["Scanpy plot"];
  10 -->|anndata_out| 14;
  f3ed5faf-e274-4575-91d4-c6a49d1aef6d["Output\npl_scatter_n_genes_by_counts_vs_pct_mito"];
  14 --> f3ed5faf-e274-4575-91d4-c6a49d1aef6d;
  style f3ed5faf-e274-4575-91d4-c6a49d1aef6d stroke:#2c3143,stroke-width:4px;
  15["Scanpy plot"];
  10 -->|anndata_out| 15;
  51634f2e-a033-4ef8-a785-079c415ccfae["Output\npl_violin"];
  15 --> 51634f2e-a033-4ef8-a785-079c415ccfae;
  style 51634f2e-a033-4ef8-a785-079c415ccfae stroke:#2c3143,stroke-width:4px;
  16["Scanpy filter"];
  13 -->|anndata_out| 16;
  17["Manipulate AnnData"];
  16 -->|anndata_out| 17;
  18["Scanpy normalize"];
  17 -->|anndata| 18;
  19["Scanpy Inspect and manipulate"];
  18 -->|anndata_out| 19;
  20["Manipulate AnnData"];
  19 -->|anndata_out| 20;
  21["Scanpy filter"];
  20 -->|anndata| 21;
  22["Manipulate AnnData"];
  21 -->|anndata_out| 22;
  23["Scanpy plot"];
  21 -->|anndata_out| 23;
  7c1818c2-b46f-4274-b309-68b45c7387f9["Output\npl_highly_variable"];
  23 --> 7c1818c2-b46f-4274-b309-68b45c7387f9;
  style 7c1818c2-b46f-4274-b309-68b45c7387f9 stroke:#2c3143,stroke-width:4px;
  24["Scanpy remove confounders"];
  22 -->|anndata| 24;
  25["Scanpy Inspect and manipulate"];
  24 -->|anndata_out| 25;
  26["Scanpy cluster, embed"];
  25 -->|anndata_out| 26;
  27["Scanpy plot"];
  26 -->|anndata_out| 27;
  9fa13332-20f5-4cf3-8b21-f4cf0be0f7d3["Output\npl_pca_overview"];
  27 --> 9fa13332-20f5-4cf3-8b21-f4cf0be0f7d3;
  style 9fa13332-20f5-4cf3-8b21-f4cf0be0f7d3 stroke:#2c3143,stroke-width:4px;
  28["Scanpy plot"];
  26 -->|anndata_out| 28;
  23fad9ca-caed-4cb5-bf9c-77dccd7fff09["Output\npl_pca_overview_genes"];
  28 --> 23fad9ca-caed-4cb5-bf9c-77dccd7fff09;
  style 23fad9ca-caed-4cb5-bf9c-77dccd7fff09 stroke:#2c3143,stroke-width:4px;
  29["Scanpy plot"];
  26 -->|anndata_out| 29;
  d80530df-fb7b-4d72-8c12-ae09d9eccc7c["Output\npl_pca_loadings"];
  29 --> d80530df-fb7b-4d72-8c12-ae09d9eccc7c;
  style d80530df-fb7b-4d72-8c12-ae09d9eccc7c stroke:#2c3143,stroke-width:4px;
  30["Scanpy Inspect and manipulate"];
  26 -->|anndata_out| 30;
  31["Scanpy plot"];
  26 -->|anndata_out| 31;
  2e3480a4-1dfb-4e43-b70c-459d155853e9["Output\npl_pca_variance_ratio"];
  31 --> 2e3480a4-1dfb-4e43-b70c-459d155853e9;
  style 2e3480a4-1dfb-4e43-b70c-459d155853e9 stroke:#2c3143,stroke-width:4px;
  32["Scanpy cluster, embed"];
  30 -->|anndata_out| 32;
  33["Scanpy plot"];
  32 -->|anndata_out| 33;
  504ea6ab-68a6-4c37-ae97-c58a99ff8381["Output\npl_umap_initial"];
  33 --> 504ea6ab-68a6-4c37-ae97-c58a99ff8381;
  style 504ea6ab-68a6-4c37-ae97-c58a99ff8381 stroke:#2c3143,stroke-width:4px;
  34["Scanpy cluster, embed"];
  32 -->|anndata_out| 34;
  35["Scanpy plot"];
  34 -->|anndata_out| 35;
  c674ba29-f097-4242-8dc2-b22441233e73["Output\npl_umap_louvain"];
  35 --> c674ba29-f097-4242-8dc2-b22441233e73;
  style c674ba29-f097-4242-8dc2-b22441233e73 stroke:#2c3143,stroke-width:4px;
  36["Scanpy Inspect and manipulate"];
  34 -->|anndata_out| 36;
  37["Scanpy Inspect and manipulate"];
  34 -->|anndata_out| 37;
  38["Inspect clusters"];
  36 -->|anndata_out| 38;
  39["Scanpy plot"];
  36 -->|anndata_out| 39;
  249d7c38-140c-403d-a0ed-effe1a17fdd6["Output\npl_rank_gene_groups_t_test_wilcoxon_test"];
  39 --> 249d7c38-140c-403d-a0ed-effe1a17fdd6;
  style 249d7c38-140c-403d-a0ed-effe1a17fdd6 stroke:#2c3143,stroke-width:4px;
  40["Scanpy plot"];
  36 -->|anndata_out| 40;
  c1395d95-9c53-48c9-972e-cf93116e85db["Output\npl_rank_genes_heatmap"];
  40 --> c1395d95-9c53-48c9-972e-cf93116e85db;
  style c1395d95-9c53-48c9-972e-cf93116e85db stroke:#2c3143,stroke-width:4px;
  41["Scanpy plot"];
  36 -->|anndata_out| 41;
  6b30a9d8-01be-4757-999d-cade6b516df6["Output\npl_stacked_violin_marker_genes"];
  41 --> 6b30a9d8-01be-4757-999d-cade6b516df6;
  style 6b30a9d8-01be-4757-999d-cade6b516df6 stroke:#2c3143,stroke-width:4px;
  42["Scanpy plot"];
  36 -->|anndata_out| 42;
  30bc8ca7-37b7-4efc-b442-8bc4cb986d7e["Output\npl_umap_marker_genes"];
  42 --> 30bc8ca7-37b7-4efc-b442-8bc4cb986d7e;
  style 30bc8ca7-37b7-4efc-b442-8bc4cb986d7e stroke:#2c3143,stroke-width:4px;
  43["Scanpy Inspect and manipulate"];
  36 -->|anndata_out| 43;
  44["Inspect AnnData"];
  36 -->|anndata_out| 44;
  9092ecc8-cace-45c4-8efa-bd4d27275060["Output\nuns_rank_genes_groups_names_wilcoxon_test"];
  44 --> 9092ecc8-cace-45c4-8efa-bd4d27275060;
  style 9092ecc8-cace-45c4-8efa-bd4d27275060 stroke:#2c3143,stroke-width:4px;
  45["Manipulate AnnData"];
  36 -->|anndata_out| 45;
  545a105c-1202-4209-aff2-201fd953e398["Output\nanndata_out"];
  45 --> 545a105c-1202-4209-aff2-201fd953e398;
  style 545a105c-1202-4209-aff2-201fd953e398 stroke:#2c3143,stroke-width:4px;
  46["Scanpy plot"];
  36 -->|anndata_out| 46;
  ad91827e-e8cc-45ec-b32f-935cf44a77d1["Output\npl_violin_louvain"];
  46 --> ad91827e-e8cc-45ec-b32f-935cf44a77d1;
  style ad91827e-e8cc-45ec-b32f-935cf44a77d1 stroke:#2c3143,stroke-width:4px;
  47["Scanpy plot"];
  37 -->|anndata_out| 47;
  4011556e-85f9-470e-b902-7ef9df11fef5["Output\npl_rank_gene_groups_t_test"];
  47 --> 4011556e-85f9-470e-b902-7ef9df11fef5;
  style 4011556e-85f9-470e-b902-7ef9df11fef5 stroke:#2c3143,stroke-width:4px;
  48["Inspect AnnData"];
  37 -->|anndata_out| 48;
  55f664c3-b771-4115-890f-3eb4637813b0["Output\nuns_rank_genes_groups_names_t_test"];
  48 --> 55f664c3-b771-4115-890f-3eb4637813b0;
  style 55f664c3-b771-4115-890f-3eb4637813b0 stroke:#2c3143,stroke-width:4px;
  49["Datamash"];
  38 -->|obs| 49;
  10693ba5-026d-443b-aa80-b4dedbf4f940["Output\ncells_per_cluster"];
  49 --> 10693ba5-026d-443b-aa80-b4dedbf4f940;
  style 10693ba5-026d-443b-aa80-b4dedbf4f940 stroke:#2c3143,stroke-width:4px;
  50["Scanpy plot"];
  43 -->|anndata_out| 50;
  51878bf2-d055-4acc-b365-cc7f7a673f66["Output\npl_rank_gene_groups_0_vs_1"];
  50 --> 51878bf2-d055-4acc-b365-cc7f7a673f66;
  style 51878bf2-d055-4acc-b365-cc7f7a673f66 stroke:#2c3143,stroke-width:4px;
  51["Scanpy plot"];
  43 -->|anndata_out| 51;
  10a46aa1-5685-4480-a6eb-362f32b91fa1["Output\npl_rank_gene_groups_violin_0_vs_1"];
  51 --> 10a46aa1-5685-4480-a6eb-362f32b91fa1;
  style 10a46aa1-5685-4480-a6eb-362f32b91fa1 stroke:#2c3143,stroke-width:4px;
  52["Scanpy plot"];
  45 -->|anndata| 52;
  c8ae2d77-361a-41e0-b238-0f494d12b6d7["Output\npl_umap_celltypes"];
  52 --> c8ae2d77-361a-41e0-b238-0f494d12b6d7;
  style c8ae2d77-361a-41e0-b238-0f494d12b6d7 stroke:#2c3143,stroke-width:4px;
  53["Scanpy plot"];
  45 -->|anndata| 53;
  a3ceb616-64b8-4c79-ba94-4272a5bd747f["Output\npl_dotplot_marker_genes"];
  53 --> a3ceb616-64b8-4c79-ba94-4272a5bd747f;
  style a3ceb616-64b8-4c79-ba94-4272a5bd747f stroke:#2c3143,stroke-width:4px;

Inputs

Input Label
Input dataset Barcodes
Input dataset Genes
Input dataset Matrix

Outputs

From Output Label
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.10.9+galaxy0 Inspect AnnData
toolshed.g2.bx.psu.edu/repos/iuc/anndata_manipulate/anndata_manipulate/0.10.9+galaxy0 Manipulate AnnData
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.10.9+galaxy0 Inspect AnnData
toolshed.g2.bx.psu.edu/repos/iuc/datamash_ops/datamash_ops/1.8+galaxy0 Datamash
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 Scanpy plot

Tools

Tool Links
toolshed.g2.bx.psu.edu/repos/iuc/anndata_import/anndata_import/0.10.9+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/anndata_inspect/anndata_inspect/0.10.9+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/anndata_manipulate/anndata_manipulate/0.10.9+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/datamash_ops/datamash_ops/1.8+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_cluster_reduce_dimension/scanpy_cluster_reduce_dimension/1.10.2+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_filter/scanpy_filter/1.10.2+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_inspect/scanpy_inspect/1.10.2+galaxy1 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_normalize/scanpy_normalize/1.10.2+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_plot/scanpy_plot/1.10.2+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/scanpy_remove_confounders/scanpy_remove_confounders/1.10.2+galaxy0 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
4 30dbb347e 2024-10-04 15:27:24 Update tutorials and add histories as answer_histories
3 88dc62713 2023-11-21 16:41:05 add CC 4.0 license
2 f5d15e869 2023-11-21 16:28:21 add links to a control history and workflow
1 a0fbcfe2e 2023-11-21 16:08:06 add workflow and tests

For Admins

Installing the workflow tools

wget https://training.galaxyproject.org/training-material/topics/single-cell/tutorials/scrna-scanpy-pbmc3k/workflows/Clustering-3k-PBMC-with-Scanpy.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