| name | screploading |
| description | Load single-cell TCR-seq or scBCR-seq data from various formats into a scRepertoire-compatible object. This process reads VDJ (variable, diversity, joining) receptor contig data from multiple single-cell sequencing platforms and prepares it for integration with scRNA-seq data. |
ScRepLoading Process Configuration
Purpose
Load single-cell TCR-seq or scBCR-seq data from various formats into a scRepertoire-compatible object. This process reads VDJ (variable, diversity, joining) receptor contig data from multiple single-cell sequencing platforms and prepares it for integration with scRNA-seq data.
When to Use
- When analyzing scTCR-seq or scBCR-seq data alongside scRNA-seq
- Required for TCR/BCR clonotype analysis (CDR3 clustering, clone expansion, TESSA analysis)
- Enables integration of immune receptor information with single-cell expression data
- Supports multiple sequencing platforms: 10x Genomics, AIRR, BD, Dandelion, Immcantation, MiXCR, ParseBio, TRUST4, WAT3R, Omniscope
Important: This process is automatically enabled when your sample info file contains TCRData or BCRData columns.
Configuration Structure
Process Enablement
[ScRepLoading]
cache = true
Input Specification
[ScRepLoading.in]
metafile = "path/to/sample_info.txt"
Required input file columns:
Sample: Unique identifier for each sample (required)
TCRData (for TCR analysis): Directory path to scTCR-seq data
BCRData (for BCR analysis): Directory path to scBCR-seq data
- Additional columns: Treated as sample metadata (optional)
Data format requirements:
- 10x Genomics: Directory containing
filtered_contig_annotations.csv or all_contig_annotations.csv
- AIRR format: Directory containing
airr_rearrangement.tsv
- BD platform: Directory containing
Contigs_AIRR.tsv
- Dandelion: Directory containing
all_contig_dandelion.tsv
- Immcantation: Directory containing
_data.tsv or similar
- JSON: File with
.json extension
- MiXCR: Directory containing
clones.tsv
- ParseBio: Directory containing
barcode_report.tsv
- TRUST4: Directory containing
barcode_report.tsv
- WAT3R: Directory containing
barcode_results.csv
- Omniscope: Directory containing
.csv files
Path handling:
- If
TCRData/BCRData specifies a directory: Process uses scRepertoire::loadContigs() directly
- If
TCRData/BCRData specifies a file: Creates symbolic link to temp directory for processing
- When filename is not recognized by scRepertoire: Set
envs.format explicitly
Environment Variables
[ScRepLoading.envs]
type = "auto"
format = "auto"
combineTCR = {"samples": true}
combineBCR = {"samples": true}
exclude = "auto"
tmpdir = "/tmp"
Detailed combineTCR Parameters
[ScRepLoading.envs.combineTCR]
samples = true
ID = null
removeNA = false
removeMulti = false
filterMulti = false
filterNonproductive = true
Detailed combineBCR Parameters
[ScRepLoading.envs.combineBCR]
samples = true
ID = null
call.related.clones = true
threshold = 0.85
removeNA = false
removeMulti = false
filterMulti = true
filterNonproductive = true
Configuration Examples
Minimal Configuration (10x TCR Data)
[SampleInfo.in]
infile = "sample_info.txt"
Single Sample with Format Specification
[ScRepLoading]
cache = true
[ScRepLoading.in]
metafile = "metadata/single_sample.txt"
[ScRepLoading.envs]
type = "TCR"
format = "10X"
[ScRepLoading.envs.combineTCR]
removeNA = true
filterNonproductive = true
Multi-Sample BCR Analysis with Clustering
[ScRepLoading]
cache = true
[ScRepLoading.in]
metafile = "metadata/bcr_samples.txt"
[ScRepLoading.envs]
type = "BCR"
[ScRepLoading.envs.combineBCR]
call.related.clones = true
threshold = 0.85
filterMulti = true
removeMulti = false
Non-10x Format (AIRR)
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/airr_samples.txt"
[ScRepLoading.envs]
format = "AIRR"
type = "auto"
[ScRepLoading.envs.combineTCR]
removeNA = false
removeMulti = false
TRUST4 Format
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/trust4_samples.txt"
[ScRepLoading.envs]
format = "TRUST4"
[ScRepLoading.envs.combineTCR]
removeNA = true
filterNonproductive = true
Common Patterns
Pattern 1: 10x Genomics TCR Data (Most Common)
[SampleInfo.in]
infile = "sample_info.txt"
Pattern 2: Both TCR and BCR Data (Auto-Detect TCR)
[SampleInfo.in]
infile = "sample_info.txt"
[ScRepLoading.envs]
type = "BCR"
Pattern 3: Filtered TCR Data (Remove NA and Multi-Chain)
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/tcr_filtered.txt"
[ScRepLoading.envs.combineTCR]
removeNA = true
removeMulti = true
filterNonproductive = true
Pattern 4: Relaxed Filtering for Exploratory Analysis
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/tcr_exploratory.txt"
[ScRepLoading.envs.combineTCR]
removeNA = false
removeMulti = false
filterNonproductive = false
Pattern 5: BCR Clone Clustering with Custom Threshold
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/bcr_clustering.txt"
[ScRepLoading.envs.combineBCR]
call.related.clones = true
threshold = 0.90
Pattern 6: Sample-Specific Labeling
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/longitudinal.txt"
[ScRepLoading.envs.combineTCR]
samples = true
ID = "Timepoint"
Pattern 7: Custom Metadata Exclusion
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/custom_columns.txt"
[ScRepLoading.envs]
exclude = ["RNAData", "TCRData", "BCRData", "ExperimentID", "Batch"]
Pattern 8: Paired Chain Analysis (TRA+TRB for TCR)
[ScRepLoading]
[ScRepLoading.in]
metafile = "metadata/tcr_paired.txt"
[ScRepLoading.envs.combineTCR]
removeNA = false
filterMulti = false
Dependencies
Upstream Processes
- SampleInfo (required): Provides sample metadata with
TCRData/BCRData columns
- LoadingRNAFromSeurat (alternative): When loading RNA from Seurat instead of SampleInfo
Downstream Processes
- ScRepCombiningExpression: Integrates TCR/BCR data with scRNA-seq expression
- CDR3Clustering: Clones cells by CDR3 sequence similarity
- TESSA: TCR-specific analysis (epitope specificity prediction)
- CDR3AAPhyschem: Physicochemical properties of CDR3 sequences
- ClonalStats: Clonality statistics and diversity metrics
Validation Rules
Common Configuration Errors
-
Missing TCRData/BCRData column:
- Error: Process not enabled, no TCR/BCR analysis
- Fix: Add
TCRData or BCRData column to sample info file
-
Invalid format specified:
- Error: scRepertoire fails to recognize file format
- Fix: Set
envs.format to one of: 10X, AIRR, BD, Dandelion, Immcantation, JSON, MiXCR, ParseBio, TRUST4, WAT3R, Omniscope
-
Directory path not found:
- Error: Cannot access TCR/BCR data directory
- Fix: Verify paths in
TCRData/BCRData columns exist and are readable
-
Missing required files in directory:
- Error: Expected contig file not found (e.g.,
filtered_contig_annotations.csv)
- Fix: Ensure directory contains appropriate file for specified format
-
Both TCR and BCR specified without type selection:
- Warning: TCR selected by default
- Fix: Set
envs.type = "BCR" if BCR analysis intended
File Format Requirements
- 10x Genomics: Must have
filtered_contig_annotations.csv in directory
- AIRR: Must have
airr_rearrangement.tsv in directory
- BD: Must have
Contigs_AIRR.tsv in directory
- Dandelion: Must have
all_contig_dandelion.tsv in directory
- MiXCR: Must have
clones.tsv in directory
- TRUST4: Must have
barcode_report.tsv in directory
- ParseBio: Must have
barcode_report.tsv in directory
- WAT3R: Must have
barcode_results.csv in directory
Chain Compatibility
- TCR chains: Supports TRA, TRB, TRG, TRD (auto-detected from data)
- BCR chains: Supports IGH, IGL, IGK (auto-detected from data)
- Paired analysis: Automatically pairs TRA+TRB or IGH+IGL/IGK when both present
- Single-chain: Keeps single-chain cells when
removeNA = false
Troubleshooting
Issue: ScRepLoading not running
Cause: No TCRData or BCRData column in sample info file
Solution:
- Add
TCRData or BCRData column to sample info
- Verify column name exactly matches (case-sensitive)
- Check that
SampleInfo.in.infile is correctly specified
Issue: "File format not recognized"
Cause: Filename doesn't match expected pattern for auto-detection
Solution:
- Set
envs.format explicitly to your format type
- Example:
format = "TRUST4" for TRUST4 output
- Verify directory contains expected file for that format
Issue: "No cells loaded" or empty output
Cause: Too aggressive filtering or mismatched barcodes
Solution:
- Set
removeNA = false and removeMulti = false temporarily
- Check that TCR/BCR barcodes match RNA barcodes
- Verify filterMulti is appropriate for your data type
Issue: Duplicate barcode errors
Cause: Multiple samples have identical cell barcodes
Solution:
- Set
ID = "Sample" or use explicit sample labels
- This adds sample prefix to barcodes:
Sample1_AAACCC...
- Required when merging samples from same run
Issue: BCR clustering too strict/too permissive
Cause: Default threshold (0.85) not optimal for data
Solution:
- Adjust
envs.combineBCR.threshold
- Higher (0.90+): More stringent, fewer clusters
- Lower (0.80-): More permissive, more sequences clustered together
Issue: Single-chain cells lost
Cause: filterNonproductive = true or removeNA = true
Solution:
- For exploratory analysis, set
removeNA = false
- For developmental studies, consider
filterNonproductive = false
- Use
filterMulti = true only when confident in data quality
Issue: Metadata columns missing from output
Cause: Excluded by default (exclude = "auto")
Solution:
- Set
exclude = [] to keep all metadata columns
- Or specify custom list:
exclude = ["RNAData"]
- Default excludes:
RNAData, TCRData, BCRData
Issue: Cannot load from specific directory path
Cause: Path not accessible or permission issues
Solution:
- Verify directory exists and is readable
- Check file permissions:
ls -la path/to/tcr/
- Use absolute paths if relative paths fail
Issue: Combining TCR and BCR data separately
Cause: Need to analyze both receptor types
Solution:
- Run pipeline twice with different
type settings
- First run:
[ScRepLoading.envs] type = "TCR"
- Second run:
[ScRepLoading.envs] type = "BCR"
- Use different output directories to avoid conflicts
Issue: Integration with ScRepCombiningExpression fails
Cause: Barcodes don't match between RNA and VDJ data
Solution:
- Ensure same samples used in both RNA and VDJ data
- Check that SampleInfo has correct paths for both data types
- Verify barcode prefixes match (if using
ID parameter)