extended_documentation.md

September 9, 2019 ยท View on GitHub

Extended documentation

Data specification

The following table details the expected columns in an annotations data.table. Note that

NameTypeDescription
sequence_alignmentstringAligned portion of query sequence. By default constrained to variable region, but not required. Synonymous with "mature" sequence in sumrep.
germline_alignmentstringAssembled, aligned, fully length inferred germline sequence spanning the same region as the sequence_alignment field. Synonymous with "naive" sequence in sumrep.
v_callstringV gene with or without allele. For example, IGHV4-59*01.
d_callstringD gene with or without allele. For example, IGHD3-10*01.
j_callstringJ gene with or without allele. For example, IGHJ4*02.
junctionstringJunction region nucleotide sequence, where the junction is defined as the CDR3 plus the two flanking conserved codons.
junction_aastringJunction region amino acid sequence.
vj_in_framebooleanTrue if the V and J segment alignments are in-frame.
v_3p_delintegerNumber of nucleotides in the V 3' deletion.
d_5p_delintegerNumber of nucleotides in the D 5' deletion.
d_3p_delintegerNumber of nucleotides in the D 3' deletion.
j_5p_delintegerNumber of nucleotides in the J 5' deletion.
vd_insertionstringSequence of the insertion between the V and D segments (for heavy/beta chains).
dj_insertionstringSequence of the insertion between the D and J segments (for heavy/beta chains).
vj_insertionstringSequence of the insertion between the V and J segments (for light/alpha chains).
np1_lengthintegerNumber of nucleotides between the V and D segments or V and J segments.
np2_lengthintegerNumber of nucleotides between the D and J segments (for heavy/beta chains).
clone_idintegerClonal familiy cluster assignment for the query sequence.

Most of these names and definitions come directly from the AIRR standard, with some exceptions and modifications. Not every column is strictly required for sumrep to work (e.g., TCR datasets to not need a clone_id), but you will only be able to use functions for which the required columns are present. See specific function man pages for more details.

Summary functions

The following table details the available distribution retrieval functions in sumrep:

sumrep functionSummary statisticDefault column(s)Packages usedComments
getPairwiseDistanceDistributionVector of Levenshtein distances of each sequence to each other sequencesequence_alignmentstringdist
getNearestNeighborDistributionVector of nearest neighbor (NN) distances, where the NN distance of a sequence is the minimum Levenshtein distance to each other sequencesequence_alignmentstringdistThe parameter k can be specified to yield the k th nearest neighbor distribution. k = 1 by default. The approximate NN distribution can only be computed when k = 1.
getGCContentDistributionVector of sequence-wise GC contentssequence_alignmentape
getHotspotCountDistributionVector of sequence-wise hotspot countssequence_alignmentBiostrings"WRC" and "WA" are default hotspot motifs
getColdspotCountDistributionVector of sequence-wise coldspot countssequence_alignmentBiostrings"SYC" are default coldspot motifs
getCDR3LengthDistributionVector of CDR3 lengths, including conserved CDR3 anchorsjunction_aa, junction, or junction_length
getCDR3PairwiseDistanceDistributionVector of pairwise Levenshtein distances of CDR3 sequencesjunction_aa
getAtchleyFactorDistributionsVector of each of the five Atchley factorsjunction_aaHDMD
getKideraFactorDistributionsVector of each of the ten Kidera factorsjunction_aaPeptides
getAliphaticIndexDistributionVector of sequence-wise aliphatic indicesjunction_aaPeptides
getGRAVYDistributionVector of GRAVY indicesjunction_aaalakazam
getPolarityDistributionVector of sequence-wise polarity valuesjunction_aaalakazam
getChargeDistributionVector of sequence-wise charge valuesjunction_aaalakazam
getBasicityDistributionVector of sequence-wise basicity valuesjunction_aaalakazam
getAcidityDistributionVector of sequence-wise acidity valuesjunction_aaalakazam
getAromaticityDistributionVector of sequence-wise aromaticity valuesjunction_aaalakazam
getBulkinessDistributionVector of sequence-wise bulkiness valuesjunction_aaalakazam
getPerGeneMutationRatesList of mutation rates of each observed germline geneN/A
getPerGenePerPositionMutationRatesList of mutation rate vectors over each position, over each observed germline geneN/A
getSubstitutionModelInferred substitution matrix for somatically hypermutated sequencessequence_alignment, germline_alignment, v_callshazam
getMutabilityModelInferred mutability matrix for somatically hypermutated sequencessequence_alignment, germline_alignment, v_callshazam
getPositionalDistanceBetweenMutationsDistributionVector of positional distances between mutations over all sequencessequence_alignment, germline_alignmentDefined only for sequence reads with two or more mutations from the inferred germline ancestor
getDistanceFromGermlineToSequenceDistributionVector of Levenshtein distances from germline_alignment to sequence_alignmentsequence_alignment, germline_alignmentstringdist
getVGene3PrimeDeletionLengthDistributionVector of V 3' intron lengthsv_3p_del
getVGene5PrimeDeletionLengthDistributionVector of V 5' intron lengthsv_5p_del
getDGene3PrimeDeletionLengthDistributionVector of D 3' intron lengthsd_3p_del
getDGene5PrimeDeletionLengthDistributionVector of D 5' intron lengthsd_5p_del
getJGene3PrimeDeletionLengthDistributionVector of J 3' intron lengthsj_3p_del
getJGene5PrimeDeletionLengthDistributionVector of J 5' intron lengthsj_5p_del
getVDInsertionLengthDistributionVector of VD exon lengthsnp1_length
getDJInsertionLengthDistributionVector of DJ exon lengthsnp2_length
getVJInsertionLengthDistributionVector of VJ exon lengthsnp1_length
getVDInsertionMatrixEmpirical transition matrix for VD exonsvd_insertion
getDJInsertionMatrixEmpirical transition matrix for DJ exonsdj_insertion
getVJInsertionMatrixEmpirical transition matrix for VJ exonsvj_insertion
getInFramePercentagePercentage of sequences whose V and J regions are in-framevj_in_frame
getClusterSizeDistributionVector of clonal family cluster sizesclone_id
getHillNumbersVector of Hill numbers of the supplied diversity orders of clonal family clustersclone_idalakazam
getSelectionEstimateVector of estimated selection strengths of clonal family clusterssequence_alignment, germline_alignmentshazamThis method uses shazam::calcBaseline to compute the BASELINe posterior density for estimating selection
getSackinIndexScalar Sackin balance index of a treeN/ACollessLike
getCollessLikeIndexScalar Colless-like balance index of a treeN/ACollessLike
getCopheneticIndexScalar Cophenetic index/correlation of a treeN/ACollessLike

In general, these summaries are grouped into hierarchical levels, whose assumptions are described in the following table.

LevelAssumptionsMain expected column(s)
0Nonesequence
1Pairwise alignmentsequence_alignment
2Annotationsgermline_alignment, junction_aa
3Clonal family clusteringclone_id
4Phylogenies (BCR only)N/A

The various indel statistics tabulated above depend on the locus (e.g., whether or not D gene statistics are relevant) and fall into the Level 2 category. These levels are hierarchical in that each level depends on the assumptions of the previous level. For example, to obtain annotations, you would have first needed to pairwise align the sequences. Level 0 includes raw query sequences and, while supported, does not comprise the default level for any sumrep function. Level 4 includes tree statistics for clonal family trees of BCR sequences; while sumrep currently contains some tree functions, these functions have not yet been tested on experimental data or incorporated in comparison routines.

Gene usage summaries and comparisons

Comparisons involving gene usage distributions, in particular compareVGeneDistributions, compareDGeneDistributions, compareJGeneDistributions, and compareVDJDistributions, do not have corresponding getter functions in the form of getXDistribution. This is due to the logic behind computing these divergences, which relies on contingency (frequency) tables rather than distribution vectors like the other summaries. The following table details the analogous getter functions driving these comparison functions.

sumrep comparison functionsumrep getter functionDefault column(s)
compareVGeneDistributionscompareGermlineGeneDistributionsv_call
compareDGeneDistributionscompareGermlineGeneDistributionsd_call
compareJGeneDistributionscompareGermlineGeneDistributionsj_call
compareVDJDistributionscompareJointGeneDistributionsv_call, d_call, j_call