plot_scores | R Documentation |
The function plot_scores
creates a barplot that
visualizes the score values returned by
run_decouple
. The function will return a gtable
object that
shows a barplot for each model returned by run_decouple
.
plot_scores(scores)
scores |
tibble, output from |
The function requires the argument scores
that can be created via
run_decouple
.
gtable
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 run_decouple
scores <- run_decouple(reaction_l = reaction_l, scores = scores)
## run the function
plot_scores(scores)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.