-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeQTLobjects.R
50 lines (36 loc) · 1.87 KB
/
MakeQTLobjects.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# code written by Paul Tanger, Brook Moyers or John Lovell. Please cite appropriately.
setwd("../input")
load("crossFinalLSmeansOrderFixedReRunCalcGeno_20150624_1158.Robject")
load("FinalLSmeansstepwiseDFafterfixchr_20150624_1332.RObject")
# remove epistatic
modeldf2 = lsmeansmodeldf[!is.na(lsmeansmodeldf$chromosome),]
# remove DTF
modeldf3 = modeldf2[!(modeldf2$phenotype == "DTF_LSmeans"),]
# modeldf3 = lsmeansmodeldf
# subset biomass
biomass = subset(modeldf3, phenotype == "biomass_LSmeans")
biomassmodel = makeqtl(cross, chr=biomass$chromosome, pos=biomass$position, qtl.name=biomass$id, what="prob")
biomassmodel = refineqtl(cross, pheno.col = "biomass_LSmeans", biomassmodel, method="hk")
# save these for lovell to play with
filename = addStampToFilename("biomassQTLmodel", "Robject")
# save(biomassmodel, file=filename)
plotLodProfile(biomassmodel)
load("biomassQTLmodel_20150727_1345.Robject")
library(RCurl)
script <- getURL("https://raw.githubusercontent.com/jtlovell/eQTL_functions/master/lodProfileGGplot.R", ssl.verifypeer = FALSE)
eval(parse(text = script))
# makeLpPlot(cross=crossObject, models=listOfModels, formulae=listOfFormulae, covar=nullUnlessCovariateWasUsed, allchr=T/F dependingOnIfYouWantAllChrsPlotted, ... PassedOnToGeom_line)
# make list of models
biomasslist = list(biomassmodel)
names(biomasslist) = "biomass_LSmeans"
# get list of formula from stepwiseqtl model
load("FinalLSmeansstepwiseoutputMaxQTL10AfterFixChrOrder_20150624_1227.Robject")
biomassformula = formula(modelList[[1]])
listOfFormulae = list(biomassformula)
names(listOfFormulae) = "biomass_LSmeans"
library(plyr)
makeLpPlot(cross=cross, models=biomasslist, formulae=listOfFormulae, covar=NULL, allchr=T)
plotLodProfile(modelList[[1]])
# all together
formulaList<-lapply(modelList, function(x) attr(x, "formula"))
makeLpPlot(cross=cross, models=modelList, formulae=formulaList, covar=NULL, allchr=F)