7 # Isaak Y Tecle (iyt2@cornell.edu)
15 library(phenoAnalysis
)
18 allArgs
<- commandArgs()
20 outputFiles
<- scan(grep("output_files", allArgs
, value
= TRUE),
23 inputFiles
<- scan(grep("input_files", allArgs
, value
= TRUE),
26 phenoDataFile
<- grep("phenotype_data", inputFiles
, value
= TRUE)
27 message('pheno file: ', phenoDataFile
)
28 traitsFile
<- grep("traits", inputFiles
, value
= TRUE)
29 message('traits file: ', traitsFile
)
31 #phenoDataFile <- '/export/prod/tmp/localhost/GBSApeKIgenotypingv4/solgs/cache/phenotype_data_139.txt';
32 #phenoDataFile <- '/mnt/hgfs/cxgn/phenotype_data_RCBD_1596.txt';
34 phenoData
<- fread(phenoDataFile
,
35 na
.strings
=c("NA", "-", " ", ".", ".."))
37 phenoData
<- data
.frame(phenoData
)
39 traits
<- scan(traitsFile
,
42 traits
<- strsplit(traits
, "\t")
44 #needs more work for multi traits anova
45 for (trait
in traits
) {
46 anovaFiles
<- grep("anova_table",
50 message('anova file: ', anovaFiles
)
51 anovaHtmlFile
<- grep("html",
55 message('anova html file: ', anovaHtmlFile
)
56 anovaTxtFile
<- grep("txt",
60 message('anova txt file: ', anovaTxtFile
)
61 modelSummFile
<- grep("anova_model",
65 message('model file: ', modelSummFile
)
66 adjMeansFile
<- grep("adj_means",
70 message('means file: ', adjMeansFile
)
73 diagnosticsFile
<- grep("anova_diagnostics",
77 anovaOut
<- runAnova(phenoData
, trait
)
79 png(diagnosticsFile
, 960, 480)
81 plot(fitted(anovaOut
), resid(anovaOut
),
84 main
="Fitted values vs Residuals")
86 qqnorm(resid(anovaOut
))
89 anovaTable
<- getAnovaTable(anovaOut
,
94 anovaTable
<- getAnovaTable(anovaOut
,
99 adjMeans
<- getAdjMeans(phenoData
, trait
)
115 q(save
= "no", runLast
= FALSE)