summariseCSR: Function to summarise details of different class-switch...

View source: R/CSR.R

summariseCSRR Documentation

Function to summarise details of different class-switch recombination events

Description

The function summarise the CSR details from getSummaryFromBatch.

Usage

summariseCSR(
  tree_stats,
  cloneID_column = "CloneID",
  dist_column = "dist",
  summarise_variables
)

Arguments

tree_stats

data.frame, output of getSummaryFromBatch (specifically the element csr_events from the output list), and annotated with extra columns detailing metadata of samples.

cloneID_column

Character, column name in getSummaryFromBatch which holds the clone ID to which the given sequence belongs. (Default: 'CloneID')

dist_column

Character, column name in getSummaryFromBatch which holds the distance-from-germline metrics. (default: 'dist')

summarise_variables

Character vector, names of columns in getSummaryFromBatch used to partition the sequences into subsets for which summary is sought.

Value

A data.frame with each row corresponding to one specific CSR switch (i.e. distinct combination of start- and end-points of the switch) in different subset of the data defined by the summarise_variables column(s). The following summaries were sought and stored in separate columns:

nEvent

Numeric, total number of switches involving the two named isotypes in the dataset subset in question.

meanDist_from_germline

Numeric, mean distance-from-germline of CSR events involving the two named isotypes.

nClone

Numeric, total number of clonotypes in the dataset subset (should be the same across all rows for the same subset of data).

nClone_events

Numeric, between 0 and 1, the proportion of clones with the named CSR switch observed.

Examples

## Not run: 
# we provide doBatchCloneAnalysis results for data from the 
# two individuals included here in this vignette
cv233 <- system.file( "extdata/CV233_batchAnalysis.rds", package = "BrepPhylo")
cv325 <- system.file( "extdata/CV325_batchAnalysis.rds", package = "BrepPhylo")

# the getSummaryFromBatch function flattens the output to two
# elements: a table containing  distance-from-germline (demonstrated 
# above) and another table of all CSR events observed in lineages
cv233 <- getSummaryFromBatch( cv233 )
cv233 <- cv233$csr_events
cv325 <- getSummaryFromBatch( cv325 )
cv325 <- cv325$csr_events
# just add an extra column with PatientID
cv233$PatientID <- "CV233"
cv325$PatientID <- "CV325"
# we can combine the two tables
csr_details <- rbind( cv233, cv325 )
csr_summary <- summariseCSR( csr_details, 
                             dist_column = "distFromGermline", 
                             cloneID_column = "CloneID",
                             summarise_variables = "PatientID")

## End(Not run)


Fraternalilab/BrepPhylo documentation built on Jan. 3, 2025, 10:03 a.m.