forked from lanagarmire/lilikoi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlilikoiExample.r
30 lines (22 loc) · 1.34 KB
/
lilikoiExample.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(lilikoi)
filename <- system.file("extdata", "plasma_breast_cancer.csv", package = "lilikoi")
metaboliteMeasurements <- read.csv(file = filename, check.names = FALSE, row.names = 1)
metaboliteNames <- colnames(metaboliteMeasurements)[-1]
clinicalFactorsData <- read.csv(file = system.file("extdata", "plasma_breast_cancer_Meta.csv",
package = "lilikoi"))
# The below lines shrink the dataset for faster test runs. Remove them to operate on
# full dataset
metaboliteMeasurements <- metaboliteMeasurements[, 1:20]
metaboliteNames <- colnames(metaboliteMeasurements)[-1]
metabolitePathwayTable <- lilikoi.metab_to_pathway(metaboliteNames, "name")
# We use a subset of the database to speed up tests.
# Swap the comments on the below two lines to run on the full database.
# PDSmatrix <- lilikoi.get_pd_scores(metaboliteMeasurements, metabolitePathwayTable)
PDSmatrix <- lilikoi.get_pd_scores(metaboliteMeasurements, metabolitePathwayTable,
lilikoi::data.smpdb[1:25,])
significantPathways <- lilikoi.select_pathways(PDSmatrix, metaboliteMeasurements,
threshold = 0.42, method = "gain")
mlResults <- lilikoi.machine_learning(PDSmatrix, metaboliteMeasurements$Label,
significantPathways)
finalModel <- lilikoi.adjust_model(mlResults$mlResults, PDSmatrix, significantPathways,
metaboliteMeasurements, clinicalFactorsData, factors = c("Age", "Race"))