sample_statistics {ISAnalytics}R Documentation

Computes user specified functions on numerical columns and updates the metadata data frame accordingly.

Description

[Experimental] The function operates on a data frame by grouping the content by the sample key and computing every function specified on every column in the value_columns parameter. After that the metadata data frame is updated by including the computed results as columns for the corresponding key. For this reason it's required that both x and metadata have the same sample key, and it's particularly important if the user is working with previously aggregated data. For example:

data("integration_matrices", package = "ISAnalytics")
data("association_file", package = "ISAnalytics")
aggreg <- aggregate_values_by_key(
 x = integration_matrices,
 association_file = association_file,
 value_cols = c("seqCount", "fragmentEstimate")
)
aggreg_meta <- aggregate_metadata(association_file = association_file)

sample_stats <- sample_statistics(x = aggreg,
metadata = aggreg_meta,
value_columns = c("seqCount", "fragmentEstimate"),
sample_key = c("SubjectID", "CellMarker","Tissue", "TimePoint"))

Usage

sample_statistics(
  x,
  metadata,
  sample_key = "CompleteAmplificationID",
  value_columns = "Value",
  functions = default_stats(),
  add_integrations_count = TRUE
)

Arguments

x

A data frame

metadata

The metadata data frame

sample_key

Character vector representing the key for identifying a sample

value_columns

The name of the columns to be computed, must be numeric or integer

functions

A named list of function or purrr-style lambdas

add_integrations_count

Add the count of distinct integration sites for each group? Can be computed only if x contains the mandatory columns chr, integration_locus, strand

Value

A list with modified x and metadata data frames

See Also

Other Analysis functions: CIS_grubbs(), comparison_matrix(), compute_abundance(), cumulative_count_union(), cumulative_is(), is_sharing(), iss_source(), purity_filter(), separate_quant_matrices(), threshold_filter(), top_integrations()

Examples

data("integration_matrices", package = "ISAnalytics")
data("association_file", package = "ISAnalytics")
stats <- sample_statistics(
    x = integration_matrices,
    metadata = association_file,
    value_columns = c("seqCount", "fragmentEstimate")
)
stats

[Package ISAnalytics version 1.4.3 Index]