calcPhenotype


library(oncoPredict)
#> 

#This script provides an example of how to use calcPhenotype() for drug response prediction as well as its optional #parameters. 

#Set the seed for reproducibility. 
set.seed(12345)

#Determine parameters for calcPhenotype() function.

#Read training data for GDSC (expression and response)
#_______________________________________________________

#GDSC1 Data
#Read GDSC training expression data. rownames() are genes and colnames() are samples (cell lines/cosmic ids).
#trainingExprData=(readRDS("GDSC1_Expr.rds"))
#dim(trainingExprData) #17419 958 
#Read GDSC1 response data. rownames() are samples (cell lines, cosmic ids), colnames() are drugs.
#trainingPtype = (readRDS("GDSC1_Res.rds"))
#dim(trainingPtype) #958 367 For GDSC1
#trainingPtype<-trainingPtype[,1:2] #Just 2 drugs for the vignette.

#GDSC2 Data
#Read GDSC training expression data. rownames() are genes and colnames() are samples.
#trainingExprData=readRDS(file='GDSC2_Expr.rds')
#dim(trainingExprData) #17419 805
#Read GDSC2 response data. rownames() are samples, colnames() are drugs. 
trainingPtype = readRDS(file = "GDSC2_Res.rds")
#dim(trainingPtype) #805 198

#GDSC2 expression data for the vignette (it's a much smaller sampling)
trainingExprData=readRDS(file='GDSC2_Expr_short.rds')
#dim(trainingExprData) #1000 400

#IMPORTANT note: here I do e^IC50 since the IC50s are actual ln values/log transformed already, and the calcPhenotype function Paul #has will do a power transformation (I assumed it would be better to not have both transformations)
trainingPtype<-exp(trainingPtype) 

#Or read training data for CTRP (expression and response)
#_______________________________________________________
#Read CTRP training expression data. rownames() are genes and colnames() are samples (cell lines/cosmic ids).
#trainingExprData = readRDS(file = "CTRP2_Expr.rds")
#dim(trainingExprData) #51847 829
#Read CTRP training response data. rownames() are samples (cell lines, cosmic ids), colnames() are drugs.
#trainingPtype = readRDS(file = "CTRP2_Res.rds")
#dim(trainingPtype) #829 545 

#Test data. 
#_______________________________________________________
#Read testing data as a matrix with rownames() as genes and colnames() as samples.
testExprData=as.matrix(read.table('prostate_test_data.txt', header=TRUE, row.names=1))
#dim(testExprData) #20530 550

#Additional parameters. 
#_______________________________________________________
#batchCorrect options: "eb" for ComBat, "qn" for quantiles normalization, "standardize", or "none"
#"eb" is good to use when you use microarray training data to build models on microarray testing data.
#"standardize is good to use when you use microarray training data to build models on RNA-seq testing data (this is what Paul used in the 2017 IDWAS paper that used GDSC microarray to impute in TCGA RNA-Seq data, see methods section of that paper for rationale)
batchCorrect<-"eb"

#Determine whether or not to power transform the phenotype data.
#Default is TRUE.
powerTransformPhenotype<-TRUE

#Determine percentage of low varying genes to remove.
#Default is 0.2 (seemingly arbitrary).
removeLowVaryingGenes<-0.2

#Determine method to remove low varying genes.
#Options are 'homogenizeData' and 'rawData'
#homogenizeData is likely better if there is ComBat batch correction, raw data was used in the 2017 IDWAS paper that used GDSC microarray to impute in TCGA RNA-Seq data.
removeLowVaringGenesFrom<-"homogenizeData"

#Determine the minimum number of training samples required to train on.
#Note: this shouldn't be an issue if you train using GDSC or CTRP because there are many samples in both training datasets.
#10, I believe, is arbitrary and testing could be done to get a better number.
minNumSamples=10

#Determine how you would like to deal with duplicate gene IDs.
#Sometimes based on how you clean the data, there shouldn't be any duplicates to deal with.
#Options are -1 for ask user, 1 for summarize by mean, and 2 for disregard duplicates
selection<- 1

#Determine if you'd like to print outputs.
#Default is TRUE.
printOutput=TRUE

#Indicate whether or not you'd like to use PCA for feature/gene reduction. Options are 'TRUE' and 'FALSE'.
#Note: If you indicate 'report_pca=TRUE' you need to also indicate 'pca=TRUE'
pcr=FALSE

#Indicate whether you want to output the principal components. Options are 'TRUE' and 'FALSE'.
report_pc=FALSE

#Indicate if you want correlation coefficients for biomarker discovery. These are the correlations between a given gene of interest across all samples vs. a given drug response across samples.
#These correlations can be ranked to obtain a ranked correlation to determine highly correlated drug-gene associations.
cc=FALSE

#Indicate whether or not you want to output the R^2 values for the data you train on from true and predicted values.
#These values represent the percentage in which the optimal model accounts for the variance in the training data.
#Options are 'TRUE' and 'FALSE'.
rsq=FALSE

#Indicate percent variability (of the training data) you'd like principal components to reflect if pcr=TRUE. Default is .80
percent=80

#Run the calcPhenotype() function using the parameters you specified above.
#__________________________________________________________________________________________________________________________________
wd<-tempdir()
savedir<-setwd(wd)

calcPhenotype(trainingExprData=trainingExprData,
              trainingPtype=trainingPtype,
              testExprData=testExprData,
              batchCorrect=batchCorrect,
              powerTransformPhenotype=powerTransformPhenotype,
              removeLowVaryingGenes=removeLowVaryingGenes,
              minNumSamples=minNumSamples,
              selection=selection,
              printOutput=printOutput,
              pcr=pcr,
              removeLowVaringGenesFrom=removeLowVaringGenesFrom,
              report_pc=report_pc,
              cc=cc,
              percent=percent,
              rsq=rsq)
#> 
#>  20  gene identifiers overlap between the supplied expression matrices... 
#> 
#> Found2batches
#> Adjusting for0covariate(s) or covariate level(s)
#> Standardizing Data across genes
#> Fitting L/S model and finding priors
#> Finding parametric adjustments
#> Adjusting the Data
#> 
#>  4 low variabilty genes filtered.
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 1 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 2 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 3 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 4 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 5 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 6 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 7 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 8 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 9 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 10 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 11 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 12 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 13 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 14 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 15 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 16 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 17 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 18 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 19 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 20 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 21 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 22 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 23 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 24 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 25 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 26 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 27 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 28 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 29 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 30 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 31 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 32 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 33 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 34 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 35 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 36 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 37 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 38 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 39 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 40 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 41 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 42 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 43 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 44 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 45 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 46 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 47 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 48 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 49 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 50 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 51 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 52 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 53 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 54 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 55 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 56 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 57 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 58 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 59 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 60 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 61 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 62 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 63 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 64 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 65 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 66 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 67 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 68 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 69 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 70 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 71 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 72 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 73 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 74 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 75 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 76 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 77 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 78 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 79 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 80 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 81 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 82 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 83 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 84 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 85 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 86 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 87 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 88 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 89 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 90 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 91 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 92 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 93 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 94 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 95 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 96 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 97 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 98 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 99 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 100 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 101 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 102 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 103 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 104 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 105 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 106 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 107 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 108 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 109 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 110 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 111 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 112 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 113 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 114 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 115 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 116 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 117 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 118 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 119 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 120 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 121 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 122 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 123 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 124 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 125 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 126 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 127 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 128 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 129 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 130 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 131 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 132 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 133 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 134 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 135 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 136 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 137 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 138 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 139 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 140 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 141 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 142 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 143 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 144 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 145 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 146 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 147 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 148 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 149 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 150 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 151 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 152 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 153 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 154 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 155 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 156 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 157 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 158 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 159 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 160 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 161 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 162 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 163 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 164 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 165 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 166 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 167 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 168 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 169 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 170 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 171 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 172 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 173 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 174 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 175 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 176 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 177 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 178 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 179 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 180 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 181 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 182 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 183 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 184 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 185 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 186 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 187 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 188 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 189 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 190 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 191 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 192 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 193 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 194 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 195 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 196 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 197 of 198
#> 
#> Fitting Ridge Regression model...
#> 
#> Calculating predicted phenotype...
#> 
#> Done making prediction for drug 198 of 198
#> Warning in write.csv(DrugPredictions_mat, file =
#> "./calcPhenotype_Output/DrugPredictions.csv", : attempt to set 'col.names'
#> ignored

#If pcr is performed, you can view a drug's first two principal components (and so on) using the code below. 
#View(load('./calcPhenotype_Output/Vinblastine_1004.RData'))
#View(pcs[,1,1]) #The first pc. 
#View(pcs[,1,2]) #The second pc.