Multisample Batch Correction with SnapATAC2 and Harmony

single-cell-scatac-batch-correction-snapatac2/main-workflow

Author(s)
Timon Schlegel
version Version
1
last_modification Last updated
Feb 28, 2025
license License
CC-BY-4.0
galaxy-tags Tags
epigenetics
scATAC-seq
name:single-cell

Features
Tutorial
hands_on Multi-sample batch correction with Harmony and SnapATAC2

Workflow Testing
Tests: ❌
Results: Not yet automated
FAIRness purl PURL
https://gxy.io/GTN:
RO-Crate logo with flask Download Workflow RO-Crate
Launch in Tutorial Mode question
galaxy-download Download
flowchart TD
  0["ℹ️ Input Collection\nInput MultiSample Collection"];
  style 0 stroke:#2c3143,stroke-width:4px;
  1["ℹ️ Input Dataset\nchrom_sizes"];
  style 1 stroke:#2c3143,stroke-width:4px;
  2["ℹ️ Input Dataset\ngencode.v46.annotation.gtf.gz"];
  style 2 stroke:#2c3143,stroke-width:4px;
  3["pp.import_data"];
  1 -->|output| 3;
  0 -->|output| 3;
  4["metrics.tsse"];
  3 -->|anndata_out| 4;
  2 -->|output| 4;
  5["pl.tsse"];
  4 -->|anndata_out| 5;
  a6e0e735-c13a-4560-9f99-d61f2d06a173["Output\ntsse-plots"];
  5 --> a6e0e735-c13a-4560-9f99-d61f2d06a173;
  style a6e0e735-c13a-4560-9f99-d61f2d06a173 stroke:#2c3143,stroke-width:4px;
  6["pp.filter_cells"];
  4 -->|anndata_out| 6;
  7["pp.add_tile_matrix"];
  6 -->|anndata_out| 7;
  8["pp.select_features"];
  7 -->|anndata_out| 8;
  9["pp.scrublet"];
  8 -->|anndata_out| 9;
  10["pp.filter_doublets"];
  9 -->|anndata_out| 10;
  11["Extract element identifiers"];
  10 -->|anndata_out| 11;
  12["Extract first dataset"];
  10 -->|anndata_out| 12;
  13["Select first"];
  11 -->|output| 13;
  14["Filter collection"];
  13 -->|out_file1| 14;
  10 -->|anndata_out| 14;
  dae74fe0-46fa-480a-832e-0d1c03e543c1["Output\ncollection_without_first_entry"];
  14 --> dae74fe0-46fa-480a-832e-0d1c03e543c1;
  style dae74fe0-46fa-480a-832e-0d1c03e543c1 stroke:#2c3143,stroke-width:4px;
  15["Concatenate AnnDatas"];
  12 -->|output| 15;
  14 -->|output_filtered| 15;
  16["pp.select_features on all"];
  15 -->|anndata| 16;
  17["tl.spectral"];
  16 -->|anndata_out| 17;
  18["tl.umap_no-batch-correction"];
  17 -->|anndata_out| 18;
  19["pl.umap_no-batch-correction"];
  18 -->|anndata_out| 19;
  c66faaf2-6d6b-4410-9eb1-13a25c101c93["Output\nout_png"];
  19 --> c66faaf2-6d6b-4410-9eb1-13a25c101c93;
  style c66faaf2-6d6b-4410-9eb1-13a25c101c93 stroke:#2c3143,stroke-width:4px;
  20["pp.harmony"];
  18 -->|anndata_out| 20;
  21["pp.mnn_correct"];
  18 -->|anndata_out| 21;
  22["pp.scanorama"];
  18 -->|anndata_out| 22;
  23["tl.umap_batch-correction"];
  20 -->|anndata_out| 23;
  24["tl.umap_mnn-correct"];
  21 -->|anndata_out| 24;
  25["tl.umap_scanorama"];
  22 -->|anndata_out| 25;
  26["UMAP-plot of X_spectral_harmony"];
  23 -->|anndata_out| 26;
  71f8f33f-0017-467e-bf8c-ccd0b213b731["Output\nx_spectral_harmony"];
  26 --> 71f8f33f-0017-467e-bf8c-ccd0b213b731;
  style 71f8f33f-0017-467e-bf8c-ccd0b213b731 stroke:#2c3143,stroke-width:4px;
  27["pp.knn"];
  23 -->|anndata_out| 27;
  28["UMAP-plot of X_spectral_mnn-correct"];
  24 -->|anndata_out| 28;
  2fa7f3dc-fed8-4a34-b857-4cfd276e7625["Output\nx_spectral_mnn-correct"];
  28 --> 2fa7f3dc-fed8-4a34-b857-4cfd276e7625;
  style 2fa7f3dc-fed8-4a34-b857-4cfd276e7625 stroke:#2c3143,stroke-width:4px;
  29["UMAP plot of X_spectral_scanorama"];
  25 -->|anndata_out| 29;
  7a6c6165-42b6-4fff-b0d5-35f94541cd79["Output\nx_spectral_scanorma"];
  29 --> 7a6c6165-42b6-4fff-b0d5-35f94541cd79;
  style 7a6c6165-42b6-4fff-b0d5-35f94541cd79 stroke:#2c3143,stroke-width:4px;
  30["tl.leiden"];
  27 -->|anndata_out| 30;
  532c487d-bfdb-4552-bed2-17ca6063aa01["Output\nanndata_harmony_leiden"];
  30 --> 532c487d-bfdb-4552-bed2-17ca6063aa01;
  style 532c487d-bfdb-4552-bed2-17ca6063aa01 stroke:#2c3143,stroke-width:4px;
  31["UMAP-plot of Leiden Clusters"];
  30 -->|anndata_out| 31;

Inputs

Input Label
Input dataset collection Input MultiSample Collection
Input dataset chrom_sizes
Input dataset gencode.v46.annotation.gtf.gz

Outputs

From Output Label
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_plotting/snapatac2_plotting/2.6.4+galaxy1 SnapATAC2 Plotting pl.tsse
__FILTER_FROM_FILE__ Filter collection
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_plotting/snapatac2_plotting/2.6.4+galaxy1 SnapATAC2 Plotting pl.umap_no-batch-correction
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_plotting/snapatac2_plotting/2.6.4+galaxy1 SnapATAC2 Plotting UMAP-plot of X_spectral_harmony
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_plotting/snapatac2_plotting/2.6.4+galaxy1 SnapATAC2 Plotting UMAP-plot of X_spectral_mnn-correct
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_plotting/snapatac2_plotting/2.6.4+galaxy1 SnapATAC2 Plotting UMAP plot of X_spectral_scanorama
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_clustering/snapatac2_clustering/2.6.4+galaxy1 SnapATAC2 Clustering tl.leiden

Tools

Tool Links
Show beginning1
__EXTRACT_DATASET__
__FILTER_FROM_FILE__
toolshed.g2.bx.psu.edu/repos/iuc/anndata_manipulate/anndata_manipulate/0.10.3+galaxy0 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/collection_element_identifiers/collection_element_identifiers/0.0.2 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_clustering/snapatac2_clustering/2.6.4+galaxy1 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_plotting/snapatac2_plotting/2.6.4+galaxy1 View in ToolShed
toolshed.g2.bx.psu.edu/repos/iuc/snapatac2_preprocessing/snapatac2_preprocessing/2.6.4+galaxy1 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
3 48339e7f1 2024-10-03 10:52:16 fixed technical issues
2 971cb4607 2024-08-07 14:30:20 new workflow, image and tool versions
1 03a7cf167 2024-06-20 08:25:25 Add files via upload

For Admins

Installing the workflow tools

wget https://training.galaxyproject.org/training-material/topics/single-cell/tutorials/scatac-batch-correction-snapatac2/workflows/main_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