# NOT RUN {
library(ggplot2)
# Example on the CLL data
filepath <- system.file("extdata", "CLL_model.hdf5", package = "MOFAdata")
MOFA_CLL <- loadModel(filepath)
# predict drug response data using all factors
predictedDrugs <- predict(MOFA_CLL, view="Drugs")
# predict all views using all factors (default)
predictedAll <- predict(MOFA_CLL)
# predict Mutation data using all factors, returning Bernoulli probabilities
predictedMutations <- predict(MOFA_CLL, view="Mutations", type="response")
# predict Mutation data using all factors, returning binary classes
predictedMutationsBinary <- predict(MOFA_CLL, view="Mutations", type="inRange")
# Compare the predictions with the true data
pred <- as.numeric(predictedAll$Drugs)
true <- as.numeric(getTrainData(MOFA_CLL)$Drugs)
qplot(pred,true) + geom_hex(bins=100) + coord_equal() +
geom_abline(intercept=0, slope=1, col="red")
# Example on the scMT data
filepath <- system.file("extdata", "scMT_model.hdf5", package = "MOFAdata")
MOFA_scMT <- loadModel(filepath)
# Predict all views using all factors (default)
predictedAll <- predict(MOFA_scMT)
# Compare the predictions with the true data
view <- "RNA expression"
pred <- as.numeric(predictedAll[[view]])
true <- as.numeric(getTrainData(MOFA_scMT)[[view]])
qplot(pred,true) + geom_hex(bins=100) + coord_equal() +
geom_abline(intercept=0, slope=1, col="red")
# }
Run the code above in your browser using DataLab