Function to calculate metrics for each tree in an AntibodyForests-object
Af_metrics(
input,
min.nodes,
node.feature,
group.node.feature,
multiple.objects,
metrics,
parallel,
num.cores,
output.format
)
Returns either a dataframe where the rows are trees and the columns are metrics or an AntibodyForests-object with the metrics added to trees
AntibodyForests-object(s), output from Af_build()
The minimum number of nodes in a tree to calculate metrics (including the germline).
The node feature to be used for the group.edge.length, group.node.size or group.nodes.depth metric.
The groups in the node feature to be plotted. Set to NA if all features should displayed. (default NA)
If TRUE: input should contain multiple AntibodyForests-objects (default FALSE)
The metrics to be calculated (default mean.depth and nr.nodes) 'nr.nodes' : The total number of nodes 'nr.cells' : The total number of cells in this clonotype 'mean.depth' : Mean of the number of edges connecting each node to the germline 'mean.edge.length' : Mean of the edge lengths between each node and the germline 'group.node.depth' : Mean of the number of edges connecting each node per group (node.features of the AntibodyForests-object) to the germline. 'group.edge.length' : Mean of the sum of edge length of the shortest path between germline and nodes per group (node.features of the AntibodyForests-object) 'group.node.size' : Mean of the node size per group normalized by the clone size (node.features of the AntibodyForests-object) 'sackin.index' : Sum of the number of nodes between each terminal node and the germline, normalized by the total number of terminal nodes. 'spectral.density' : Metrics of the spectral density profiles (calculated with package RPANDA)
peakedness : Tree balance
asymmetry : Shallow or deep branching events
principal eigenvalue : Phylogenetic diversity
modalities : The number of different structures within the tree
If TRUE, the metric calculations are parallelized (default FALSE)
Number of cores to be used when parallel = TRUE. (Defaults to all available cores - 1)
The format of the output. If set to "dataframe", a dataframe is returned. If set to "AntibodyForests", the metrics are added to the AntibodyForests-object. (default "dataframe")
metric_df <- Af_metrics(input = AntibodyForests::small_af,
metrics = c("mean.depth", "sackin.index"),
min.nodes = 8)
head(metric_df)
Run the code above in your browser using DataLab