R/subset_phenos.R

Defines functions subset_phenos

Documented in subset_phenos

#' Subset RD EWCE results
#'
#' This subsets  the Rare disease EWCE results by cell type,
#'  q threshold and fold change.
#' @inheritParams ggnetwork_plot_full
#' @inheritParams KGExplorer::filter_dt
#' @inheritParams HPOExplorer::filter_descendants
#' @returns A data frame of results taken from the main data frame of results.
#' @export
#' @examples
#' phenos <- subset_phenos(filters = list(CellType = "Cardiomyocytes"),
#'                         keep_descendants = "Neurodevelopmental delay")
subset_phenos <- function(filters = NULL,
                          keep_descendants = NULL,
                          results = load_example_results(),
                          hpo = HPOExplorer::get_hpo(),
                          q_threshold = 0.0005,
                          effect_threshold = 1,
                          verbose = TRUE) {
  #### Subset by q, effect, and celltype ####
  phenos <- subset_results(filters = filters,
                           results = results,
                           q_threshold = q_threshold,
                           effect_threshold = effect_threshold,
                           verbose = verbose)
  #### Subset by ancestor ####
  phenos <- HPOExplorer::filter_descendants(phenos = phenos,
                                            keep_descendants = keep_descendants,
                                            hpo = hpo)
  return(phenos)
}
neurogenomics/MultiEWCE documentation built on Sept. 28, 2024, 2:27 a.m.