SpaceRanger Alignment

Author

Ahmed M. Elhossiny

SpaceRanger and Reference Genome Configuration

  • We aligned all the raw Visium data using SpaceRanger (v3.0.1). We used the module installed on our HPC, but you can download it and find installation instructions here

  • We used the same GRCh38 reference genome described in CellRanger Alignment, along with the Visium Human Transcriptome Probe Set v2.0 required for CytAssist samples

Code
# Download the probe set
curl --output ../data/references/Visium_Human_Transcriptome_Probe_Set_v2.0_GRCh38-2020-A.csv \
https://cf.10xgenomics.com/supp/spatial-exp/probeset/Visium_Human_Transcriptome_Probe_Set_v2.0_GRCh38-2020-A.csv

Running SpaceRanger

The following shell script is submitted to a high-performance computing (HPC) cluster as a SLURM job array to process each of the Visium samples in parallel.

The script pulls a visium_samples_manifest.txt file from the data directory. It is a tab-separated file with no header, and the columns used by the script below (1-indexed) are:

Column Field Example
2 sample name sample_1
7 fastq path path/to/sample_1/fastq
8 image path path/to/sample_1/image.tif
9 CytAssist image path path/to/sample_1/cytaimage.tif
10 slide ID V42A20-001
11 capture area A1
12 Loupe manual alignment path/to/sample_1/loupe_alignment.json
Code
#!/bin/bash

#SBATCH --account=
#SBATCH --job-name='spaceranger_%a'
#SBATCH --output=logs/spaceranger_%a.log
#SBATCH --partition=standard
#SBATCH --mem=128G
#SBATCH --cpus-per-task=16
#SBATCH --time=48:00:00
#SBATCH --array=1-14

mkdir -p logs

# Import modules
ml spaceranger/3.0.1

# Setting up variables
samples_manifest=../data/visium_samples_manifest.txt
ref=../data/references/refdata-gex-GRCh38-2020-A
probe_set=../data/references/Visium_Human_Transcriptome_Probe_Set_v2.0_GRCh38-2020-A.csv

# Setting up output dir
outputDir=../outputs/spaceranger_alignment
mkdir -p $outputDir

# Extracting sample for the current job
sample=$(cat $samples_manifest | cut -f2 | sed -n ${SLURM_ARRAY_TASK_ID}p)
fastq=$(cat $samples_manifest | cut -f7 | sed -n ${SLURM_ARRAY_TASK_ID}p)
slide=$(cat $samples_manifest | cut -f10 | sed -n ${SLURM_ARRAY_TASK_ID}p)
capture_area=$(cat $samples_manifest | cut -f11 | sed -n ${SLURM_ARRAY_TASK_ID}p)
image=$(cat $samples_manifest | cut -f8 | sed -n ${SLURM_ARRAY_TASK_ID}p)
cytaimage=$(cat $samples_manifest | cut -f9 | sed -n ${SLURM_ARRAY_TASK_ID}p)
loupe_alignment=$(cat $samples_manifest | cut -f12 | sed -n ${SLURM_ARRAY_TASK_ID}p)

echo "Analyzing Sample $sample"

# Running spaceranger
spaceranger count \
--id=$sample --sample=$sample \
--fastqs=$fastq \
--transcriptome=$ref --probe-set=$probe_set \
--slide=$slide --area=$capture_area \
--image=$image --cytaimage=$cytaimage \
--loupe-alignment=$loupe_alignment \
--localcores=16 --create-bam=false

mv $sample $outputDir

Donor (n = 5), adjacent-normal-to-tumor (n = 2), and PDAC (n = 7) samples were profiled on the 10x Genomics Visium CytAssist platform using the 11 mm x 11 mm slide. Library preparation and sequencing were performed at the University of Michigan Advanced Genomics Core. The resulting feature-barcode matrices are loaded into Seurat as described in Spatial Transcriptomics Data Processing.