Skip to contents

Load TCR or BCR sequencing data from 10x Genomics Cell Ranger VDJ output. Automatically detects file format (AIRR standard or contig_annotations.csv) and converts to MiAIRR-compliant format for use with LymphoSeq2.

Usage

read10x(path, recursive = FALSE)

Arguments

path

Path to directory containing 10x files, or a vector of file paths. Accepts .tsv, .csv, .txt, or .tsv.gz formats.

recursive

Logical. Should subdirectories be searched for files?

  • TRUE: Recursively search all subdirectories

  • FALSE (default): Only search the specified directory

Value

A tibble with MiAIRR-formatted columns including:

  • cell_id: Cell barcode identifier

  • repertoire_id: Sample name (from filename)

  • junction, junction_aa: CDR3 nucleotide and amino acid sequences

  • v_call, d_call, j_call: V(D)J gene assignments

  • duplicate_count: UMI count for the sequence

  • productive: Whether the sequence is in-frame and functional

Details

Supported file formats: AIRR format (_airr.tsv) - Standard AIRR rearrangement TSV from Cell Ranger. Contig annotations (_contig_annotations.csv) - Legacy Cell Ranger CSV format. Legacy 10x - Older TSV formats (automatically detected and converted).

Usage with single-cell data: After importing, use merge_chains() to pair alpha/beta chains from the same cell. For example: sc_data <- read10x("path/to/10x_output/") followed by paired <- merge_chains(sc_data, mode = "strict").

File naming: The repertoire_id is extracted from the filename. For example, Sample1_airr.tsv becomes repertoire_id = "Sample1".