iss_source: Find the source of IS by evaluating sharing.

View source: R/analysis-functions.R

iss_sourceR Documentation

Find the source of IS by evaluating sharing.

Description

[Stable] The function computes the sharing between a reference group of interest for each time point and a selection of groups of interest. In this way it is possible to observe the percentage of shared integration sites between reference and each group and identify in which time point a certain IS was observed for the first time.

Usage

iss_source(
  reference,
  selection,
  ref_group_key = c("SubjectID", "CellMarker", "Tissue", "TimePoint"),
  selection_group_key = c("SubjectID", "CellMarker", "Tissue", "TimePoint"),
  timepoint_column = "TimePoint",
  by_subject = TRUE,
  subject_column = "SubjectID"
)

Arguments

reference

A data frame containing one or more groups of reference. Groups are identified by ref_group_key

selection

A data frame containing one or more groups of interest to compare. Groups are identified by selection_group_key

ref_group_key

Character vector of column names that identify a unique group in the reference data frame

selection_group_key

Character vector of column names that identify a unique group in the selection data frame

timepoint_column

Name of the column holding time point info?

by_subject

Should calculations be performed for each subject separately?

subject_column

Name of the column holding subjects information. Relevant only if by_subject = TRUE

Value

A list of data frames or a data frame

See Also

Other Analysis functions: CIS_grubbs(), HSC_population_size_estimate(), compute_abundance(), cumulative_is(), gene_frequency_fisher(), is_sharing(), sample_statistics(), top_integrations(), top_targeted_genes()

Examples

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")
)
df1 <- aggreg |>
    dplyr::filter(.data$Tissue == "BM")
df2 <- aggreg |>
    dplyr::filter(.data$Tissue == "PB")
source <- iss_source(df1, df2)
source
ggplot2::ggplot(source$PT001, ggplot2::aes(
    x = as.factor(g2_TimePoint),
    y = sharing_perc, fill = g1
)) +
    ggplot2::geom_col() +
    ggplot2::labs(
        x = "Time point", y = "Shared IS % with MNC BM",
        title = "Source of is MNC BM vs MNC PB"
    )

calabrialab/ISAnalytics documentation built on Nov. 2, 2023, 8:57 p.m.