getFrequencies: Calculate features frequencies for a given experiment in...

getFrequenciesR Documentation

Calculate features frequencies for a given experiment in MiDAS object.

Description

Calculate features frequencies for a given experiment in MiDAS object.

Usage

getFrequencies(
  object,
  experiment,
  carrier_frequency = FALSE,
  compare = FALSE,
  ref_pop = list(hla_alleles = c("USA NMDP African American pop 2", "USA NMDP Chinese",
    "USA NMDP European Caucasian", "USA NMDP Hispanic South or Central American",
    "USA NMDP Japanese", "USA NMDP North American Amerindian",
    "USA NMDP South Asian Indian"), kir_genes = c("USA California African American KIR",
    "USA California Asian American KIR", "USA California Caucasians KIR",
    "USA California Hispanic KIR")),
  ref = list(hla_alleles = allele_frequencies, kir_genes = kir_frequencies)
)

Arguments

object

MiDAS object.

experiment

Matrix or SummarizedExperiment object.

carrier_frequency

Logical flag indicating if carrier frequency should be returned.

compare

Logical flag indicating if hla_calls frequencies should be compared to reference frequencies given in ref.

ref_pop

Named list of character vectors giving names of reference populations in ref to compare with. Optionally vectors can be named, then those names will be used as population names. Each vector should correspond to a specific experiment.

ref

Named list of reference frequencies data frames. Each element should give reference for a specific experiment. See allele_frequencies for an example on how reference frequency data frame should be formatted.

Value

Data frame with features from selected experiment and their corresponding frequencies. Column "term" hold features names, "Counts" hold number of feature occurrences, "Freq" hold feature frequencies. If argument compare is set to TRUE, further columns will hold frequencies in reference populations.

Examples

# using default reference populations
getFrequencies(object = MiDAS_tut_object, 
               experiment = "hla_alleles", 
               compare = TRUE)

# using customized set of reference populations
getFrequencies(
  object = MiDAS_tut_object, 
  experiment = "hla_alleles", 
  compare = TRUE,
  ref_pop = list(
    hla_alleles = c("USA NMDP Chinese", "USA NMDP European Caucasian")
  ),
  ref = list(hla_alleles = allele_frequencies)
)


Genentech/midasHLA documentation built on Feb. 12, 2024, 9:38 a.m.