Hey Dr. Broman,
I am working on this RIL mapping population with 66 different phenotypes. I am at the step of looking at scantwo results and I came across this odd result and I am not sure if it is something innately wrong with my script that is causing this result. Basically scantwo works fine but when I run scantwo with operms and print my summary results into a .csv file all the phenotypes have the same two chromosomes and position interactions.
Firstly, I ran scantwo with the following command:
> out2.em.all.ALL <- scantwo(qtl.finalmap, method="em", pheno.col = phenotypes)
I have attached a document that shows an snippet of the summary results from my scantwo in the first tab.
I used the following script to export this into a .csv file:
> for (x in 1:66) {
phenotype.name <- phenames(qtl.finalmap)[x] ## This allows me to pull the name of the phenotype and print it atop the summary results
write.table(phenotype.name, "summary.out2.em.all.ALL.csv", append = TRUE, sep = ",") ## Prints name of phenotype for results below to .csv file
temp <- summary(out2.em.all.ALL, threshold=c(6.08, 4.91, 4.71, 4.67, 2.84), lodcolumn = x) ## temp value serves as something that can be written over each time this loops
write.table(temp, "summary.out2.em.all.ALL.csv", append = TRUE, sep = ",")} ## Pulls the current temp value and prints it to the csv file under the correct name
It worked really well in exporting my results. The thresholds were established from a previous run on a smaller subset of phenotypes but I wanted to continue on and use operms2 to determine qtl interactions.
I used the following script to generate my operm2 results with the tictoc package to track how long it was taking. As you can imagine running permutations with the "em" method took a while so it was helpful to track how long it was taking while doing my for loops in smaller chunks:
library(tictoc) ## Load package
tic.clearlog() ## Clear tictoc log
tic() ## start timer
for (x in 52:66) {
tic(x) ## start timer
phenotype_name <- phenames(qtl.finalmap)[x]
print(phenotype_name) # prints pheno name to visually track what stage analysis is
operm2_em_temp <- scantwo(qtl.finalmap, method = "em", n.perm = 1000, pheno.col = x, n.cluster = 15) ## assigns scantwo results to operm2_em_temp
temp <- summary(out2.em.all.ALL, perms=operm2_em_temp, alphas=c(0.05, 0.05, 0, 0.05, 0.05), pvalues=TRUE) ## Creates a temporary data value to hold the summary.scantwo results with the operm2 values
write.table(phenotype_name, "summary.operm2.em.All.csv", append = TRUE, sep = ",") ## Prints name of phenotype for results below to .csv file
write.table(temp, "summary.operm2.em.All.csv", append = TRUE, sep = ",") ## Prints summary results to summary .csv file
toc(log = TRUE, quiet = TRUE) ## stop timer for that iteration
}
log.txt <- tic.log(format = TRUE) ## Fetch results of toc()
log.lst <- tic.log(format = FALSE) ## Extract the list
timings <- unlist(lapply(log.lst, function(x) x$toc - x$tic)) ## Convert list elements to timings
mean(timings) ## average time for each iteration
writeLines(unlist(log.txt)) ## Print text output
In the attached file the second tab is the same select phenotypes but the results of the scantwo summary with the operm instead. I might be interpreting this incorrectly but from what i can see all of these have interactions between chr 2 and 9 and all have the same chromosome position as well. This doesn't seem probable (as this pattern continues with all the rest of the phenotypes). Like I mentioned maybe my for loop is wrong and acting on the incorrect phenotype and I am just missing something.
Any help would be appreciated. This whole process took me quite some time and I am just confused as to how this happened.
Thanks
Rob