HOME  ›   pipelines
If your question is not answered here, please email us at:  ${email.software}

10x Genomics
Visium Spatial Gene Expression

Targeted Gene Expression Analysis

Table of Contents

Space Ranger provides the same interface and features for both Targeted and Whole Transcriptome Analysis (WTA) Gene Expression data, as described in Single-Library Analysis with spaceranger count. The workflow diagram shows all the required inputs and the corresponding spaceranger count flags for Targeted Gene Expression analysis:

Input files

The spaceranger count is run on each individual Capture Area in the Visium slide. The required inputs are:

Run spaceranger count

For a list of accepted arguments, see the Command Line Argument Reference below, or run spaceranger count --help.

Select the tab corresponding to the imaging workflow.


To generate spatial feature counts for a single library using automatic fiducial alignment and tissue detection on a brightfield image input, run spaceranger count with the following arguments. The code in red indicates user specific inputs.

$ cd /home/jdoe/runs
$ spaceranger count --id=sample345 \ #Output directory
                   --transcriptome=/opt/refdata/GRCh38-2020-A \ #Path to Reference
                   --target-panel=/opt/spaceranger-1.3.0/target_panels/immunology_v1.0_GRCh38-2020-A.target_panel.csv \ #Path to the Target Panel CSV
                   --fastqs=/home/jdoe/runs/HAWT7ADXX/outs/fastq_path \ #Path to FASTQs
                   --sample=mysample \ #Sample name from FASTQ filename
                   --image=/home/jdoe/runs/images/sample345TIFF \ #Path to brightfield image input
                   --slide=V19J01-123 \ #Slide ID
                   --area=A1 \ #Capture area
                   --localcores=8 \ #Allowed cores in localmode
                   --localmem=64 #Allowed memory (GB) in localmode

To generate spatial feature counts for a single library using a fiducial alignment and tissue assignment JSON file generated in Loupe Browser on a brightfield image input, run spaceranger count with the following arguments. The code in red indicates user specific inputs.

$ cd /home/jdoe/runs
$ spaceranger count --id=sample345 \ #Output directory
                   --transcriptome=/opt/refdata/GRCh38-2020-A \ #Path to Reference
                   --target-panel=/opt/spaceranger-1.3.0/target_panels/immunology_v1.0_GRCh38-2020-A.target_panel.csv \ #Path to the Target Panel CSV
                   --fastqs=/home/jdoe/runs/HAWT7ADXX/outs/fastq_path \ #Path to FASTQs
                   --sample=mysample \ #Sample name from FASTQ filename
                   --image=/home/jdoe/runs/images/sample345TIFF \ #Path to brightfield image input
                   --slide=V19J01-123 \ #Slide ID
                   --area=A1 \ #Capture area
                   --loupe-alignment=sample345.json \ #Manual alignment file
                   --localcores=8 \ #Allowed cores in localmode
                   --localmem=64 #Allowed memory (GB) in localmode
The arguments to specify the fluorescence image can be either --darkimage or --colorizedimage, depending on the image format. Details about the different supported fluorescence image formats are described in Image Recommendations.

Target panel CSV

Target panel CSV files corresponding to predesigned gene panels can be found within the target_panels directory in the Space Ranger package. Spatial Gene Expression does not include support for fully custom panels.

target_panels/
├── gene_signature_v1.0_GRCh38-2020-A.target_panel.csv
├── immunology_v1.0_GRCh38-2020-A.target_panel.csv
├── neuroscience_v1.0_GRCh38-2020-A.target_panel.csv
└── pan_cancer_v1.0_GRCh38-2020-A.target_panel.csv

For example, if you installed Space Ranger to /opt/spaceranger-1.3.0, then the target panel CSVs will be contained in /opt/spaceranger-1.3.0/target_panels.

For the target panel CSV files, go to:

Output files

The output from a Targeted Gene Expression analysis is generally similar to output from non-targeted analysis—see the table below for a comprehensive list of differences. The primary changes are:

The raw feature-barcode matrices and molecule info H5 file still provide information about all genes.

File NameDescriptionDifferences for Targeted Gene Expression
web_summary.htmlRun summary metrics and charts in HTML formatContains additional Targeted Gene Expression metrics
metrics_summary.csvRun summary metrics in CSV formatContains additional Targeted Gene Expression metrics
possorted_genome_bam.bamReads aligned to the genome and transcriptome annotated with barcode informationReads not analyzed due to high sequencing depth and subsampling are unmapped and indicated using the xf:i:32 tag
possorted_genome_bam.bam.baiIndex for possorted_genome_bam.bamGenerally unchanged
filtered_feature_bc_matrixFiltered feature-barcode matrices containing only tissue-associated barcodes in MEX formatContains only targeted genes
filtered_feature_bc_matrix.h5Filtered feature-barcode matrices containing only tissue-associated barcodes in HDF5 formatContains only targeted genes*
raw_feature_bc_matricesUnfiltered feature-barcode matrices containing all barcodes in MEX formatGenerally unchanged
raw_feature_bc_matrix.h5Unfiltered feature-barcode matrices containing all barcodes in HDF5 formatGenerally unchanged*
analysisSecondary analysis data including dimensionality reduction, spot clustering, and differential expressionSecondary analysis performed only on the targeted genes
molecule_info.h5Molecule-level information used by secondary analysis spaceranger pipelines including aggr, targeted-compare and targeted-depthGenerally unchanged*
cloupe.cloupeLoupe Browser visualization and analysis fileContains only targeted genes
target_panel.csvTarget Panel CSV fileOnly present for Targeted Gene Expression data
spatial/Directory containing QC images for aligned fiducials and detetected tissue in jpg format, scalefactors_json.json, high and low resolution versions of the input image in png format, and tissue_positions_list.csvGenerally unchanged

* HDF5 files now contain indices of the targeted genes within the features HDF5 group.

Once spaceranger count has successfully completed, you can further explore the results by:

Targeted analysis relevant command-line arguments

The list of all the relevant arguments are described in Single-Library Analysis with spaceranger count or run spaceranger count --help.

ArgumentDescription
--target-panelRequired for Targeted Gene Expression analysis. Path to a Target Panel CSV file declaring the target panel used.
--rps-limitOptional for Targeted Gene Expression analysis. Subsample to at most N mean reads under tissue per spot for targeted gene expression if N > 0, or disable subsampling if N = 0. Modifying this parameter is not recommended. The default value of N is 15,000 reads under tissue per spot for targeted gene expression. See Targeted Algorithms for details.