convertToASC: Prepare AIRR-seq data and germline for haplotype inference...

View source: R/asc_support.R

convertToASCR Documentation

Prepare AIRR-seq data and germline for haplotype inference with allele similarity clusters (ASC)

Description

convertToASC converts IMGT-named V alleles to PIgLET Allele Similarity Cluster (ASC) names and returns the pieces needed to run createFullHaplotype on the clustered data. ASCs collapse near-identical and duplicated IGHV alleles (for example IGHV1-69 / IGHV1-69D) that are otherwise difficult to assign unambiguously, and provide a naming scheme compatible with OGRDB reference sets. It is a thin wrapper around the piglet package.

Usage

convertToASC(
  clip_db,
  germline,
  chain = c("IGH", "IGK", "IGL", "TRB"),
  allele_cluster_table = NULL,
  v_call = "v_call",
  ...
)

Arguments

clip_db

AIRR-seq repertoire data.frame.

germline

named vector of IMGT-gapped germline sequences for the V genes (e.g. HVGERM).

chain

the chain. One of "IGH", "IGK", "IGL" or "TRB".

allele_cluster_table

optional precomputed ASC table (a data.frame with iuis_allele and new_allele columns, as produced by piglet::inferAlleleClusters() or downloaded from OGRDB with piglet::recentAlleleClusters() / piglet::extractASCTable()). If NULL it is inferred from germline.

v_call

the column holding the V allele calls to convert. Default "v_call".

...

further arguments passed to piglet::inferAlleleClusters() when allele_cluster_table is inferred.

Details

The returned objects feed directly into the standard workflow:

asc <- convertToASC(clip_db, HVGERM, chain = "IGH")
hap <- createFullHaplotype(asc$clip_db, toHap_col = "v_call",
                           hapBy_col = "j_call", hapBy = "IGHJ6",
                           toHap_GERM = asc$germline, chain = "IGH")
plotHaplotype(hap, genes_order = asc$genes_order)

Allele similarity clustering is applied to the V genes only; D and J calls are left unchanged.

Value

a list with:

  • clip_db - the input data with v_call converted to ASC names.

  • germline - the ASC-named germline vector to pass as toHap_GERM.

  • genes_order - an ASC gene order (derived from the chromosomal order in GENE.loc) to pass to the plotting functions.

  • allele_cluster_table - the ASC table that was used.

See Also

createFullHaplotype; the piglet package for the underlying clustering (inferAlleleClusters, assignAlleleClusters, germlineASC).

Examples


# requires the Suggested 'piglet' package
if (requireNamespace("piglet", quietly = TRUE)) {
  data(samples_db, HVGERM)
  clip_db <- samples_db[samples_db$subject == "I5", ]
  asc <- convertToASC(clip_db, HVGERM, chain = "IGH")
  hap <- createFullHaplotype(asc$clip_db, toHap_col = "v_call",
                             hapBy_col = "j_call", hapBy = "IGHJ6",
                             toHap_GERM = asc$germline, chain = "IGH")
  plotHaplotype(hap, genes_order = asc$genes_order)
}



rabhit documentation built on July 24, 2026, 5:07 p.m.