combineBCR: Combining the list of B cell receptor contigs into clones

View source: R/combineContigs.R

combineBCRR Documentation

Combining the list of B cell receptor contigs into clones

Description

This function consolidates a list of BCR sequencing results to the level of the individual cell barcodes. Using the samples and ID parameters, the function will add the strings as prefixes to prevent issues with repeated barcodes. The resulting new barcodes will need to match the Seurat or SCE object in order to use, combineExpression(). Unlike combineTCR(), combineBCR produces a column CTstrict of an index of nucleotide sequence and the corresponding V gene. This index automatically calculates the Levenshtein distance between sequences with the same V gene and will index sequences using a normalized Levenshtein distance with the same ID. After which, clone clusters are called using the igraph::components() function. Clones that are clustered across multiple sequences will then be labeled with "Cluster" in the CTstrict header.

Usage

combineBCR(
  input.data,
  samples = NULL,
  ID = NULL,
  call.related.clones = TRUE,
  threshold = 0.85,
  removeNA = FALSE,
  removeMulti = FALSE,
  filterMulti = TRUE,
  filterNonproductive = TRUE
)

Arguments

input.data

List of filtered contig annotations or outputs from loadContigs().

samples

The labels of samples (required).

ID

The additional sample labeling (optional).

call.related.clones

Use the nucleotide sequence and V gene to call related clones. Default is set to TRUE. FALSE will return a CTstrict or strict clone as V gene + amino acid sequence.

threshold

The normalized edit distance to consider. The higher the number the more similarity of sequence will be used for clustering.

removeNA

This will remove any chain without values.

removeMulti

This will remove barcodes with greater than 2 chains.

filterMulti

This option will allow for the selection of the highest-expressing light and heavy chains, if not calling related clones.

filterNonproductive

This option will allow for the removal of nonproductive chains if the variable exists in the contig data. Default is set to TRUE to remove nonproductive contigs.

Value

List of clones for individual cell barcodes

Examples

#Data derived from the 10x Genomics intratumoral NSCLC B cells
BCR <- read.csv("https://www.borch.dev/uploads/contigs/b_contigs.csv")
combined <- combineBCR(BCR, 
                       samples = "Patient1", 
                       threshold = 0.85)


ncborcherding/scRepertoire documentation built on Nov. 5, 2024, 2:05 p.m.