The nf-core/spatialvi pipeline is an automated workflow for analysing 10X Genomics Visium and Visium HD data. It takes raw sequencing files plus 10X Visium specific data or spaceranger output as input. The pipeline performs quality control, read mapping, and clustering.
You can find the official usage documentation here: https://nf-co.re/spatialvi/dev/docs/usage/
NOTE: This pipeline is still under development. Changes may occur and more functionality will be added in the near future.
The pipeline can be run on spaceranger output, raw old-fashioned Visium, raw Cytassist Visium, or Visium HD data. Depending on your input data, you should create a different samplesheet.csv file. If you have multiple samples they can all be added as row in the same sample sheet.
See also: https://nf-co.re/spatialvi/dev/docs/usage/
If you already used spaceranger for initial processing all you have to do is specifying the path of the spaceranger output directory for each sample in the samplesheet samplesheet.csv:
sample,spaceranger_dir
sample_1,/data/ukdritestuser/spatial/10X_genomics/visium-mouse-brain-coronal-section-1-ffpe-2-standard/out
sample_2,/data/ukdritestuser/spatial/10X_genomics/visium-mouse-brain-coronal-section-2-ffpe-2-standard/out
NOTE: The pipelins is rather strict about filenames so make sure they follow the default spaceranger output filenames:
out
├── analysis.tar.gz
├── cloupe.cloupe
├── filtered_feature_bc_matrix.h5
├── filtered_feature_bc_matrix.tar.gz
├── metrics_summary.csv
├── molecule_info.h5
├── possorted_genome_bam.bam
├── possorted_genome_bam.bam.bai
├── raw_feature_bc_matrix.h5
├── raw_feature_bc_matrix.tar.gz
├── web_summary.html
└── spatial
├──aligned_fiducials.jpg
├──detected_tissue_image.jpg
├── scalefactors_json.json
├──spatial_enrichment.csv
├──tissue_hires_image.png
├──tissue_lowres_image.png
└──tissue_positions.csv
For raw data, the sample spreadsheet should look like this:
sample,fastq_dir,cytaimage,slide,area
CytAssist_FFPE_Mouse_Brain_Rep1,/data/ukdritestuser/spatial/10X_genomics/visium-mouse-brain-coronal-section-1-ffpe-2-standard/input/CytAssist_FFPE_Mouse_Brain_Rep1_fastqs.tar,/data/ukdritestuser/spatial/10X_genomics/visium-mouse-brain-coronal-section-1-ffpe-2-standard/input/CytAssist_FFPE_Mouse_Brain_Rep1_image.tif,V42A20-353,A1
sample: a name for the samplefastq_dir: this is either a directory containing fastQ files or or tarball .tar.gz comprising the filesimage or cytaimage: the high resolution histology image; use image for traditional 10X Visium data and cytaimage for 10X CytAssist data. The pipeline will adjust processes according to this column name.We provide a job template script for submitting a slurm job:
/nfsdata/scripts/job_scripts/run_nfcore_spatialvi.sh
To use the script, copy it to your dataset specific project folder and change the input files and parameters as desired.
As input, the pipeline needs:
samplesheet: path to a sample sheet, which specifies, which fastQ files belong to which sample (see more information below)resdir: path to the directory where results will be stored. The pipeline output will be stored in a subfolder called out# CREATE AND CHANGE PATH TO SAMPLESHEET
samplesheet=/nfsdata/${USER}/PATH_TO_SAMPLE_SHEET
# CHANGE RESULTS_DIR on your folder on /data
resdir=/data/${USER}/RESULTS_DIR
outdir=$resdir/out
Always use full file paths to avoid any complications.
Per default, the pipe line is configured to use the 10X Genomics 2020 mouse mm10 genome and gene annotation reference. The reference can be changed here:
# CHANGE GENOME REFERENCE ACCORDING TO SPECIES AND DESIRED ASSEMBLY
refpath=/nfsdata/genome/10x_genomics/refdata-gex-mm10-2020-A.tar.gz
Genome/gene annotation references are stored here:
/nfsdata/genome/10x_genomics
Since the release of Nextflow 26.04 the default type casting has been changed, which affects all integer, float, and boolean command-line parameters for nf-core pipelines. For more information see: Why parameters are strings all of a sudden
To use non-default parameters, you should specify them in a params.yml file. For example the bin-size for Visium HD (2, 8 or 16) and QC thresholds for filtering:
hd_bin_size: 8
qc_min_counts: 500
qc_min_genes: 250
qc_min_spots: 1
qc_mito_threshold: 20.0
Add the following line to the Nextflow call in the job script to invoke the parameters file:
-params-file $params \
Submit the job script to run the pipeline:
sbatch run_nfcore_spatialvi.sh
The pipeline output files are organized in sample and process specific folders:
out/multiqc/multiqc_report.html: Quality control report.out/sample_1/reports/report-sample_1.html: sample specific HTML analysis reports are in sample name specific subfoldersout/integration/reports/report-integrated.html: HTML analysis after combining samples report.Count matrix files:
out/integration/data/harmony.zarr: SpatialData zarr archive after sample integration.out/integration/data/harmony.h5ad: anndata object after sample integration.out/sample_1/data/sample_1.h5ad: anndata object in sample name specific folders.