run_decouple: Run decouple

View source: R/run_decouple.R

run_decoupleR Documentation

Run decouple

Description

The function run_decouple runs decouple on scores of lipid features. The scores can be e.g. logFC- or t-values. Mappings between the metabolites and ChEBI ids will be done via the data structure of reaction_l, as returned by create_reactions. The function run_decouple will run the following models from decoupleR: ulm, mlm, wsum, and wmean.

Usage

run_decouple(
  reaction_l,
  scores,
  col_feature = "feature",
  col_score = "score",
  ...
)

Arguments

reaction_l

list as obtained from create_reactions

scores

data.frame containing statistics for each feature

col_feature

character of length 1, specifying the column in scores that contains the feature names

col_score

character of length 1, specifying the column in scores that contains the scores

...

further arguments passed to args in decouple for the models mlm, ulm, wsum, wmean

Details

The function run_decouple accepts the output of the create_reactions function. From create_reactions, the ChEBI ids will be inferred.

The function returns different type of values as results depending on the model:

  • ulm: t-values of the fitted linear model

  • mlm: t-values of the fitted linear model

  • wsum: scores of each target are multiplied by its associated weight and then summed

  • norm_wsum: z-scores from a null distribution obtained by permutation of random target features and calculation of weighted summed scores

  • corr_wsum: corrected estimates of wsum scores obtained by multiplying wsum scores by -log10(obtained empirical p-values)

  • wmean: scores of each target are multiplied by its associated weight and then averaged

  • norm_wmean: z-scores from a null distribution obtained by permutation of random target features and calculation of weighted averaged scores

  • corr_wmean: corrected estimates of wmean scores obtained by multiplying wmean scores by the -log10(obtained empirical p-values)

The values correspond to the (de)regulation values for the lipid classes represented as ChEBI ids.

Value

tibble

Author(s)

Thomas Naake, thomasnaake@googlemail.com

Examples

FA <- c("FA(12:0)", "FA(14:0)", "FA(16:0)")

## create data.frame with reactions and reaction order
reactions <- rbind(
    c(1, "RHEA:15421", "M_ATP + M_CoA + M_FA = M_PPi + M_AMP + M_AcylCoA", FALSE),
    c(2, "RHEA:15325", "M_Glycerol-3-P + M_AcylCoA = M_CoA + M_LPA", FALSE),
    c(3, "RHEA:19709", "M_AcylCoA + M_LPA = M_CoA + M_PA", FALSE)
)
reactions <- data.frame(order = reactions[, 1], reaction_RHEA = reactions[, 2],
    reaction_formula = reactions[, 3], directed = reactions[, 4])
reactions$order <- as.numeric(reactions$order)
reactions$directed <- as.logical(reactions$directed)

## create the list with reactions
reaction_l <- create_reactions(substrates = list(FA = FA), reactions = reactions)

## create scores (simulate scores via rnorm with sd = 2)
scores <- rbind(
    c("AMP", 0.94446911),
    c("ATP", 0.78505230),
    c("CoA", 2.90333236),
    c("CoA(12:0)", 0.13577818),
    c("CoA(14:0)", 0.64465176),
    c("CoA(16:0)", 0.26128554),
    c("FA(12:0)", -1.98870069),
    c("FA(14:0)", -2.17736671),
    c("FA(16:0)", -2.41113650),
    c("Glycerol-3-P", -0.84185713 ),
    c("PA(12:0/0:0)", -2.12108629),
    c("PA(12:0/12:0)", 1.60395612),
    c("PA(12:0/14:0)", 0.07693279),
    c("PA(12:0/16:0)", 2.46639841),
    c("PA(14:0/0:0)", -1.73630919),
    c("PA(14:0/12:0)", 1.32713790),
    c("PA(14:0/14:0)", 3.78234917),
    c("PA(14:0/16:0)", 1.88168721),
    c("PA(16:0/0:0)", -0.84712629),
    c("PA(16:0/12:0)", 4.16900272),
    c("PA(16:0/14:0)", 2.07352961),
    c("PA(16:0/16:0)", 4.48556057), 
    c("PPi", -0.28139118)
)
scores <- data.frame(feature = scores[, 1], score = scores[, 2])
scores$feature <- as.character(scores$feature)
scores$score <- as.numeric(scores$score)

## run the function
run_decouple(reaction_l = reaction_l, scores = scores)

michaelwitting/wormLipidPredictR documentation built on Jan. 20, 2025, 3:14 p.m.