mutate_p_value: mutate_p_value

View source: R/mutate_p_value.R

mutate_p_valueR Documentation

mutate_p_value

Description

Calculate p values for variables.

Usage

mutate_p_value(
  object,
  control_sample_id,
  case_sample_id,
  method = c("t.test", "wilcox.test"),
  p_adjust_methods = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr",
    "none"),
  return_mass_dataset = TRUE,
  ...
)

Arguments

object

tidymass-class object.

control_sample_id

A character vector.

case_sample_id

A character vector

method

t test or wilcox test.

p_adjust_methods

see ?p.adjust

return_mass_dataset

logical default TRUE

...

other parameters

Value

object with fold change in variable_info.

Author(s)

Xiaotao Shen shenxt1990@outlook.com

Examples

library(massdataset)
library(magrittr)
library(dplyr)
data("liver_aging_pos")
liver_aging_pos

w_78 =
  liver_aging_pos %>%
  activate_mass_dataset(what = "sample_info") %>%
  dplyr::filter(group == "78W") %>%
  dplyr::pull(sample_id)

w_24 =
  liver_aging_pos %>%
  activate_mass_dataset(what = "sample_info") %>%
  dplyr::filter(group == "24W") %>%
  dplyr::pull(sample_id)

control_sample_id = w_24
case_sample_id = w_78

liver_aging_pos =
  mutate_p_value(
    object = liver_aging_pos,
    control_sample_id = control_sample_id,
    case_sample_id = case_sample_id,
    method = "t.test",
    p_adjust_methods = "BH"
  )

head(extract_variable_info(liver_aging_pos))

liver_aging_pos =
  mutate_p_value(
    object = liver_aging_pos,
    control_sample_id = control_sample_id,
    case_sample_id = case_sample_id,
    method = "wilcox.test",
    p_adjust_methods = "BH"
  )

head(extract_variable_info(liver_aging_pos))

extract_variable_info(liver_aging_pos) %>%
  ggplot(aes(-log(p_value_adjust, 10), -log(p_value_adjust.1, 10))) +
  geom_point()

tidymass/massstat documentation built on March 12, 2024, 6:24 a.m.