V(D)J gene library initialization for antibody populations.
Instead of random sampling, antibodies are generated by combinatorial
assembly of gene segments, mimicking the V(D)J recombination that generates
antibody diversity in real immune systems.
Details
The feature space is decomposed into V, D, and J segments (subsets of
dimensions). Each segment is discretized into "alleles" by clustering.
New antibodies are generated by combinatorial sampling of one allele from
each segment, producing structured coverage of the data manifold.
Methods:
"pca": PCA components define gene segments
"cluster": k-means within dimension groups creates alleles
"random_partition": Random feature grouping
Public fields
nV
Number of V gene segments.
nD
Number of D gene segments.
nJ
Number of J gene segments.
method
Decomposition method.
library
The computed gene library (list of allele matrices).
Methods
Method new()
Create a new VDJLibrary.
Usage
VDJLibrary$new(nV = 10, nD = 5, nJ = 4, method = "pca")
Arguments
nV
Integer. Number of V gene alleles.
nD
Integer. Number of D gene alleles.
nJ
Integer. Number of J gene alleles.
method
Character. "pca", "cluster", or "random_partition".
Method build()
Build the gene library from training data.
Arguments
X
Numeric matrix (n x d).
Method generate()
Generate antibodies by combinatorial V(D)J assembly.
Usage
VDJLibrary$generate(nAntibodies, X)
Arguments
nAntibodies
Integer. Number of antibodies to generate.
X
Numeric matrix. Training data (used to build library if needed).
Returns
Numeric matrix (nAntibodies x d).
Method clone()
The objects of this class are cloneable with this method.
Usage
VDJLibrary$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
# Generate antibodies via V(D)J combinatorial assembly
data(iris)
X <- as.matrix(iris[, 1:4])
vdj <- VDJLibrary$new(nV = 5, nD = 3, nJ = 3, method = "pca")
A <- vdj$generate(20, X)
dim(A) # 20 x 4
#> [1] 20 4
print(vdj)
#> <VDJLibrary> method='pca' V=5 D=3 J=3
#> Combinatorial space: 45 antibodies