diff --git a/1. Reading Raw MegaMUGA Data.R b/1. Reading Raw MegaMUGA Data.R new file mode 100644 index 0000000..fbfd2c5 --- /dev/null +++ b/1. Reading Raw MegaMUGA Data.R @@ -0,0 +1,18 @@ +library(DOQTL) +library(QTLRel) +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + +extract.raw.data(in.path = "/Volumes/External Terabyte/QTL/Founders", prefix = "", + out.path = "/Volumes/External Terabyte/QTL/extract.raw.data/Founders", + array = "megamuga") + +extract.raw.data(in.path = c("/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/1 - 96", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/2 - 23 (last plate)", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/2 - 481", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/3 - 18 (last plate)", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/4 - 600", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/5 - 12 (last plate 600)", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/6 - 648"), + prefix = c("", "", "", "", "", "", ""), + out.path = "/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD", + array = "megamuga") diff --git a/2. Genome Reconstruction.R b/2. Genome Reconstruction.R new file mode 100644 index 0000000..ae65d16 --- /dev/null +++ b/2. Genome Reconstruction.R @@ -0,0 +1,235 @@ +library(DOQTL) + +#Loading in data + +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + +extract.raw.data(in.path = "/Volumes/External Terabyte/QTL/Founders", prefix = "", + out.path = "/Volumes/External Terabyte/QTL/extract.raw.data/Founders", + array = "megamuga") + +extract.raw.data(in.path = c("/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/1 - 96", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/2 - 23 (last plate)", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/2 - 481", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/3 - 18 (last plate)", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/4 - 600", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/5 - 12 (last plate 600)", + "/Users/elijahedmondson/Desktop/R/QTL/FINAL GENOTYPE DATA/6 - 648"), + prefix = c("", "", "", "", "", "", ""), + out.path = "/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD", + array = "megamuga") + +#FIRST STEP + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + +# Read in founders. +fg = read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/Founders/geno.txt") +fg[fg == TRUE] = "T" +fx = read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/Founders/x.txt") +fy = read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/Founders/y.txt") + +# Load in data. +g = read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD/geno.txt") +g[g == TRUE] = "T" +x = read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD/x.txt") +y = read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD/y.txt") + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/") +getwd() +save(x, y, g, fx, fy, fg, file = "GRSD1878data.Rdata") + +load(file = "GRSD1878data.Rdata") + +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + +# Combine founders and samples. +x = rbind(fx, x) +y = rbind(fy, y) +g = rbind(fg, g) + +# Remove outlier samples. +rmx = rowMeans(x, na.rm = T) +rmy = rowMeans(y, na.rm = T) +plot(rmx, rmy) +remove = which(rmx > 0.6) + +View(remove) +list(remove) +[[1]] +97 237 1392 650 1614 1653 1697 1657 1671 1633 1707 1790 1636 +1639 1641 1686 1319 1429 1432 1414 1417 1419 1446 +627 783 903 1138 1245 1258 1259 1264 1282 1287 1289 1291 1293 +1299 1305 1306 1662 1794 1802 1825 1841 1849 1850 + +x = x[-remove,] +y = y[-remove,] +g = g[-remove,] + +sex = sex.predict(x, y, MM_snps, plot=T) +list(sex) +View(sex) + + +# All of the HS sample IDs are numbers. +fndr.idx = which(is.na(as.numeric(rownames(x)))) +samp.idx = which(!is.na(as.numeric(rownames(x)))) +fsex = sex[fndr.idx] +sex = sex[samp.idx] + +fx = x[fndr.idx,] +fy = y[fndr.idx,] +fg = g[fndr.idx,] +x = x[samp.idx,] +y = y[samp.idx,] +g = g[samp.idx,] + +# A: A/J +# B: AKR/J +# C: BALB/cJ +# D: C3H/HeJ +# E: C57BL/6J +# F: CBA/J +# G: DBA/2J +# H: LP/J + +#This needs to be specific for the data set and in order +code = c("HH", "EE", "AA", "BB", "CC", "FF", "DD", "GG") +names(code) = rownames(fx) +gen = rep(70, nrow(x)) +names(gen) = rownames(x) + +states = DOQTL:::create.genotype.states(LETTERS[1:8]) + +data = list(geno = as.matrix(g), sex = sex, gen = gen) +founders = list(geno = fg, sex = fsex, code = code, states = states) + +# We only have male founders. +# For the allele call method, we're going to fake out the HMM by duplicating +# the males and calling them females. +founders$geno = as.matrix(rbind(founders$geno, founders$geno)) +founders$sex = c(founders$sex, rep("F", length(founders$sex))) +names(founders$sex) = rownames(founders$geno) +founders$code = c(founders$code, founders$code) +names(founders$code) = rownames(founders$geno) + +# +attr(founders, "method") = "allele" +founders = add.missing.F1s(founders, MM_snps[,1:4]) + +getwd() +ls() + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + + +calc.genoprob(data = data, chr = c(1:19, "X"), output.dir = "/Users/elijahedmondson/Desktop/R/QTL/HMM", + plot = T, array = "megamuga", sampletype = "HS", method = "allele", founders = founders) + + +plot.genoprobs(x = prsmth, snps = MM_snps, main = "1696") + +recomb = summarize.genotype.transitions(path = "/Users/elijahedmondson/Desktop/R/QTL/HMM", snps = MM_snps) +head(recomb[[1]]) +View(recomb) +mean(sapply(recomb, nrow)) + +#SECOND STEP +library(DOQTL) + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + +load(file = "/Users/elijahedmondson/Desktop/R/QTL/HMM/founder.probs.Rdata") +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + + +#EFE add "bychr = TRUE" +K = kinship.probs(model.probs, bychr = TRUE, snps = MM_snps) +#can you plot? + +pheno = data.frame(row.names = Sarcomatoid$row.names, sex = as.numeric(Sarcomatoid$Sex == "M"), + sarcomatoid = as.numeric(Sarcomatoid$sarcomatoid)) + +pheno = data.frame(row.names = GRSD.phenotype$row.names, sex = as.numeric(GRSD.phenotype$Sex == "M"), + Age = as.numeric(GRSD.phenotype$days), + Weight = GRSD.phenotype$weight, + BCS = GRSD.phenotype$BCS, + Albino = as.numeric(GRSD.phenotype$albino), + Amyloidosis = as.numeric(GRSD.phenotype$amyloidosis), + Lymphoma = as.numeric(GRSD.phenotype$lymphoma), + Harderian = as.numeric(GRSD.phenotype$harderian.gland), + Histiocytic.sarcoma = as.numeric(GRSD.phenotype$histiocytic.sarcoma), + AML = as.numeric(GRSD.phenotype$myeloid.leukemia), + LSA.AML = as.numeric(GRSD.phenotype$lymphoma.or.leukemia), + Lymphoid.leukemia = as.numeric(GRSD.phenotype$lymphoid.leukemia), + Pituitary.adenoma = as.numeric(GRSD.phenotype$pituitary.adenoma), + HCC = as.numeric(GRSD.phenotype$HCC), + Pulmonary.adenocarcinoma = as.numeric(GRSD.phenotype$pulmonary.adenocarcinoma), + Mammary.adenocarcinoma = as.numeric(GRSD.phenotype$mammary.adenocarcinoma), + GCT = as.numeric(GRSD.phenotype$GCT), + OSA = as.numeric(GRSD.phenotype$OSA), + Sarcoma = as.numeric(GRSD.phenotype$sarcoma), + HSA = as.numeric(GRSD.phenotype$HSA), + Metastasis = as.numeric(GRSD.phenotype$metastasis), + Solid.tumors = as.numeric(GRSD.phenotype$Solid.tumors)) + + +covar = data.frame(sex = as.numeric(Sarcomatoid$Sex == "M")) +rownames(covar) = rownames(pheno) + +qtl = scanone(pheno = pheno, pheno.col = "sarcomatoid", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) + +save(qtl, file = "") + +plot(qtl, main = "EMT") + +perms = scanone.perm(pheno = pheno, pheno.col = "sarcomatoid", probs = model.probs, addcovar = covar, + snps = MM_snps, path = "/Users/elijahedmondson/Desktop/R/QTL/perms", + nperm = 1000) + +save(perms, file = "Sarcomatoid.Rdata") +#scanone.perm(n=10) takes about 1 hour + +thr1 = quantile(perms, probs = 0.90) +thr2 = quantile(perms, probs = 0.95) +thr3 = quantile(perms, probs = 0.99) + +plot(AM.qtl, sig.thr = c(thr1, thr2, thr3), main = "Epithelial to Mesenchymal Transition") + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +save(perms, file = "SarcomatoidPerms.Rdata") +save(qtl, file = "SarcomatoidQTL.Rdata") +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + +interval = bayesint(AM.qtl, chr = 14) +interval +mgi = get.mgi.features(chr = interval[1,2], start = interval[1,3], end = interval[3,3], + type = "gene", source = "MGI") +nrow(mgi) +head(mgi) + + +ma = assoc.map(pheno = pheno, pheno.col = "albino", probs = model.probs, K = K, addcovar = covar, + snps = MM_snps, chr = 7, start = 87, end = 88) +coefplot(qtl, chr = 1) +tmp = assoc.plot(ma, thr = 7) +unique(tmp$sdps) + + +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/GRSD.K.model.probs.RData") +load(file = "") +load(file = "") +load(file = "") +library(DOQTL) + + + + diff --git a/3. Logistic Association Mapping HQSNPS.R b/3. Logistic Association Mapping HQSNPS.R new file mode 100644 index 0000000..a1cdaaf --- /dev/null +++ b/3. Logistic Association Mapping HQSNPS.R @@ -0,0 +1,592 @@ +# LOAD PACKAGES # +library(DOQTL) +library(doParallel) +library(foreach) +library(Rsamtools) +library(VariantAnnotation) +library(GenomicRanges) +library(regress) +library(MASS) +library(lmtest) +options(stringsAsFactors = F) +setwd("~/Desktop/R/QTL/WD") +ncl = 4 +outdir = "~/Desktop/R/QTL/WD/hq_snps" + + + +# 1. GENOTYPE # + +load(file = "~/Desktop/R/QTL/WD/GRSD.Rdata") + + + +# 2. PHENOTYPE # + +HZE <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/HZE-Table 1.csv") +pheno = data.frame(row.names = HZE$row.names, sex = as.numeric(HZE$sex == "M"), + Albino = as.numeric(HZE$albino), + Pulmonary.Adenocarcinoma = as.numeric(HZE$Pulmonary.Adenocarcinoma), + HCC = as.numeric(HZE$Hepatocellular.Carcinoma), + LSA = as.numeric(HZE$Lymphoma), + AML = as.numeric(HZE$Myeloid.Leukemia), + Harderian = as.numeric(HZE$Harderian.Tumor), + OSA = as.numeric(HZE$Osteosarcoma)) + +Gamma <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Gamma-Table 1.csv") +pheno = data.frame(row.names = Gamma$row.names, sex = as.numeric(Gamma$sex == "M"), + Albino = as.numeric(Gamma$albino), + Pulmonary.Adenocarcinoma = as.numeric(Gamma$Pulmonary.Adenocarcinoma), + HCC = as.numeric(Gamma$Hepatocellular.Carcinoma), + LSA = as.numeric(Gamma$LSA), + AML = as.numeric(Gamma$Myeloid.Leukemia), + PreT = as.numeric(Gamma$PreT), + FBL = as.numeric(Gamma$FBL)) + +Unirradiated <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Unirradiated-Table 1.csv") +pheno = data.frame(row.names = Unirradiated$row.names, sex = as.numeric(Unirradiated$sex == "M"), + Albino = as.numeric(Unirradiated$albino), + Pulmonary.Adenocarcinoma = as.numeric(Unirradiated$Pulmonary.Adenocarcinoma), + HCC = as.numeric(Unirradiated$Hepatocellular.Carcinoma), + LSA = as.numeric(Unirradiated$Lymphoma), + AML = as.numeric(Unirradiated$Myeloid.Leukemia), + Harderian = as.numeric(Unirradiated$Harderian.by.gland)) + + + +# 3. COVARIATES # + +addcovar = matrix(pheno$sex, ncol = 1, dimnames = list(rownames(pheno), "sex")) +samples = intersect(rownames(pheno), rownames(probs)) +samples = intersect(samples, rownames(addcovar)) +samples = intersect(samples, rownames(K[[1]])) +stopifnot(length(samples) > 0) +print(paste("Found", length(samples), "samples in common.")) + +pheno = pheno[samples,,drop = FALSE] +addcovar = addcovar[samples,,drop = FALSE] +probs = probs[samples,,,drop = FALSE] + + + +# 4. DEFINE TRAIT # + +rm(HZE, Gamma, Unirradiated) +trait = pheno$PreT +file.prefix = "LSA PreT Gamma" +plot.title = "LSA PreT Gamma, HQ SNPs" +table(trait) +trait +glm(trait ~ addcovar, family = binomial("logit")) +glm(trait ~ addcovar, family = poisson(link = "log")) +glm(trait ~ addcovar, family = gaussian) + + + +# 5. LOGISTIC REGRESSION MODEL # + +for(i in 1:length(K)) { + K[[i]] = K[[i]][samples, samples] +} # for(i) + +chrs = c(1:19, "X") +data = vector("list", length(chrs)) +names(data) = chrs +for(i in 1:length(chrs)) { + + rng = which(markers[,2] == chrs[i]) + data[[i]] = list(probs = probs[,,rng], K = K[[i]], + markers = markers[rng,]) + +} # for(i) + +rm(probs, K, markers) + +setwd(outdir) + +# AUTOSOME FUNCTION # +workfxn = function(obj) { + + chr = obj$markers[1,2] + + setwd(outdir) + + strains = sub("/", "_", hs.colors[,2]) + + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + + sanger.hdr = data.frame(ID = names(rowRanges(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + + + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) + + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + + null.mod = glm(trait ~ addcovar, family = binomial(logit)) + #null.mod = glm(trait ~ addcovar, family = poisson(link = "log")) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + glm.fxn = function(snp.rng, local.probs) { + + sdp.nums = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdp.nums)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdp.nums = sdp.nums[sdps2keep] + m = match(sdp.nums, unique.sdp.nums) + + # Multiply the SDPs by the haplotype probabilities. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(null.ll, nrow(cur.sdps)) + + # Check for low allele frequencies and remove SDPs with too + # few samples carrying one allele. + sdps.to.use = which(rowSums(cur.alleles) > 1.0) + + # Run the model at each unique SDP. + for(j in sdps.to.use) { + + + full.mod = glm(trait ~ addcovar + cur.alleles[j,], family = binomial(logit)) + #full.mod = glm(trait ~ addcovar + cur.alleles[j,], family = poisson(link = "log")) + cur.ll[j] = logLik(full.mod) + + } # for(j) + + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # glm.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= obj$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = glm.fxn(snp.rng, obj$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(obj$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > obj$markers[i,3] & + sanger.hdr$POS <= obj$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = glm.fxn(snp.rng, (obj$probs[,,i] + + obj$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > obj$markers[nrow(obj$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = glm.fxn(snp.rng, obj$probs[,,nrow(obj$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + pv = pchisq(2 * pv, df = 1, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn() + + +# X FUNCTION # +workfxn.xchr = function(obj) { + + chr = obj$markers[1,2] + + setwd(outdir) + + strains = sub("/", "_", hs.colors[,2]) + + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + + sanger.hdr = data.frame(ID = names(rowRanges(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + + + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) + + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + + null.mod = glm(trait ~ addcovar, family = binomial(logit)) + #null.mod = glm(trait ~ addcovar, family = poisson(link = "log")) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + glm.fxn = function(snp.rng, local.probs) { + + sdp.nums = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdp.nums)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdp.nums = sdp.nums[sdps2keep] + m = match(sdp.nums, unique.sdp.nums) + + # Multiply the SDPs by the haplotype probabilities. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(null.ll, nrow(cur.sdps)) + + # Check for low allele frequencies and remove SDPs with too + # few samples carrying one allele. + sdps.to.use = which(rowSums(cur.alleles) > 1.0) + + sex.col = which(colnames(addcovar) == "sex") + if(length(sex.col) != 1) { + stop("One of the columns of addcovar MUST be named 'sex'.") + } # if(length(sex.col) != 1) + + # Run the model at each unique SDP. + for(j in sdps.to.use) { + + + full.mod = glm(trait ~ addcovar + cur.alleles[j,], family = binomial(logit)) + #full.mod = glm(trait ~ addcovar + cur.alleles[j,], family = poisson(link = "log")) + cur.ll[j] = logLik(full.mod) + + } # for(j) + + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # glm.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= obj$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = glm.fxn(snp.rng, obj$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(obj$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > obj$markers[i,3] & + sanger.hdr$POS <= obj$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = glm.fxn(snp.rng, (obj$probs[,,i] + + obj$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > obj$markers[nrow(obj$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = glm.fxn(snp.rng, obj$probs[,,nrow(obj$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + pv = pchisq(2 * pv, df = 1, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2600, + height = 1200, res = 130) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn.xchr() + + + +# 6. MAPPING ANALYSES # + +result = vector("list", length(data)) +names(result) = names(data) + +for(i in 1:19) { + print(i) + result[[i]] = workfxn(data[[i]]) +} #for(i) + +print("X") +result[["X"]] = workfxn.xchr(data[["X"]]) + +save(result, file = paste0(file.prefix, ".Rdata")) + + + +# 7. FIND THE MAX LOD # + +max.LOD = result[[7]]$ID[which(-log10(result[[7]]$pv) > 10)] +max.LOD + +max.LOD.position <- result[[7]]$POS[which(-log10(result[[7]]$pv) > 100)] +max.LOD.position + +mgi = get.mgi.features(chr = 7, start = 87491804, end = 88689056, type = "gene", source = "MGI") + + + + +# 8. PLOTTING # + +setwd(outdir) +files = dir(pattern = file.prefix) +files = files[files != paste0(file.prefix, ".Rdata")] +png.files = grep("png$", files) +if(length(png.files) > 0) { + files = files[-png.files] +} +num = gsub(paste0("^", file.prefix, "_chr|\\.Rdata$"), "", files) +files = files[order(as.numeric(num))] + +data = vector("list", length(files)) +names(data) = num[order(as.numeric(num))] +for(i in 1:length(files)) { + + print(i) + load(files[i]) + data[[i]] = pv + data[[i]][,6] = -log10(data[[i]][,6]) + +} # for(i) + +num.snps = sapply(data, nrow) +chrs = c(1:19, "X") + +xlim = c(0, sum(num.snps)) +ylim = c(0, max(sapply(data, function(z) { max(z[,6]) }))) + + + +# PLOT ALL CHROMOSOMES # + +chrlen = get.chr.lengths()[1:20] +chrsum = cumsum(chrlen) +chrmid = c(1, chrsum[-length(chrsum)]) + chrlen * 0.5 +names(chrmid) = names(chrlen) + +png(paste0(file.prefix, "_QTL.png"), width = 2600, height = 1200, res = 200) +plot(-1, -1, col = 0, xlim = c(0, max(chrsum)), ylim = ylim, xlab = "", + ylab = "-log10(p-value)", las = 1, main = plot.title, xaxt = "n") +for(i in 1:length(data)) { + print(i) + pos = data[[i]][,3] * 1e-6 + c(0, chrsum)[i] + points(pos, data[[i]][,6], col = c("black", "grey50")[i %% 2 + 1], + pch = 20) +} # for(i) +mtext(side = 1, line = 0.5, at = chrmid, text = names(chrlen), cex = 1.5) +dev.off() + + +save(result, xlim, ylim, file.prefix, plot.title, file = paste0(file.prefix, "_plotting.Rdata")) + + + + +# 9. CONVERT TO GRANGES # + +chrs = c(1:19, "X") +qtl = GRangesList(GRanges("list", length(result))) + +for(i in 1:length(chrs)) { + print(i) + qtl[[i]] <- GRanges(seqnames = Rle(result[[i]]$ID), ranges = IRanges(start = result[[i]]$POS, width = 1), p.value = result[[i]]$pv) +} # for(i) + +save(result, file = "~/Desktop/albino.RData") + +png("fill .png", width = 2400, height = 1080, res = 100) +DOQTL:::plot.scanone.assoc(qtl, bin.size = 1000) +dev.off() + + + +# 10. SIGNIFICANCE THRESHOLDS # + +result = vector("list", length(data)) +names(result) = names(data) +females = which(pheno$sex == "0") +males = which(pheno$sex == "1") + +perms = matrix(1, nrow = 2, ncol = 2, dimnames = list(1:2, c("A", "X"))) + +for(p in 1:2) { + + new.order = rep(0, length(trait)) + new.order[females] = sample(females) + new.order[males] = sample(males) + + log.perm = trait[new.order] + trait = log.perm + + min.a.pv = 1 + + for(i in 1:19) { + print(i) + result = workfxn(data[[i]]) + min.a.pv = min(min.a.pv, min(result$pv)) + } #for(i) + + print("X") + result = workfxn.xchr(data[["X"]]) + min.x.pv = min(result$pv) + # Save the minimum p-values. + perms[p,] = c(-log10(min.a.pv), -log10(min.x.pv)) + +} # for(p) + + + +# 11. TRUNCATED PERMS # + +for(p in 1:2) { + + new.order = rep(0, length(trait)) + new.order[females] = sample(females) + new.order[males] = sample(males) + + log.perm = trait[new.order] + trait = log.perm + + min.a.pv = 1 + + + print(19) + result = workfxn(data[[19]]) + min.a.pv = min(min.a.pv, min(result$pv)) + + print("X") + result = workfxn.xchr(data[["X"]]) + min.x.pv = min(result$pv) + # Save the minimum p-values. + perms[p,] = c(-log10(min.a.pv), -log10(min.x.pv)) + +} # for(p) + + +# 11. SIGNIFICANCE THRESHOLDS # +get.sig.thr = function(perms, alpha = 0.05, Xchr = TRUE) { + + sig.thr = rep(0, length(alpha)) + + if(Xchr) { + + if(!is.matrix(perms)) { + stop(paste("'perms' is not a matrix. 'perms' must be a matrix", + "with 2 columns, named 'A' and 'X'.")) + } # if(!is.matrix(perms)) + + if(!(all(colnames(perms) %in% c("A", "X")))) { + stop(paste("The colnames of 'perms' are not equal to 'A' and", + "'X'. 'perms' must be a matrix, with 2 columns, named", + "'A' and 'X'.")) + } # if(!(all(colnames(perms) %in% c("A", "X")))) + + chrlen = get.chr.lengths() + len.auto = sum(chrlen[1:19]) + len.X = chrlen["X"] + len.all = len.auto + len.X + alpha.auto = 1.0 - (1.0 - alpha)^(len.auto / len.all) + alpha.X = 1.0 - (1.0 - alpha)^(len.X / len.all) + + sig.thr = cbind("A" = quantile(perms[,"A"], probs = 1.0 - alpha.auto, na.rm = TRUE), + "X" = quantile(perms[,"X"], probs = 1.0 - alpha.X, na.rm = TRUE)) + rownames(sig.thr) = alpha + + } else { + + sig.thr = quantile(perms, probs = 1.0 - alpha, na.rm = TRUE) + names(sig.thr) = alpha + + } # else + + return(sig.thr) + +} # get.sig.thr() + + +#Run function +get.sig.thr(perms, alpha = 0.01, Xchr = TRUE) diff --git a/4. Linear Association Mapping.R b/4. Linear Association Mapping.R new file mode 100644 index 0000000..78379b0 --- /dev/null +++ b/4. Linear Association Mapping.R @@ -0,0 +1,121 @@ +library(DOQTL) + + + +# 1. GENOTYPE # + +load(file = "~/Desktop/R/Build/K.Rdata") +load(file = "~/Desktop/R/Build/model.probs.Rdata") +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) +outdir = "~/Desktop/R/QTL/WD/" +setwd(outdir) +sdp.file = "~/Desktop/R/QTL/WD/HS_Sanger_SDPs.txt.bgz" + + + +# 2. PHENOTYPE # + +HZE <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/HZE-Table 1.csv") +pheno = data.frame(row.names = HZE$row.names, sex = as.numeric(HZE$sex == "M"), + Albino = as.numeric(HZE$albino), + Pulmonary.Adenocarcinoma = as.numeric(HZE$Pulmonary.Adenocarcinoma), + HCC = as.numeric(HZE$Hepatocellular.Carcinoma), + LSA = as.numeric(HZE$Lymphoma), + AML = as.numeric(HZE$Myeloid.Leukemia), + Harderian = as.numeric(HZE$Harderian.Tumor), + OSA = as.numeric(HZE$Osteosarcoma)) + +Gamma <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Gamma-Table 1.csv") +pheno = data.frame(row.names = Gamma$row.names, sex = as.numeric(Gamma$sex == "M"), + Albino = as.numeric(Gamma$albino), + Pulmonary.Adenocarcinoma = as.numeric(Gamma$Pulmonary.Adenocarcinoma), + HCC = as.numeric(Gamma$Hepatocellular.Carcinoma), + LSA = as.numeric(Gamma$LSA), + AML = as.numeric(Gamma$Myeloid.Leukemia), + PreT = as.numeric(Gamma$PreT), + FBL = as.numeric(Gamma$FBL)) + +Unirradiated <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Unirradiated-Table 1.csv") +pheno = data.frame(row.names = Unirradiated$row.names, sex = as.numeric(Unirradiated$sex == "M"), + Albino = as.numeric(Unirradiated$albino), + Pulmonary.Adenocarcinoma = as.numeric(Unirradiated$Pulmonary.Adenocarcinoma), + HCC = as.numeric(Unirradiated$Hepatocellular.Carcinoma), + LSA = as.numeric(Unirradiated$Lymphoma), + AML = as.numeric(Unirradiated$Myeloid.Leukemia), + Harderian = as.numeric(Unirradiated$Harderian.by.gland)) + + + +# 3. COVARIATES # + +addcovar = matrix(pheno$sex, ncol = 1, dimnames = list(rownames(pheno), "sex")) +samples = intersect(rownames(pheno), rownames(probs)) +samples = intersect(samples, rownames(addcovar)) +samples = intersect(samples, rownames(K[[1]])) +stopifnot(length(samples) > 0) +print(paste("Found", length(samples), "samples in common.")) + +pheno = pheno[samples,,drop = FALSE] +addcovar = addcovar[samples,,drop = FALSE] +probs = probs[samples,,,drop = FALSE] + + + +# 4. ASSOCIATION MAPPING # + +qtl = scanone.assoc(pheno = pheno, pheno.col = "PreT", probs = model.probs, K = K, + addcovar = addcovar, markers = MM_snps, sdp.file = sdp.file, ncl = 4) + +save(qtl, file = "__.Rdata") + +DOQTL:::plot.scanone.assoc(qtl, bin.size = 100) + +png("PreT.Gamma.LSA_QTL.png", width = 2400, height = 1080, res = 100) +DOQTL:::plot.scanone.assoc(qtl, bin.size = 100) +dev.off() + +png("_CHR_4.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtl, chr = 4, bin.size = 100) +dev.off() + + + + +# 5. LINKAGE MAPPING # + +qtl = scanone(pheno = pheno, pheno.col = "sarcomatoid", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +plot(qtl, main = "PSC") + +perms = scanone.perm(pheno = pheno, pheno.col = "PreT", probs = model.probs, addcovar = addcovar, + snps = MM_snps, path = "~/Desktop/", + nperm = 2) + +thr1 = quantile(perms, probs = 0.90) +thr2 = quantile(perms, probs = 0.95) +thr3 = quantile(perms, probs = 0.99) + +plot(qtl, sig.thr = c(thr1, thr2, thr3), main = "PSC") + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +save(perms, file = "sarcomatoid.3000perms.Rdata") +save(qtl, file = "sarcomatoid.3000perms.Rdata") +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + +interval = bayesint(qtlscan, chr = 1) +interval +mgi = get.mgi.features(chr = interval[1,2], start = interval[1,3], + end = interval[3,3], type = "gene", source = "MGI") +nrow(mgi) +head(mgi) + +ma = assoc.map(pheno = pheno, pheno.col = "PreT", probs = model.probs, K = K, addcovar = covar, + snps = MM_snps, chr = interval[1,2], start = interval[1,3], end = interval[3,3]) +coefplot(qtl, chr = 1) +tmp = assoc.plot(ma, thr = 1) +unique(tmp$sdps) + + + + diff --git a/5. CoxPH Association Mapping HQSNPS.R b/5. CoxPH Association Mapping HQSNPS.R new file mode 100644 index 0000000..c69fc93 --- /dev/null +++ b/5. CoxPH Association Mapping HQSNPS.R @@ -0,0 +1,571 @@ +# LOAD PACKAGES # +library(DOQTL) +library(doParallel) +library(foreach) +library(Rsamtools) +library(VariantAnnotation) +library(GenomicRanges) +library(survival) +library(regress) +options(stringsAsFactors = F) +setwd("~/Desktop/R/QTL/WD") +ncl = 4 +outdir = "~/Desktop/R/QTL/WD/hq_snps" + +# GENOTYPE # +load(file = "~/Desktop/R/QTL/WD/GRSD.Rdata") + +# PHENOTYPE # +HZE <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/HZE.csv") +pheno = data.frame(row.names = HZE$row.names, sex = as.numeric(HZE$sex == "M"), + days = as.numeric(HZE$days), + cat.days = as.numeric(HZE$Cataract.2.0.Score), + cataract = as.numeric(HZE$Cataract.2.0.Event), + LSA = as.numeric(HZE$Lymphoma)) + +Gamma <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Gamma.csv") +pheno = data.frame(row.names = Gamma$row.names, sex = as.numeric(Gamma$sex == "M"), + days = as.numeric(Gamma$days), + cataract = as.numeric(Gamma$Cataract.2.0.Event), + cat.days = as.numeric(Gamma$Cataract.2.0.Score), + LSA = as.numeric(Gamma$Lymphoma)) + +Unirradiated <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Unirradiated.csv") +pheno = data.frame(row.names = Unirradiated$row.names, sex = as.numeric(Unirradiated$sex == "M"), + days = as.numeric(Unirradiated$days), + cataract = as.numeric(Unirradiated$Cataract.2.0.Event), + cat.days = as.numeric(Unirradiated$Cataract.2.0.Score), + LSA = as.numeric(Unirradiated$Lymphoma)) + +file.prefix = "Cataract_Latency Unirradiated CoxPH" +plot.title = "Cataract Latency, Unirradiated, CoxPH, HQ SNPs" + +# COVARIATES # +addcovar = matrix(pheno$sex, ncol = 1, dimnames = list(rownames(pheno), "sex")) +samples = intersect(rownames(pheno), rownames(probs)) +samples = intersect(samples, rownames(addcovar)) +samples = intersect(samples, rownames(K[[1]])) +stopifnot(length(samples) > 0) +print(paste("Found", length(samples), "samples in common.")) + +pheno = pheno[samples,,drop = FALSE] +addcovar = addcovar[samples,,drop = FALSE] +probs = probs[samples,,,drop = FALSE] + + +# COX PH MODEL # +surv = Surv(pheno$cat.days, pheno$cataract) +fit = survfit(surv ~ addcovar) +plot(fit, col = 1:2, las = 1, main = plot.title) +legend("bottomleft", col = 1:2, lty = 1, legend = c("female", "male")) +mod = coxph(surv ~ addcovar) +text(x = 25, y = 0.15, labels = paste("p =", format(anova(mod)[2,4], + digits = 2)), adj = 0) + + +for(i in 1:length(K)) { + K[[i]] = K[[i]][samples, samples] +} # for(i) + +chrs = c(1:19, "X") +data = vector("list", length(chrs)) +names(data) = chrs +for(i in 1:length(chrs)) { + + rng = which(markers[,2] == chrs[i]) + data[[i]] = list(probs = probs[,,rng], K = K[[i]], + markers = markers[rng,]) + +} # for(i) + +rm(probs, K, markers) +rm(Unirradiated, HZE, Gamma) + +setwd(outdir) + + +# AUTOSOME FUNCTION # +workfxn = function(obj) { + + chr = obj$markers[1,2] + + setwd(outdir) + + + strains = sub("/", "_", hs.colors[,2]) + + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + + sanger.hdr = data.frame(ID = names(rowRanges(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + + + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) + + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + + + null.mod = coxph(surv ~ addcovar) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + + coxph.fxn = function(snp.rng, local.probs) { + + sdp.nums = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdp.nums)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdp.nums = sdp.nums[sdps2keep] + m = match(sdp.nums, unique.sdp.nums) + + # Multiply the SDPs by the haplotype probabilities. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(null.ll, nrow(cur.sdps)) + + # Check for low allele frequencies and remove SDPs with too + # few samples carrying one allele. + sdps.to.use = which(rowSums(cur.alleles) > 2.0) + + # Run the Cox PH model at each unique SDP. + for(j in sdps.to.use) { + + + mod = coxph(surv ~ addcovar + cur.alleles[j,]) + cur.ll[j] = logLik(mod) + + } # for(j) + + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # coxph.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= obj$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(obj$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > obj$markers[i,3] & + sanger.hdr$POS <= obj$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = coxph.fxn(snp.rng, (obj$probs[,,i] + + obj$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > obj$markers[nrow(obj$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,nrow(obj$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + pv = pchisq(2 * pv, df = 1, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn() + + + + +# X FUNCTION # +workfxn.xchr = function(obj) { + + chr = obj$markers[1,2] + + setwd(outdir) + + # Get the Sanger SNPs. + ###DMG + ### You're working with the HS, so just get HS colors. + # strains = sub("/", "_", do.colors[,2]) + # if(cross == "HS") { + strains = sub("/", "_", hs.colors[,2]) + # } # if(cross = "HS") + + # Read the Sanger VCF file. + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + # Extract the SNP positions and genotypes. + ###DMG + ### Changed 'rowData()' to 'rowRanges()' because rowData was deprecated. + sanger.hdr = data.frame(ID = names(rowRanges(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + + ###DMG + ### Again, you have HS mice. Just use the HS data. You can delete the DO lines. + # Add C57BL/6J to the Sanger SNPs. + # if(cross == "DO") { + # sanger = cbind("A_J" = geno(sanger)$GT[,1,drop = FALSE], + # "C57BL_6J" = "0/0", + # geno(sanger)$GT[,2:7,drop = FALSE]) + # } else if(cross == "HS") { + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) + # } # else + + # Convert allele calls to numeric values. + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + + ###DMG + ### I'm moving this outside of the function. + # Create the survival object. + # surv = Surv(pheno$days, pheno$cataract) + + # Null model. + ###DMG + ### Put the null logistic regression or linear model here. + null.mod = coxph(surv ~ addcovar) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + # Get the unique SDPs between each pair of markers and + # calculate the COXPH LOD. + + # CoxPH function. + coxph.fxn = function(snp.rng, local.probs) { + + # Get the SDPs. + sdp.nums = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdp.nums)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdp.nums = sdp.nums[sdps2keep] + m = match(sdp.nums, unique.sdp.nums) + + # Multiply the SDPs by the haplotype probabilities. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(null.ll, nrow(cur.sdps)) + + # Check for low allele frequencies and remove SDPs with too + # few samples carrying one allele. + sdps.to.use = which(rowSums(cur.alleles) > 2.0) + + sex.col = which(colnames(addcovar) == "sex") + if(length(sex.col) != 1) { + stop("One of the columns of addcovar MUST be named 'sex'.") + } # if(length(sex.col) != 1) + + # Run the Cox PH model at each unique SDP. + for(j in sdps.to.use) { + + ###DMG + ### Put the logistic regression or linear model here. + + # For the X chromosome we map with sex as an interactive + # covariate with genotype. + mod = coxph(surv ~ addcovar + cur.alleles[j,] + + addcovar[,sex.col] * cur.alleles[j,]) + cur.ll[j] = logLik(mod) + + } # for(j) + + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # coxph.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= obj$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(obj$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > obj$markers[i,3] & + sanger.hdr$POS <= obj$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = coxph.fxn(snp.rng, (obj$probs[,,i] + + obj$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > obj$markers[nrow(obj$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,nrow(obj$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + # Note that we have more degrees of freedom in the model. + pv = pchisq(2 * pv, df = 1, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn.xchr() + + + +# MAPPING ANALYSES # +result = vector("list", length(data)) +names(result) = names(data) + +for(i in 1:19) { + print(i) + result[[i]] = workfxn(data[[i]]) + +} #for(i) + +print("X") +result[["X"]] = workfxn.xchr(data[["X"]]) + + + + +# Plotting function. +setwd(outdir) +files = dir(pattern = file.prefix) +files = files[files != paste0(file.prefix, ".Rdata")] +png.files = grep("png$", files) +if(length(png.files) > 0) { + files = files[-png.files] +} +num = gsub(paste0("^", file.prefix, "_chr|\\.Rdata$"), "", files) +files = files[order(as.numeric(num))] + +data = vector("list", length(files)) +names(data) = num[order(as.numeric(num))] +for(i in 1:length(files)) { + + print(i) + load(files[i]) + data[[i]] = pv + data[[i]][,6] = -log10(data[[i]][,6]) + +} # for(i) + +num.snps = sapply(data, nrow) +chrs = c(1:19, "X") + +xlim = c(0, sum(num.snps)) +ylim = c(0, max(sapply(data, function(z) { max(z[,6]) }))) + +# This plots all chromosomes. +chrlen = get.chr.lengths()[1:20] +chrsum = cumsum(chrlen) +chrmid = c(1, chrsum[-length(chrsum)]) + chrlen * 0.5 +names(chrmid) = names(chrlen) + +png(paste0(file.prefix, "_QTL.png"), width = 3000, height = 1600, res = 100) +plot(-1, -1, col = 0, xlim = c(0, max(chrsum)), ylim = ylim, xlab = "", + ylab = "-log10(p-value)", las = 1, main = plot.title, xaxt = "n") +for(i in 1:length(data)) { + print(i) + pos = data[[i]][,3] * 1e-6 + c(0, chrsum)[i] + points(pos, data[[i]][,6], col = c("black", "grey50")[i %% 2 + 1], + pch = 20) +} # for(i) +mtext(side = 1, line = 0.5, at = chrmid, text = names(chrlen), cex = 1.5) +dev.off() + +save(result, data, file.prefix, pheno, plot.title, file = paste0(file.prefix, "_plots.Rdata")) + + + + + + +# Significance thresholds +females = which(pheno$sex == "0") +males = which(pheno$sex == "1") + +perms = matrix(1, nrow = 100, ncol = 2, dimnames = list(1:100, c("A", "X"))) + +for(p in 1:100) { + + new.order = rep(0, length(surv)) + new.order[females] = sample(females) + new.order[males] = sample(males) + + surv.perm = surv[new.order] + surv = surv.perm + + min.a.pv = 1 + + for(i in 1:19) { + print(i) + result = workfxn(data[[i]]) + min.a.pv = min(min.a.pv, min(result$pv)) + } #for(i) + + print("X") + result = workfxn.xchr(data[["X"]]) + min.x.pv = min(result$pv) + # Save the minimum p-values. + perms[p,] = c(min.a.pv, min.x.pv) + +} # for(p) + +#Significance Threshold Function +get.sig.thr = function(perms, alpha = 0.05, Xchr = TRUE) { + + sig.thr = rep(0, length(alpha)) + + if(Xchr) { + + if(!is.matrix(perms)) { + stop(paste("'perms' is not a matrix. 'perms' must be a matrix", + "with 2 columns, named 'A' and 'X'.")) + } # if(!is.matrix(perms)) + + if(!(all(colnames(perms) %in% c("A", "X")))) { + stop(paste("The colnames of 'perms' are not equal to 'A' and", + "'X'. 'perms' must be a matrix, with 2 columns, named", + "'A' and 'X'.")) + } # if(!(all(colnames(perms) %in% c("A", "X")))) + + chrlen = get.chr.lengths() + len.auto = sum(chrlen[1:19]) + len.X = chrlen["X"] + len.all = len.auto + len.X + alpha.auto = 1.0 - (1.0 - alpha)^(len.auto / len.all) + alpha.X = 1.0 - (1.0 - alpha)^(len.X / len.all) + + sig.thr = cbind("A" = quantile(perms[,"A"], probs = 1.0 - alpha.auto, na.rm = TRUE), + "X" = quantile(perms[,"X"], probs = 1.0 - alpha.X, na.rm = TRUE)) + rownames(sig.thr) = alpha + + } else { + + sig.thr = quantile(perms, probs = 1.0 - alpha, na.rm = TRUE) + names(sig.thr) = alpha + + } # else + + return(sig.thr) + +} # get.sig.thr() + + +### Run function + +get.sig.thr(perms, alpha = 0.05, Xchr = TRUE) + + + +# MARKERS # +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) +markers <- MM_snps +rm(MM_snps) +markers = markers[markers[,1] %in% dimnames(probs)[[3]],] +markers[,3] = markers[,3] * 1e6 +stopifnot(nrow(markers) == dim(probs)[3]) +stopifnot(markers[,1] == dimnames(probs)[[3]]) +#snp.file = "/Users/elijah/Desktop/R/QTL/WD/mgp.v5.merged.snps_all.dbSNP142.vcf.gz" +cross = "HS" + + + +# CLUSTER CONFIGURATION # +ncl = 4 +cl = makeCluster(ncl) +registerDoParallel(cl) +tmp = clusterEvalQ(cl, library(DOQTL)) +tmp = clusterEvalQ(cl, library(VariantAnnotation)) +tmp = clusterEvalQ(cl, library(regress)) +tmp = clusterEvalQ(cl, library(survival)) +clusterExport(cl, c("surv", "addcovar", "snp.file", "outdir", "cross")) + +stopCluster(cl) diff --git a/6. Heatmap.R b/6. Heatmap.R new file mode 100644 index 0000000..2b3dce6 --- /dev/null +++ b/6. Heatmap.R @@ -0,0 +1,219 @@ +library(GenomicRanges) +library(BSgenome.Mmusculus.UCSC.mm10) +library(DOQTL) +setwd("/Users/elijah/Desktop/R/QTL/WD/Heatmap/") +load(file = "~/Desktop/R/QTL/WD/__") + +# Plot function (w/ binning to average markers and max LOD) +plot.hs.qtl = function(qtl, bin.width = 1000, ...) { + + new.qtl = NULL + for(chr in 1:length(qtl)) { + + print(chr) + + # Create 100 SNP bins. + brks = cut(x = 1:length(qtl[[chr]]), breaks = length(qtl[[chr]]) / bin.width) + # Split up the SNP positions and get the mean. + pos = split(start(qtl[[chr]]), brks) + pos = sapply(pos, mean) + # Split up the p-values and get the max. + pv = split(mcols(qtl[[chr]])$p.value, brks) + pv = sapply(pv, min) + + # Make a single new GRanges object to return. + gr = GRanges(seqnames = seqnames(qtl[[chr]])[1], + ranges = IRanges(start = pos, width = 1), p.value = pv) + + if(chr == 1) { + new.qtl = gr + } else { + new.qtl = c(new.qtl, gr) + } # else + + } # for(chr) + + # Get the chromosome lengths. + chrlen = seqlengths(BSgenome.Mmusculus.UCSC.mm10) + names(chrlen) = sub("^chr", "", names(chrlen)) + chrlen = chrlen[seqlevels(new.qtl)] * 1e-6 + + # Add the chr lengths to the chromosomes for plotting. + # Switch positions to genome Mb. + gmb = start(new.qtl) * 1e-6 + for(chr in 2:length(chrlen)) { + + wh = which(seqnames(new.qtl) == names(chrlen)[chr]) + gmb[wh] = gmb[wh] + sum(chrlen[1:(chr - 1)]) + + } # for(chr) + + # Get chromosome mid-points for plotting the Chr name. + chrmid = (chrlen / 2) + cumsum(c(1, chrlen[-length(chrlen)])) + + # Make the plot. + col = rep(rgb(0,0,0), length(new.qtl)) + even.chr = which(seqnames(new.qtl) %in% (1:10 * 2)) + col[even.chr] = rgb(0.7,0.7,0.7) + plot(gmb, -log10(new.qtl$p.value), pch = 20, xaxt = "n", + col = col, las = 1, xlab = "", ylab = "-log10(p-value)", ...) + mtext(side = 1, line = 0.5, at = chrmid, text = names(chrlen), cex = 1.2) + + return(new.qtl) + +} # plot.hs.qtl + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/") + +load(file ="/Users/elijah/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Ectoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Ectoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Endoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Endoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Mesoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Mesoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Ectoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Ectoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Endoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Endoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Mesoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Mesoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Ectoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Ectoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Endoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Endoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Mesoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Mesoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + + + + +#Load all files for combination +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Ectoderm.heatmap.Rdata") +Background.Ectoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Endoderm.heatmap.Rdata") +Background.Endoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Mesoderm.heatmap.Rdata") +Background.Mesoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Ectoderm.heatmap.Rdata") +HZE.Ectoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Endoderm.heatmap.Rdata") +HZE.Endoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Mesoderm.heatmap.Rdata") +HZE.Mesoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Ectoderm.heatmap.Rdata") +Gamma.Ectoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Endoderm.heatmap.Rdata") +Gamma.Endoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijah/Desktop/R/QTL/WD/Heatmap/Gamma.Mesoderm.heatmap.Rdata") +Gamma.Mesoderm <- qtl.smaller +rm(qtl.smaller) + +combine <- cbind(seqnames=as.character(result[[1:2]]$ID), -log10(result[[1]]$pv) -log10(result[[2]]$pv)) + +#Combining the columns +combined <- cbind(seqnames=as.character(seqnames)) + +combined <- cbind(seqnames=as.character(seqnames(HZE.Mesoderm)), + -log10(Background.Ectoderm$p.value), + -log10(Background.Endoderm$p.value), + -log10(Background.Mesoderm$p.value), + -log10(HZE.Ectoderm$p.value), + -log10(HZE.Endoderm$p.value), + -log10(HZE.Mesoderm$p.value), + -log10(Gamma.Ectoderm$p.value), + -log10(Gamma.Endoderm$p.value), + -log10(Gamma.Mesoderm$p.value)) +head(combined) +heatmap(combined, Rowv = NA) + +combined <- cbind(-log10(Background.Ectoderm$p.value), + -log10(Background.Endoderm$p.value), + -log10(Background.Mesoderm$p.value), + -log10(HZE.Ectoderm$p.value), + -log10(HZE.Endoderm$p.value), + -log10(HZE.Mesoderm$p.value), + -log10(Gamma.Ectoderm$p.value), + -log10(Gamma.Endoderm$p.value), + -log10(Gamma.Mesoderm$p.value)) + +##with heatmap.2() +mypalette <- colorRampPalette(c("green", "yellow", "red"))(n = 299) + +heatmap.2(t(combined), Colv=NA, col=mypalette, + labCol=NA, sepwidth = 5, trace = "row", tracecol = "black", + RowSideColors = c( + rep("gray", 3), + rep("blue", 3), + rep("black", 3))) + + +par(lend = 1) +legend(.75, 1.04, legend = c("Unirradiated", "HZE", "Gamma"), + col = c("gray", "blue", "black"), lty= 1, lwd = 10) + + +##Plotting 3 QTL maps for comparison## +layout(matrix(3:1, 3, 1)) +DOQTL:::plot.scanone.assoc(HZE, chr = 14, bin.size = 100, main = "HZE Ion") +DOQTL:::plot.scanone.assoc(Gamma, chr = 14, bin.size = 100, main = "Gamma ray") +DOQTL:::plot.scanone.assoc(Background, chr = 14, bin.size = 100, main = "Unirradiated") diff --git a/Background (613).R b/Background (613).R new file mode 100644 index 0000000..9ff8c94 --- /dev/null +++ b/Background (613).R @@ -0,0 +1,589 @@ +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/GRSD_master.Rdata") +pheno = data.frame(row.names = Background$row.names, + sex = as.numeric(Background$sex == "M"), + LSA = as.numeric(Background$Lymphoma), + NN = as.numeric(Background$Non.neoplastic), + PulACA = as.numeric(Background$Pulmonary.Adenocarcinoma), + PulAd = as.numeric(Background$Pulmonary.Adenoma), + PulSrc = as.numeric(Background$Pulmonary.Sarcomatoid.Carcinoma), + BHGT = as.numeric(Background$Bilateral.Harderian.Gland.Tumors), + CPT = as.numeric(Background$Choroid.Plexus.Tumor), + Dpolyp = as.numeric(Background$Duodenal.Polyp), + EndoPolyp = as.numeric(Background$Endometrial.Stromal.Polyp), + Ectoderm = as.numeric(Background$Ectoderm), + Endoderm = as.numeric(Background$Endoderm), + Ependymoma = as.numeric(Background$Ependymoma), + FSA = as.numeric(Background$Fibrosarcoma), + GastSCC = as.numeric(Background$Gastric.Squamous.Cell.Carcinoma), + GCT = as.numeric(Background$Granulosa.Cell.Tumor), + HGAca = as.numeric(Background$Harderian.Gland.Adenocarcinoma), + HGAd = as.numeric(Background$Harderian.Gland.Adenoma), + Hemangioma = as.numeric(Background$Hemangioma), + HSA = as.numeric(Background$Hemangiosarcoma), + Hepatoblastoma = as.numeric(Background$Hepatoblastoma), + HCC = as.numeric(Background$Hepatocellular.Carcinoma), + HCAd = as.numeric(Background$Hepatocellular.Adenoma), + HS = as.numeric(Background$Histiocytic.Sarcoma), + IntestinalACA = as.numeric(Background$Intestinal.Adenocarcinoma), + IntestinalNeo = as.numeric(Background$Intestinal.Neoplasms), + Intracranial = as.numeric(Background$Intracranial.Tumors), + Islet = as.numeric(Background$Islet.Cell.Carcinoma), + Leiomyosarcoma = as.numeric(Background$Leiomyosarcoma), + MalMammary = as.numeric(Background$Malignant.Mammary.Tumors), + MalOvarian = as.numeric(Background$Malignant.Ovarian.Tumors), + MammAdenoacanthoma = as.numeric(Background$Mammary.Gland.Adenoacanthoma), + MammAdenocarcinoma = as.numeric(Background$Mammary.Gland.Adenocarcinoma), + Meningioma = as.numeric(Background$Meningioma), + Mesoderm = as.numeric(Background$Mesoderm), + Mesothelioma = as.numeric(Background$Mesothelioma), + Met = as.numeric(Background$metastasis), + Metastatic = as.numeric(Background$Metastatic.Tumors), + Myeloid.Leukemia = as.numeric(Background$Myeloid.Leukemia), + Myxosarcoma = as.numeric(Background$Myxosarcoma), + Odontogenic = as.numeric(Background$Odontogenic.Tumor), + Osteoma = as.numeric(Background$Osteoma), + OSA = as.numeric(Background$Osteosarcoma), + OvarianCarc = as.numeric(Background$Ovarian.Carcinoma), + Pheo = as.numeric(Background$Pheochromocytoma), + PitAd = as.numeric(Background$Pituitary.Adenoma), + PulAd = as.numeric(Background$Pulmonary.Adenoma), + PulMetastasis = as.numeric(Background$Pulmonary.Metastases), + RCC = as.numeric(Background$Renal.Cell.Carcinoma), + RhSA = as.numeric(Background$Rhabdomyosarcoma), + STS = as.numeric(Background$Soft.Tissue.Sarcomas), + ThyroidAd = as.numeric(Background$Thyroid.Adenoma), + ThyroidCarc = as.numeric(Background$Thyroid.Carcinoma), + TubulostromalACA = as.numeric(Background$Tubulostromal.Adenocarcinoma), + TubulostromalAd = as.numeric(Background$Tubulostromal.Adenoma), + UndiffSarc = as.numeric(Background$Undifferentiated.Sarcoma), + UterineStromalSarc = as.numeric(Background$Uterine.Stromal.Sarcoma), + UnilHarderian = as.numeric(Background$Unilateral.Harderian.Gland.Tumors), + Epidermal = as.numeric(Background$Tumors.of.Epidermis)) +covar = data.frame(sex = as.numeric(Background$sex == "M")) +addcovar = covar +rownames(covar) = rownames(pheno) +rownames(addcovar) = rownames(pheno) + +LM.qtl = scanone(pheno = pheno, pheno.col = "LSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.LSA.Rdata") +plot(LM.qtl) +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "LSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.LSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "NN", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.NN.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "NN", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.NN.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulmonaryAdenocarcinoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulmonaryAdenocarcinoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulAdenoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulAdenoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulSrc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulSarcomatoidCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulSrc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulSarcomatoidCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "BHGT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.BHGT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "BHGT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.BHGT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "CPT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.CPT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "CPT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.CPT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Dpolyp", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Dpolyp,Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Dpolyp", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Dpolyp.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "EndoPolyp", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.EndoPolyp.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "EndoPolyp", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.EndoPolyp.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Ependymoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Ependymoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Ependymoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Ependymoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "FSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.FSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "FSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.FSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "GastSCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.GastSCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "GastSCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.GastSCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "GCT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.GCT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "GCT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.GCT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HGAca", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HGAca.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGAca", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGAca.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HGAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HGAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Hemangioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Hemangioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Hemangioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Hemangioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Hepatoblastoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Hepatoblastoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Hepatoblastoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Hepatoblastoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HCAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HCAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HCAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HCAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HS", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HS.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HS", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HS.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "IntestinalACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.IntestinalACA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "IntestinalACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.IntestinalACA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "IntestinalNeo", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.IntestinalNeo.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "IntestinalNeo", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.IntestinalNeo.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Intracranial", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Intracranial.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Intracranial", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Intracranial.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Islet", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Islet.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Islet", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Islet.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Myeloid.Leukemia", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Myeloid.Leukemia.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Myeloid.Leukemia", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Myeloid.Leukemia.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Myxosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Myxosarcoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Myxosarcoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Myxosarcoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Odontogenic", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Odontogenic.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Odontogenic", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Odontogenic.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Osteoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Osteoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Osteoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Osteoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "OSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.OSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "OSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.OSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Leiomyosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Leiomyosarcoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Leiomyosarcoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Leiomyosarcoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MalMammary", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MalMammary.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MalMammary", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MalMammary.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MalOvarian", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MalOvarian.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MalOvarian", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MalOvarian.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MammAdenoacanthoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MammAdenoacanthoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MammAdenoacanthoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MammAdenoacanthoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MammAdenocarcinoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MammAdenocarcinoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MammAdenocarcinoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MammAdenocarcinoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Meningioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Meningioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Meningioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Meningioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Mesothelioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Mesothelioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Mesothelioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Mesothelioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Met", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Met.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Met", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Met.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Metastatic", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Metastatic.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Metastatic", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Metastatic.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Ectoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Ectoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Ectoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Ectoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Endoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Endoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Endoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Endoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Mesoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Mesoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Mesoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Mesoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "OvarianCarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.OvarianCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "OvarianCarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.OvarianCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Pheo", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Pheo.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Pheo", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Pheo.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PitAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PitAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PitAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PitAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulMetastasis", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulMetastasis.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulMetastasis", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulMetastasis.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "RCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.RCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "RCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.RCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "RhSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.RhSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "RhSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.RhSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "STS", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.STS.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "STS", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.STS.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "ThyroidAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.ThyroidAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "ThyroidAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyroidAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "ThyroidCarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.ThyroidCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "ThyroidCarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyroidCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "TubulostromalACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.TubulostromalACA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "TubulostromalACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.TubulostromalACA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "TubulostromalAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.TubulostromalAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "TubulostromalAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.TubulostromalAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UndiffSarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UndiffSarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UndiffSarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UndiffSarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UterineStromalSarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UterineStromalSarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UterineStromalSarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UterineStromalSarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UnilHarderian", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UnilHarderian.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UnilHarderian", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UnilHarderian.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Epidermal", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Epidermal.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Epidermal", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Epidermal.Rdata") +rm(AM.qtl, LM.qtl) \ No newline at end of file diff --git a/Background Plots.R b/Background Plots.R new file mode 100644 index 0000000..4a39165 --- /dev/null +++ b/Background Plots.R @@ -0,0 +1,340 @@ +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Background.Plots") + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.BHGT.Rdata") +jpeg('Harderian Gland Tumors, Bilateral (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Tumors, Bilateral (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.CPT.Rdata") +jpeg('Choroid Plexus Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Choroid Plexus Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Dpolyp.Rdata") +jpeg('Duodenal Polyp (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Duodenal Polyp (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Ectoderm.Rdata") +jpeg('Ectoderm Derived Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ectoderm Derived Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Endoderm.Rdata") +jpeg('Endoderm Derived Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Endoderm Derived Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.EndoPolyp.Rdata") +jpeg('Endometrial Stromal Polyp (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Endometrial Stromal Polyp (Uirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Ependymoma.Rdata") +jpeg('Ependymoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ependymoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Epidermal.Rdata") +jpeg('Epidermis Derived Tumors (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Epidermis Derived Tumors (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.FSA.Rdata") +jpeg('Fibrosarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Fibrosarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.GastSCC.Rdata") +jpeg('Gastric Squamous Cell Carcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Gastric Squamous Cell Carcinoma (Unirradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.GCT.Rdata") +jpeg('Ovarian Granulosa Cell Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Granulosa Cell Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.HCAd.Rdata") +jpeg('Hepatocellular Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatocellular Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.HCC.Rdata") +jpeg('Hepatocellular Carcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatocellular Carcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Hemangioma.Rdata") +jpeg('Hemangioma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hemangioma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Hepatoblastoma.Rdata") +jpeg('Hepatoblastoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatoblastoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.HGAca.Rdata") +jpeg('Harderian Gland Adenocarcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Adenocarcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.HGAd.Rdata") +jpeg('Harderian Gland Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.HS.Rdata") +jpeg('Histiocytic Sarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Histiocytic Sarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.HSA.Rdata") +jpeg('Hemangiosarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hemangiosarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.IntestinalACA.Rdata") +jpeg('Intestinal Adenocarcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intestinal Adenocarcinoma (Unirradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.IntestinalNeo.Rdata") +jpeg('Intestinal Neoplasm (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intestinal Neoplasm (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Intracranial.Rdata") +jpeg('Intracranial Neoplasm (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intracranial Neoplasm (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Islet.Rdata") +jpeg('Pancreatic Islet Cell Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pancreatic Islet Cell Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Leiomyosarcoma.Rdata") +jpeg('Leiomyosarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Leiomyosarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.LSA.Rdata") +jpeg('Lymphoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Lymphoma (Unirradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.MalMammary.Rdata") +jpeg('Malignant Mammary Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Malignant Mammary Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.MalOvarian.Rdata") +jpeg('Malignant Ovarian Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Malignant Ovarian Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.MammAdenoacanthoma.Rdata") +jpeg('Mammary Adenoacanthoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mammary Adenoacanthoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.MammAdenocarcinoma.Rdata") +jpeg('Mammary Adenocarcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mammary Adenocarcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Meningioma.Rdata") +jpeg('Meningioma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Meningioma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Mesoderm.Rdata") +jpeg('Mesoderm Derived Tumor (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mesoderm Derived Tumor (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Mesothelioma.Rdata") +jpeg('Mesothelioma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mesothelioma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Met.Rdata") +jpeg('Metastatic Disease (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Metastatic Disease (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Myeloid.Leukemia.Rdata") +jpeg('Myeloid Leukemia (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Myeloid Leukemia (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Myxosarcoma.Rdata") +jpeg('Myxosarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Myxosarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.NN.Rdata") +jpeg('Non-neoplastic (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Non-neoplastic (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Odontogenic.Rdata") +jpeg('Odotogenic Tumors (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Odontogenic Tumors (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.OSA.Rdata") +jpeg('Osteosarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Osteosarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Osteoma.Rdata") +jpeg('Osteoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Osteoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.OvarianCarc.Rdata") +jpeg('Ovarian Carcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Carcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.Pheo.Rdata") +jpeg('Pheochromocytoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pheochromocytoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.PitAd.Rdata") +jpeg('Pituitary Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pituitary Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.PulAd.Rdata") +jpeg('Pulmonary Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.PulAdenoma.Rdata") +jpeg('Pulmonary Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.PulMetastasis.Rdata") +jpeg('Pulmonary Metastases (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Metastases (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.PulmonaryAdenocarcinoma.Rdata") +jpeg('Pulmonary Adenocarcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenocarcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.PulSarcomatoidCarc.Rdata") +jpeg('Pulmonary Sarcomatoid Carcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Sarcomatoid Carcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.RCC.Rdata") +jpeg('Renal Cell Carcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Renal Cell Carcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.RhSA.Rdata") +jpeg('Rhabdomyosarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Rhabdomyosarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.STS.Rdata") +jpeg('Soft Tissue Sarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Soft Tissue Sarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.ThyroidAd.Rdata") +jpeg('Thyroid Follicular Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Thyroid Follicular Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.ThyroidCarc.Rdata") +jpeg('Thyroid Follicular Carcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Thyroid Follicular Carcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.TubulostromalACA.Rdata") +jpeg('Ovarian Tubulostroma Adenocarcinoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Tubulostroma Adenocarcinoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.TubulostromalAd.Rdata") +jpeg('Ovarian Tubulostromal Adenoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Tubulostromal Adenoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.UndiffSarc.Rdata") +jpeg('Undifferentiated Sarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Undifferentiated Sarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.UnilHarderian.Rdata") +jpeg('Harderian Gland Tumor, Unilateral (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Tumor, Unilateral (Unirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Background/AMQTL.UterineStromalSarc.Rdata") +jpeg('Uterine Stromal Sarcoma (Unirradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Uterine Stromal Sarcoma (Unirradiated)") +dev.off() +rm(AM.qtl) \ No newline at end of file diff --git a/Chisq.test.R b/Chisq.test.R new file mode 100644 index 0000000..231e6bb --- /dev/null +++ b/Chisq.test.R @@ -0,0 +1,30 @@ + +GRSDF <- subset(GRSD, sex=='female') +GRSDM <- subset(GRSD, sex=='male') + +GRSDF.IR <- subset(GRSD.IR, sex=='female') +GRSDM.IR <- subset(GRSD.IR, sex=='male') + +names(GRSD) + +attach(GRSD) + +TAB = table(HCC, GROUP) +TAB + +barplot(TAB, width = 1, xlab = "Irradiated", ylab = "Number of mice", beside = T, legend = c("No Disease", "Disease"), + args.legend = list(title = "x", x = "topright", cex = .9), ylim = c(0, 1200)) + + + +chisq.test(TAB, correct=T) #correct=T provides Yate's continuity correction +fisher.test(TAB, conf.int=T, conf.lev=0.95) + +TAB + + + +-barplot2(TAB, width = 1, xlab = "Irradiated", ylab = "Number of mice", beside = T, legend = c("No Disease", "Disease"), ylim = c(0, 1200)) + + + diff --git a/DG_fixed_assoc_coxph_hq.R b/DG_fixed_assoc_coxph_hq.R new file mode 100644 index 0000000..0e5936c --- /dev/null +++ b/DG_fixed_assoc_coxph_hq.R @@ -0,0 +1,568 @@ +# Lifespan, females only, COXPH with unique SDPs. +library(DOQTL) +library(doParallel) +library(foreach) +library(Rsamtools) +library(VariantAnnotation) +library(GenomicRanges) +library(survival) +library(regress) +options(stringsAsFactors = F) + +### DMG +#setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +setwd("/hpcdata/dgatti/HS/fromElijah/") + +# Pass in the number of clusters (nodes). +#args = commandArgs(trailingOnly = TRUE) +#ncl = as.numeric(args[[1]]) + +### DMG +#ncl = 2 +ncl = 4 + +#################### +# THINGS TO CHANGE + +# Set the output file directory. +###DMG +#outdir = "/Users/elijahedmondson/Desktop/R/QTL/WD/hq_snps" +outdir = "/hpcdata/dgatti/HS/fromElijah/QTL" + +# Load in your data. This file contains pheno, probs, markers and K. +###DMG +#HZE <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/HZE.csv") +#load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/model.probs.Rdata") +#probs <- model.probs +#rm(model.probs) + +#load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/K.Rdata") + +#pheno = data.frame(row.names = HZE$row.names, sex = as.numeric(HZE$sex == "M"), +# days = as.numeric(HZE$Cataract.2.0.Score), +# cataract = as.numeric(HZE$Cataract.2.0.Event), +# LSA = as.numeric(HZE$Lymphoma)) + +load("HZE.Rdata") + +###DMG: you have sex coded as 0/1, so this needs to change. +### I set the covariate below. +#covar = data.frame(sex = as.numeric(pheno$sex == "M")) +#addcovar = cbind(sex = as.numeric(factor(pheno$sex)) - 1) +#rownames(addcovar) = rownames(pheno) +#rownames(covar) = rownames(pheno) +#rm(HZE) + +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) +markers <- MM_snps +rm(MM_snps) +markers = markers[markers[,1] %in% dimnames(probs)[[3]],] +###DMG +### I had the marker positions in Mb and the Sanger SNP positions +### in bp below. +markers[,3] = markers[,3] * 1e6 + +stopifnot(nrow(markers) == dim(probs)[3]) +stopifnot(markers[,1] == dimnames(probs)[[3]]) + +# Set the Sanger SNP file location. +###DMG +### My fault. We don't use the SDP file here. Sorry, I forgot which +### version of the code you had. +#sdp.file = "/Users/elijahedmondson/Desktop/R/QTL/WD/HS_Sanger_SDPs.txt.bgz" +snp.file = "ftp://ftp.jax.org/SNPtools/variants/mgp.v5.merged.snps_all.dbSNP142.vcf.gz" + +# Set the cross type (DO or HS). +cross = "HS" + +# Set a file prefix for the output files. +file.prefix = "Cataract_Latency_coxph" + +# Set the plot title. +plot.title = "Cataract Latency, CoxPH, HQ SNPs" + +###DMG +### I moved this out of the workfxn. +### CHANGE THIS FOR EACH SURVIVAL PHENOTYPE. +# Create the survival function. +surv = Surv(pheno$days, pheno$cataract) + +#################### + +# Set up covariates +addcovar = matrix(pheno$sex, ncol = 1, dimnames = + list(rownames(pheno), "sex")) + +###DMG +## Remove samples that are not found in both pheno and probs. +#pheno = pheno[rownames(pheno) %in% dimnames(probs)[[1]],,drop = FALSE] +#probs = probs[dimnames(probs)[[1]] %in% rownames(pheno),,] +#probs = probs[match(rownames(pheno), dimnames(probs)[[1]]),,] +#probs = probs[,,dimnames(probs)[[3]] %in% markers[,1]] +samples = intersect(rownames(pheno), rownames(probs)) +samples = intersect(samples, rownames(addcovar)) +samples = intersect(samples, rownames(K[[1]])) + +stopifnot(length(samples) > 0) +print(paste("Found", length(samples), "samples in common.")) + +# Synch up the samples in all of the data. +pheno = pheno[samples,,drop = FALSE] +addcovar = addcovar[samples,,drop = FALSE] +probs = probs[samples,,,drop = FALSE] +for(i in 1:length(K)) { + K[[i]] = K[[i]][samples, samples] +} # for(i) + +# Split up the data by chromosome. +chrs = c(1:19, "X") +data = vector("list", length(chrs)) +names(data) = chrs +for(i in 1:length(chrs)) { + + rng = which(markers[,2] == chrs[i]) + data[[i]] = list(probs = probs[,,rng], K = K[[i]], + markers = markers[rng,]) + +} # for(i) +rm(probs, K, markers) + +# Make a plot of the survival data. +fit = survfit(surv ~ addcovar) +plot(fit, col = 1:2, las = 1, main = plot.title) +legend("bottomleft", col = 1:2, lty = 1, legend = c("female", "male")) +mod = coxph(surv ~ addcovar) +text(x = 25, y = 0.15, labels = paste("p =", format(anova(mod)[2,4], + digits = 2)), adj = 0) + +setwd(outdir) + +# Make a function for each worker to execute. +### DMG +### I changed the name of the argument to 'obj' so that +### you don't confuse it with the 'data' list. +workfxn = function(obj) { + + chr = obj$markers[1,2] + + setwd(outdir) + + # Get the Sanger SNPs. +###DMG +### You're working with the HS, so just get HS colors. +# strains = sub("/", "_", do.colors[,2]) +# if(cross == "HS") { + strains = sub("/", "_", hs.colors[,2]) +# } # if(cross = "HS") + + # Read the Sanger VCF file. + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + # Extract the SNP positions and genotypes. +###DMG +### Changed 'rowData()' to 'rowRanges()' because rowData was deprecated. + sanger.hdr = data.frame(ID = names(rowRanges(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + +###DMG +### Again, you have HS mice. Just use the HS data. You can delete the DO lines. + # Add C57BL/6J to the Sanger SNPs. +# if(cross == "DO") { +# sanger = cbind("A_J" = geno(sanger)$GT[,1,drop = FALSE], +# "C57BL_6J" = "0/0", +# geno(sanger)$GT[,2:7,drop = FALSE]) +# } else if(cross == "HS") { + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) +# } # else + + # Convert allele calls to numeric values. + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + +###DMG +### I'm moving this outside of the function. + # Create the survival object. +# surv = Surv(pheno$days, pheno$cataract) + + # Null model. +###DMG +### Put the null logistic regression or linear model here. + null.mod = coxph(surv ~ addcovar) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + # Get the unique SDPs between each pair of markers and + # calculate the COXPH LOD. + + # CoxPH function. + coxph.fxn = function(snp.rng, local.probs) { + + # Get the SDPs. + sdp.nums = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdp.nums)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdp.nums = sdp.nums[sdps2keep] + m = match(sdp.nums, unique.sdp.nums) + + # Multiply the SDPs by the haplotype probabilities. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(null.ll, nrow(cur.sdps)) + + # Check for low allele frequencies and remove SDPs with too + # few samples carrying one allele. + sdps.to.use = which(rowSums(cur.alleles) > 0.5) + + # Run the Cox PH model at each unique SDP. + for(j in sdps.to.use) { + +###DMG +### Put the logistic regression or linear model here. + + mod = coxph(surv ~ addcovar + cur.alleles[j,]) + cur.ll[j] = logLik(mod) + + } # for(j) + + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # coxph.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= obj$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(obj$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > obj$markers[i,3] & + sanger.hdr$POS <= obj$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = coxph.fxn(snp.rng, (obj$probs[,,i] + + obj$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > obj$markers[nrow(obj$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,nrow(obj$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + pv = pchisq(2 * pv, df = 7, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn() + + +### DMG +# Special function to map the X chromosome correctly. +# We map using sex as an interactive covariate. +workfxn.xchr = function(obj) { + + chr = obj$markers[1,2] + + setwd(outdir) + + # Get the Sanger SNPs. +###DMG +### You're working with the HS, so just get HS colors. +# strains = sub("/", "_", do.colors[,2]) +# if(cross == "HS") { + strains = sub("/", "_", hs.colors[,2]) +# } # if(cross = "HS") + + # Read the Sanger VCF file. + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + # Extract the SNP positions and genotypes. +###DMG +### Changed 'rowData()' to 'rowRanges()' because rowData was deprecated. + sanger.hdr = data.frame(ID = names(rowRanges(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + +###DMG +### Again, you have HS mice. Just use the HS data. You can delete the DO lines. + # Add C57BL/6J to the Sanger SNPs. +# if(cross == "DO") { +# sanger = cbind("A_J" = geno(sanger)$GT[,1,drop = FALSE], +# "C57BL_6J" = "0/0", +# geno(sanger)$GT[,2:7,drop = FALSE]) +# } else if(cross == "HS") { + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) +# } # else + + # Convert allele calls to numeric values. + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + +###DMG +### I'm moving this outside of the function. + # Create the survival object. +# surv = Surv(pheno$days, pheno$cataract) + + # Null model. +###DMG +### Put the null logistic regression or linear model here. + null.mod = coxph(surv ~ addcovar) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + # Get the unique SDPs between each pair of markers and + # calculate the COXPH LOD. + + # CoxPH function. + coxph.fxn = function(snp.rng, local.probs) { + + # Get the SDPs. + sdp.nums = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdp.nums)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdp.nums = sdp.nums[sdps2keep] + m = match(sdp.nums, unique.sdp.nums) + + # Multiply the SDPs by the haplotype probabilities. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(null.ll, nrow(cur.sdps)) + + # Check for low allele frequencies and remove SDPs with too + # few samples carrying one allele. + sdps.to.use = which(rowSums(cur.alleles) > 0.5) + + sex.col = which(colnames(addcovar) == "sex") + if(length(sex.col) != 1) { + stop("One of the columns of addcovar MUST be named 'sex'.") + } # if(length(sex.col) != 1) + + # Run the Cox PH model at each unique SDP. + for(j in sdps.to.use) { + +###DMG +### Put the logistic regression or linear model here. + + # For the X chromosome we map with sex as an interactive + # covariate with genotype. + mod = coxph(surv ~ addcovar + cur.alleles[j,] + + addcovar[,sex.col] * cur.alleles[j,]) + cur.ll[j] = logLik(mod) + + } # for(j) + + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # coxph.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= obj$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(obj$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > obj$markers[i,3] & + sanger.hdr$POS <= obj$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = coxph.fxn(snp.rng, (obj$probs[,,i] + + obj$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > obj$markers[nrow(obj$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, obj$probs[,,nrow(obj$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + # Note that we have more degrees of freedom in the model. + pv = pchisq(2 * pv, df = 13, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn.xchr() + + +# Set up the worker cluster. +cl = makeCluster(ncl) +registerDoParallel(cl) +tmp = clusterEvalQ(cl, library(DOQTL)) +tmp = clusterEvalQ(cl, library(VariantAnnotation)) +tmp = clusterEvalQ(cl, library(regress)) +tmp = clusterEvalQ(cl, library(survival)) +### DMG +### Change this to export the "surv" object. +#clusterExport(cl, c("pheno", "addcovar", "snp.file", "outdir", "cross")) +clusterExport(cl, c("surv", "addcovar", "snp.file", "outdir", "cross")) + +### DMG +### Comment out for now... +#result = foreach(i = iter(data)) %dopar% { + +# workfxn(i) + +#} # for(each(i) + +#save(result, file = paste0(file.prefix, ".Rdata")) + +#stopCluster(cl) + +##W/o cluster + +result = vector("list", length(data)) +names(result) = names(data) +for(i in 1:19) { + print(i) + result[[i]] = workfxn(data[[i]]) +} #for(i) +print("X") +result[["X"]] = workfxn.xchr(data[["X"]]) + +save(result, file = paste0(file.prefix, ".Rdata")) + + +# Plotting function. +setwd(outdir) +files = dir(pattern = file.prefix) +files = files[files != paste0(file.prefix, ".Rdata")] +png.files = grep("png$", files) +if(length(png.files) > 0) { + files = files[-png.files] +} +num = gsub(paste0("^", file.prefix, "_chr|\\.Rdata$"), "", files) +files = files[order(as.numeric(num))] + +data = vector("list", length(files)) +names(data) = num[order(as.numeric(num))] +for(i in 1:length(files)) { + + print(i) + load(files[i]) + data[[i]] = pv + data[[i]][,6] = -log10(data[[i]][,6]) + +} # for(i) + +num.snps = sapply(data, nrow) +chrs = c(1:19, "X") + +xlim = c(0, sum(num.snps)) +ylim = c(0, max(sapply(data, function(z) { max(z[,6]) }))) + +# This plots all chromosomes. +chrlen = get.chr.lengths()[1:20] +chrsum = cumsum(chrlen) +chrmid = c(1, chrsum[-length(chrsum)]) + chrlen * 0.5 +names(chrmid) = names(chrlen) + +png(paste0(file.prefix, "_QTL.png"), width = 2000, height = 1600, res = 200) +plot(-1, -1, col = 0, xlim = c(0, max(chrsum)), ylim = ylim, xlab = "", + ylab = "-log10(p-value)", las = 1, main = plot.title, xaxt = "n") +for(i in 1:length(data)) { + print(i) + pos = data[[i]][,3] * 1e-6 + c(0, chrsum)[i] + points(pos, data[[i]][,6], col = c("black", "grey50")[i %% 2 + 1], + pch = 20) +} # for(i) +mtext(side = 1, line = 0.5, at = chrmid, text = names(chrlen), cex = 1.5) +dev.off() diff --git a/DOQTL_0.99.1.tar.gz b/DOQTL_0.99.1.tar.gz new file mode 100644 index 0000000..e23b8af Binary files /dev/null and b/DOQTL_0.99.1.tar.gz differ diff --git a/DOQTL_1.0.5.tar.gz b/DOQTL_1.0.5.tar.gz new file mode 100644 index 0000000..df16f58 Binary files /dev/null and b/DOQTL_1.0.5.tar.gz differ diff --git a/Gamma (615).R b/Gamma (615).R new file mode 100644 index 0000000..07bf832 --- /dev/null +++ b/Gamma (615).R @@ -0,0 +1,876 @@ +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/GRSD_master.Rdata") + +pheno = data.frame(row.names = Gamma$row.names, + sex = as.numeric(Gamma$sex == "M"), + HGT = as.numeric(Gamma$Harderian.Tumor), + Thyroid = as.numeric(Gamma$Thyroid.Tumor)) +covar = data.frame(sex = as.numeric(Gamma$sex == "M")) +addcovar = covar +rownames(covar) = rownames(pheno) +rownames(addcovar) = rownames(pheno) + + +LM.qtl = scanone(pheno = pheno, pheno.col = "LSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.LSA.Rdata") +plot(LM.qtl) +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "LSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.LSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "NN", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.NN.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "NN", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.NN.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulmonaryAdenocarcinoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulmonaryAdenocarcinoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulAdenoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulAdenoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulSrc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulSarcomatoidCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulSrc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulSarcomatoidCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "BHGT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.BHGT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "BHGT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.BHGT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "CPT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.CPT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "CPT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.CPT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Dpolyp", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Dpolyp,Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Dpolyp", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Dpolyp.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "EndoPolyp", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.EndoPolyp.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "EndoPolyp", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.EndoPolyp.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Ependymoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Ependymoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Ependymoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Ependymoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "FSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.FSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "FSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.FSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "GastSCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.GastSCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "GastSCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.GastSCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "GCT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.GCT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "GCT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.GCT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HGAca", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HGAca.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGAca", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGAca.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HGAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HGAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Hemangioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Hemangioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Hemangioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Hemangioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Hepatoblastoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Hepatoblastoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Hepatoblastoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Hepatoblastoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HCAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HCAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HCAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HCAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HS", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HS.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HS", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HS.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "IntestinalACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.IntestinalACA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "IntestinalACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.IntestinalACA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "IntestinalNeo", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.IntestinalNeo.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "IntestinalNeo", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.IntestinalNeo.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Intracranial", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Intracranial.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Intracranial", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Intracranial.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Islet", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Islet.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Islet", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Islet.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Myeloid.Leukemia", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Myeloid.Leukemia.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Myeloid.Leukemia", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Myeloid.Leukemia.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Myxosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Myxosarcoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Myxosarcoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Myxosarcoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Odontogenic", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Odontogenic.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Odontogenic", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Odontogenic.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Osteoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Osteoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Osteoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Osteoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "OSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.OSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "OSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.OSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Leiomyosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Leiomyosarcoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Leiomyosarcoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Leiomyosarcoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MalMammary", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MalMammary.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MalMammary", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MalMammary.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MalOvarian", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MalOvarian.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MalOvarian", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MalOvarian.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MammAdenoacanthoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MammAdenoacanthoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MammAdenoacanthoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MammAdenoacanthoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MammAdenocarcinoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MammAdenocarcinoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MammAdenocarcinoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MammAdenocarcinoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Meningioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Meningioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Meningioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Meningioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Mesothelioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Mesothelioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Mesothelioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Mesothelioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Met", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Met.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Met", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Met.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Metastatic", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Metastatic.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Metastatic", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Metastatic.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Ectoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Ectoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Ectoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Ectoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Endoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Endoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Endoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Endoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Mesoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Mesoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Mesoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Mesoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "OvarianCarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.OvarianCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "OvarianCarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.OvarianCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Pheo", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Pheo.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Pheo", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Pheo.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PitAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PitAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PitAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PitAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulMetastasis", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulMetastasis.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulMetastasis", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulMetastasis.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "RCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.RCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "RCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.RCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "RhSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.RhSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "RhSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.RhSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "STS", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.STS.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "STS", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.STS.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "ThyroidAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.ThyroidAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "ThyroidAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyroidAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "ThyroidCarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.ThyroidCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "ThyroidCarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyroidCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "TubulostromalACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.TubulostromalACA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "TubulostromalACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.TubulostromalACA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "TubulostromalAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.TubulostromalAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "TubulostromalAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.TubulostromalAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UndiffSarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UndiffSarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UndiffSarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UndiffSarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UterineStromalSarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UterineStromalSarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UterineStromalSarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UterineStromalSarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UnilHarderian", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UnilHarderian.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UnilHarderian", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UnilHarderian.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Epidermal", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Epidermal.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Epidermal", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Epidermal.Rdata") +rm(AM.qtl, LM.qtl) + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma.Plots") + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.BHGT.Rdata") +jpeg('Harderian Gland Tumors, Bilateral (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Tumors, Bilateral (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.CPT.Rdata") +jpeg('Choroid Plexus Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Choroid Plexus Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Dpolyp.Rdata") +jpeg('Duodenal Polyp (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Duodenal Polyp (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Ectoderm.Rdata") +jpeg('Ectoderm Derived Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ectoderm Derived Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Endoderm.Rdata") +jpeg('Endoderm Derived Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Endoderm Derived Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.EndoPolyp.Rdata") +jpeg('Endometrial Stromal Polyp (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Endometrial Stromal Polyp (Uirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Ependymoma.Rdata") +jpeg('Ependymoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ependymoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Epidermal.Rdata") +jpeg('Epidermis Derived Tumors (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Epidermis Derived Tumors (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.FSA.Rdata") +jpeg('Fibrosarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Fibrosarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.GastSCC.Rdata") +jpeg('Gastric Squamous Cell Carcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Gastric Squamous Cell Carcinoma (γ-ray Irradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.GCT.Rdata") +jpeg('Ovarian Granulosa Cell Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Granulosa Cell Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.HCAd.Rdata") +jpeg('Hepatocellular Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatocellular Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.HCC.Rdata") +jpeg('Hepatocellular Carcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatocellular Carcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Hemangioma.Rdata") +jpeg('Hemangioma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hemangioma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Hepatoblastoma.Rdata") +jpeg('Hepatoblastoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatoblastoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.HGAca.Rdata") +jpeg('Harderian Gland Adenocarcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Adenocarcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.HGAd.Rdata") +jpeg('Harderian Gland Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.HS.Rdata") +jpeg('Histiocytic Sarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Histiocytic Sarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.HSA.Rdata") +jpeg('Hemangiosarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hemangiosarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.IntestinalACA.Rdata") +jpeg('Intestinal Adenocarcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intestinal Adenocarcinoma (γ-ray Irradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.IntestinalNeo.Rdata") +jpeg('Intestinal Neoplasm (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intestinal Neoplasm (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Intracranial.Rdata") +jpeg('Intracranial Neoplasm (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intracranial Neoplasm (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Islet.Rdata") +jpeg('Pancreatic Islet Cell Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pancreatic Islet Cell Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Leiomyosarcoma.Rdata") +jpeg('Leiomyosarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Leiomyosarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.LSA.Rdata") +jpeg('Lymphoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Lymphoma (γ-ray Irradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.MalMammary.Rdata") +jpeg('Malignant Mammary Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Malignant Mammary Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.MalOvarian.Rdata") +jpeg('Malignant Ovarian Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Malignant Ovarian Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.MammAdenoacanthoma.Rdata") +jpeg('Mammary Adenoacanthoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mammary Adenoacanthoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.MammAdenocarcinoma.Rdata") +jpeg('Mammary Adenocarcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mammary Adenocarcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Meningioma.Rdata") +jpeg('Meningioma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Meningioma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Mesoderm.Rdata") +jpeg('Mesoderm Derived Tumor (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mesoderm Derived Tumor (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Mesothelioma.Rdata") +jpeg('Mesothelioma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mesothelioma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Met.Rdata") +jpeg('Metastatic Disease (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Metastatic Disease (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Myeloid.Leukemia.Rdata") +jpeg('Myeloid Leukemia (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Myeloid Leukemia (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Myxosarcoma.Rdata") +jpeg('Myxosarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Myxosarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.NN.Rdata") +jpeg('Non-neoplastic (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Non-neoplastic (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Odontogenic.Rdata") +jpeg('Odotogenic Tumors (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Odontogenic Tumors (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.OSA.Rdata") +jpeg('Osteosarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Osteosarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Osteoma.Rdata") +jpeg('Osteoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Osteoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.OvarianCarc.Rdata") +jpeg('Ovarian Carcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Carcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.Pheo.Rdata") +jpeg('Pheochromocytoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pheochromocytoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.PitAd.Rdata") +jpeg('Pituitary Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pituitary Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.PulAd.Rdata") +jpeg('Pulmonary Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.PulAdenoma.Rdata") +jpeg('Pulmonary Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.PulMetastasis.Rdata") +jpeg('Pulmonary Metastases (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Metastases (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.PulmonaryAdenocarcinoma.Rdata") +jpeg('Pulmonary Adenocarcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenocarcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.PulSarcomatoidCarc.Rdata") +jpeg('Pulmonary Sarcomatoid Carcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Sarcomatoid Carcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.RCC.Rdata") +jpeg('Renal Cell Carcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Renal Cell Carcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.RhSA.Rdata") +jpeg('Rhabdomyosarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Rhabdomyosarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.STS.Rdata") +jpeg('Soft Tissue Sarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Soft Tissue Sarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.ThyroidAd.Rdata") +jpeg('Thyroid Follicular Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Thyroid Follicular Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.ThyroidCarc.Rdata") +jpeg('Thyroid Follicular Carcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Thyroid Follicular Carcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.TubulostromalACA.Rdata") +jpeg('Ovarian Tubulostroma Adenocarcinoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Tubulostroma Adenocarcinoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.TubulostromalAd.Rdata") +jpeg('Ovarian Tubulostromal Adenoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Tubulostromal Adenoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.UndiffSarc.Rdata") +jpeg('Undifferentiated Sarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Undifferentiated Sarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.UnilHarderian.Rdata") +jpeg('Harderian Gland Tumor, Unilateral (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Tumor, Unilateral (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Gamma/AMQTL.UterineStromalSarc.Rdata") +jpeg('Uterine Stromal Sarcoma (γ-ray Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Uterine Stromal Sarcoma (γ-ray Irradiated)") +dev.off() +rm(AM.qtl) \ No newline at end of file diff --git a/Genome Reconstruction of DO Mice.R b/Genome Reconstruction of DO Mice.R new file mode 100644 index 0000000..2e03243 --- /dev/null +++ b/Genome Reconstruction of DO Mice.R @@ -0,0 +1,38 @@ +library(DOQTL) + +'y' <- read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD/y.txt", header = T) +'x' <- read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD/x.txt", header = T) +geno <- read.delim("/Users/elijahedmondson/Desktop/R/QTL/extract.raw.data/GRSD/geno.txt", header = T) +pheno <- read.delim("/Users/elijahedmondson/Desktop/R/GRSD.phenotype/CSV/GRSD.csv", header = T, sep = ",") + +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + +sex = sex.predict(x = x, y = y, snps = MM_snps, plot = T) + +gen = paste("DO", gsub("70", "", pheno$Gen), sep = "") +names(gen) = rownames(pheno) +gen = gen[names(gen) %in% names(sex)] +gen = gen[match(names(sex), names(gen))] +stopifnot(all(rownames(x) == names(sex))) +stopifnot(all(rownames(x) == names(gen))) +data = list(x = x, y = y, sex = sex, gen = gen) + +#ALL BELOW IS FOR "FOUNDERS" +'yf' <- read.delim("~/Desktop/R/CSU Geneseek/Founders.raw.data/y.txt", header = T) +'xf' <- read.delim("~/Desktop/R/CSU Geneseek/Founders.raw.data/x.txt", header = T) +genof <- read.delim("~/Desktop/R/CSU Geneseek/Founders.raw.data/geno.txt", header = T) + +sexf = sex.predict(x = xf, y = yf, snps = MM_snps, plot = T) + +founders = list(x = xf, y = yf, sex = sexf) +#ALL ABOVE IS FOR FOUNDERS + + +rm(x, y, sex, gen) +gc() +calc.genoprob(data = data, chr = c(1:19, "X"), + output.dir = "~/Desktop/R/CSU Geneseek/NEW/", + plot = T, array = "megamuga", sampletype = "CC", + method = "intensity", founders = founders, transprobs, snps) + +founders = list(x = xf, y = yf) diff --git a/HS_DOQTL.R b/HS_DOQTL.R new file mode 100644 index 0000000..0d04bbd --- /dev/null +++ b/HS_DOQTL.R @@ -0,0 +1,90 @@ +library(devtools) +load_all("d:/182_DO_QTL_Mapping/DOQTL") + +setwd("C:/Users/dgatti/Documents/HS/") + +# Read in founders. +#fg = read.delim("Founders/geno.txt") +#fx = read.delim("Founders/x.txt") +#fy = read.delim("Founders/y.txt") + +# Load in data. +#g = read.delim("Samples/geno.txt") +#x = read.delim("Samples/x.txt") +#y = read.delim("Samples/y.txt") + +#save(x, y, g, fx, fy, fg, file = "HSdata.Rata") + +load(file = "HSdata.Rata") + +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + +# Combine founders and samples. +x = rbind(fx, x) +y = rbind(fy, y) +g = rbind(fg, g) + +# Remove outlier samples. +rmx = rowMeans(x, na.rm = T) +rmy = rowMeans(y, na.rm = T) +plot(rmx, rmy) +remove = which(rmx > 0.6) +x = x[-remove,] +y = y[-remove,] +g = g[-remove,] + +sex = sex.predict(x, y, MM_snps, T) + +# All of the HS sample IDs are numbers. +fndr.idx = which(is.na(as.numeric(rownames(x)))) +samp.idx = which(!is.na(as.numeric(rownames(x)))) +fsex = sex[fndr.idx] +sex = sex[samp.idx] + +fx = x[fndr.idx,] +fy = y[fndr.idx,] +fg = g[fndr.idx,] +x = x[samp.idx,] +y = y[samp.idx,] +g = g[samp.idx,] + +# A: A/J +# B: AKR/J +# C: BALB/cJ +# D: C3H/HeJ +# E: C57BL/6J +# F: CBA/J +# G: DBA/2J +# H: LP/J + +code = c("HH", "EE", "AA", "BB", "CC", "FF", "DD", "GG", "AA", "BB", "CC") +names(code) = rownames(fx) +gen = rep(70, nrow(x)) +names(gen) = rownames(x) + +states = DOQTL:::create.genotype.states(LETTERS[1:8]) + +data = list(geno = as.matrix(g), sex = sex, gen = gen) +founders = list(geno = fg, sex = fsex, code = code, states = states) + +# We only have male founders. +# For the allele call method, we're going to fake out the HMM by duplicating +# the males and calling them females. +founders$geno = as.matrix(rbind(founders$geno, founders$geno)) +founders$sex = c(founders$sex, rep("F", length(founders$sex))) +names(founders$sex) = rownames(founders$geno) +founders$code = c(founders$code, founders$code) +names(founders$code) = rownames(founders$geno) + +# +attr(founders, "method") = "allele" +founders = add.missing.F1s(founders, MM_snps[,1:4]) + +save(founders, data, file = "HS_allele.Rdata") + +load(file = "HS_allele.Rdata") + +setwd("HMM") +calc.genoprob(data = data, chr = 1:19, output.dir = ".", plot = T, array = "megamuga", + sampletype = "HS", method = "allele", founders = founders) + diff --git a/HS_assoc.R b/HS_assoc.R new file mode 100644 index 0000000..9c73ad7 --- /dev/null +++ b/HS_assoc.R @@ -0,0 +1,18 @@ +library(DOQTL) +setwd("/hpcdata/dgatti/HS/") +load(file = "HS_mapping_data.Rdata") +sdp.file = "/hpcdata/dgatti/HS_Sanger_SDPs.txt.bgz" + +pheno[,2] = as.numeric(pheno[,2]) - 1 + +qtl = scanone.assoc(pheno = pheno, pheno.col = 5, probs = probs, K = K, + addcovar = pheno[,2,drop = F], markers = snps, sdp.file = sdp.file, ncl = 20) +save(qtl, file = "albino_assoc_QTL.Rdata") + +png("albino_QTL.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtl, bin.size = 100) +dev.off() + +png("albino_QTL_chr7.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtl, chr = 7, bin.size = 10) +dev.off() diff --git a/HZE (622).R b/HZE (622).R new file mode 100644 index 0000000..4f53aa5 --- /dev/null +++ b/HZE (622).R @@ -0,0 +1,888 @@ +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/GRSD_master.Rdata") +pheno = data.frame(row.names = HZE$row.names, + sex = as.numeric(HZE$sex == "M"), + OSA = as.numeric(HZE$Osteosarcoma)) +covar = data.frame(sex = as.numeric(HZE$sex == "M")) +addcovar = covar +rownames(covar) = rownames(pheno) +rownames(addcovar) = rownames(pheno) + +pheno = data.frame(row.names = Untitled$row.names, + sex = as.numeric(Untitled$sex == "M"), + weight = as.numeric(Untitled$weight)) + +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGT.Rdata") +rm(AM.qtl) +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Thyroid", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyTumor.Rdata") +rm(AM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "LSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.LSA.Rdata") +plot(LM.qtl) +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "LSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.LSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "NN", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.NN.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "NN", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.NN.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulmonaryAdenocarcinoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulmonaryAdenocarcinoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulAdenoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulAdenoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulSrc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulSarcomatoidCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulSrc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulSarcomatoidCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "BHGT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.BHGT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "BHGT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.BHGT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "CPT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.CPT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "CPT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.CPT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Dpolyp", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Dpolyp,Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Dpolyp", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Dpolyp.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "EndoPolyp", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.EndoPolyp.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "EndoPolyp", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.EndoPolyp.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Ependymoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Ependymoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Ependymoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Ependymoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "FSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.FSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "FSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.FSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "GastSCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.GastSCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "GastSCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.GastSCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "GCT", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.GCT.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "GCT", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.GCT.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HGAca", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HGAca.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGAca", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGAca.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HGAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HGAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HGAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HGAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Hemangioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Hemangioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Hemangioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Hemangioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Hepatoblastoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Hepatoblastoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Hepatoblastoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Hepatoblastoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HCAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HCAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HCAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HCAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "HS", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.HS.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "HS", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.HS.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "IntestinalACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.IntestinalACA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "IntestinalACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.IntestinalACA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "IntestinalNeo", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.IntestinalNeo.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "IntestinalNeo", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.IntestinalNeo.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Intracranial", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Intracranial.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Intracranial", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Intracranial.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Islet", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Islet.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Islet", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Islet.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Myeloid.Leukemia", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Myeloid.Leukemia.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Myeloid.Leukemia", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Myeloid.Leukemia.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Myxosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Myxosarcoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Myxosarcoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Myxosarcoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Odontogenic", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Odontogenic.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Odontogenic", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Odontogenic.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Osteoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Osteoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Osteoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Osteoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "OSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.OSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "OSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.OSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Leiomyosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Leiomyosarcoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Leiomyosarcoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Leiomyosarcoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MalMammary", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MalMammary.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MalMammary", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MalMammary.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MalOvarian", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MalOvarian.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MalOvarian", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MalOvarian.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MammAdenoacanthoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MammAdenoacanthoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MammAdenoacanthoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MammAdenoacanthoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "MammAdenocarcinoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.MammAdenocarcinoma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "MammAdenocarcinoma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.MammAdenocarcinoma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Meningioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Meningioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Meningioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Meningioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Mesothelioma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Mesothelioma.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Mesothelioma", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Mesothelioma.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Met", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Met.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Met", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Met.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Metastatic", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Metastatic.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Metastatic", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Metastatic.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Ectoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Ectoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Ectoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Ectoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Endoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Endoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Endoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Endoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Mesoderm", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Mesoderm.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Mesoderm", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Mesoderm.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "OvarianCarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.OvarianCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "OvarianCarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.OvarianCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Pheo", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Pheo.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Pheo", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Pheo.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PitAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PitAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PitAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PitAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "PulMetastasis", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.PulMetastasis.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "PulMetastasis", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.PulMetastasis.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "RCC", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.RCC.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "RCC", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.RCC.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "RhSA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.RhSA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "RhSA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.RhSA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "STS", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.STS.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "STS", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.STS.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "ThyroidAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.ThyroidAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "ThyroidAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyroidAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "ThyroidCarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.ThyroidCarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "ThyroidCarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.ThyroidCarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "TubulostromalACA", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.TubulostromalACA.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "TubulostromalACA", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.TubulostromalACA.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "TubulostromalAd", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.TubulostromalAd.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "TubulostromalAd", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.TubulostromalAd.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UndiffSarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UndiffSarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UndiffSarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UndiffSarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UterineStromalSarc", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UterineStromalSarc.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UterineStromalSarc", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UterineStromalSarc.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "UnilHarderian", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.UnilHarderian.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "UnilHarderian", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.UnilHarderian.Rdata") +rm(AM.qtl, LM.qtl) + +LM.qtl = scanone(pheno = pheno, pheno.col = "Epidermal", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +save(LM.qtl, file = "LMQTL.Epidermal.Rdata") +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = "Epidermal", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, cross = "HS", + sdp.file = sdp.file, ncl = 2) +save(AM.qtl, file = "AMQTL.Epidermal.Rdata") +rm(AM.qtl, LM.qtl) + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/HZE.Plots") + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.BHGT.Rdata") +jpeg('Harderian Gland Tumors, Bilateral (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Tumors, Bilateral (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.CPT.Rdata") +jpeg('Choroid Plexus Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Choroid Plexus Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Dpolyp.Rdata") +jpeg('Duodenal Polyp (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Duodenal Polyp (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Ectoderm.Rdata") +jpeg('Ectoderm Derived Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ectoderm Derived Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Endoderm.Rdata") +jpeg('Endoderm Derived Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Endoderm Derived Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.EndoPolyp.Rdata") +jpeg('Endometrial Stromal Polyp (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Endometrial Stromal Polyp (Uirradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Ependymoma.Rdata") +jpeg('Ependymoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ependymoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Epidermal.Rdata") +jpeg('Epidermis Derived Tumors (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Epidermis Derived Tumors (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.FSA.Rdata") +jpeg('Fibrosarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Fibrosarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.GastSCC.Rdata") +jpeg('Gastric Squamous Cell Carcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Gastric Squamous Cell Carcinoma (HZE Ion Irradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.GCT.Rdata") +jpeg('Ovarian Granulosa Cell Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Granulosa Cell Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HCAd.Rdata") +jpeg('Hepatocellular Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatocellular Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HCC.Rdata") +jpeg('Hepatocellular Carcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatocellular Carcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Hemangioma.Rdata") +jpeg('Hemangioma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hemangioma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Hepatoblastoma.Rdata") +jpeg('Hepatoblastoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hepatoblastoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HGAca.Rdata") +jpeg('Harderian Gland Adenocarcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Adenocarcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HGAd.Rdata") +jpeg('Harderian Gland Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HS.Rdata") +jpeg('Histiocytic Sarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Histiocytic Sarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HSA.Rdata") +jpeg('Hemangiosarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Hemangiosarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.IntestinalACA.Rdata") +jpeg('Intestinal Adenocarcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intestinal Adenocarcinoma (HZE Ion Irradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.IntestinalNeo.Rdata") +jpeg('Intestinal Neoplasm (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intestinal Neoplasm (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Intracranial.Rdata") +jpeg('Intracranial Neoplasm (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Intracranial Neoplasm (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Islet.Rdata") +jpeg('Pancreatic Islet Cell Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pancreatic Islet Cell Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Leiomyosarcoma.Rdata") +jpeg('Leiomyosarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Leiomyosarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.LSA.Rdata") +jpeg('Lymphoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Lymphoma (HZE Ion Irradiated)") +dev.off() + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.MalMammary.Rdata") +jpeg('Malignant Mammary Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Malignant Mammary Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.MalOvarian.Rdata") +jpeg('Malignant Ovarian Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Malignant Ovarian Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.MammAdenoacanthoma.Rdata") +jpeg('Mammary Adenoacanthoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mammary Adenoacanthoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.MammAdenocarcinoma.Rdata") +jpeg('Mammary Adenocarcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mammary Adenocarcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Meningioma.Rdata") +jpeg('Meningioma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Meningioma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Mesoderm.Rdata") +jpeg('Mesoderm Derived Tumor (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mesoderm Derived Tumor (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Mesothelioma.Rdata") +jpeg('Mesothelioma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Mesothelioma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Met.Rdata") +jpeg('Metastatic Disease (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Metastatic Disease (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Myeloid.Leukemia.Rdata") +jpeg('Myeloid Leukemia (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Myeloid Leukemia (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Myxosarcoma.Rdata") +jpeg('Myxosarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Myxosarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.NN.Rdata") +jpeg('Non-neoplastic (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Non-neoplastic (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Odontogenic.Rdata") +jpeg('Odotogenic Tumors (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Odontogenic Tumors (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.OSA.Rdata") +jpeg('Osteosarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Osteosarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Osteoma.Rdata") +jpeg('Osteoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Osteoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.OvarianCarc.Rdata") +jpeg('Ovarian Carcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Carcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Pheo.Rdata") +jpeg('Pheochromocytoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pheochromocytoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PitAd.Rdata") +jpeg('Pituitary Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pituitary Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulAd.Rdata") +jpeg('Pulmonary Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulAdenoma.Rdata") +jpeg('Pulmonary Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulMetastasis.Rdata") +jpeg('Pulmonary Metastases (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Metastases (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulmonaryAdenocarcinoma.Rdata") +jpeg('Pulmonary Adenocarcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Adenocarcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulSarcomatoidCarc.Rdata") +jpeg('Pulmonary Sarcomatoid Carcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Pulmonary Sarcomatoid Carcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.RCC.Rdata") +jpeg('Renal Cell Carcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Renal Cell Carcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.RhSA.Rdata") +jpeg('Rhabdomyosarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Rhabdomyosarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.STS.Rdata") +jpeg('Soft Tissue Sarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Soft Tissue Sarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.ThyroidAd.Rdata") +jpeg('Thyroid Follicular Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Thyroid Follicular Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.ThyroidCarc.Rdata") +jpeg('Thyroid Follicular Carcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Thyroid Follicular Carcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.TubulostromalACA.Rdata") +jpeg('Ovarian Tubulostroma Adenocarcinoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Tubulostroma Adenocarcinoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.TubulostromalAd.Rdata") +jpeg('Ovarian Tubulostromal Adenoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Ovarian Tubulostromal Adenoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.UndiffSarc.Rdata") +jpeg('Undifferentiated Sarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Undifferentiated Sarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.UnilHarderian.Rdata") +jpeg('Harderian Gland Tumor, Unilateral (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Harderian Gland Tumor, Unilateral (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.UterineStromalSarc.Rdata") +jpeg('Uterine Stromal Sarcoma (HZE Ion Irradiated)', width = 1600, height = 800, res = 80) +DOQTL:::plot.scanone.assoc(AM.qtl, bin.size = 100, main = "Uterine Stromal Sarcoma (HZE Ion Irradiated)") +dev.off() +rm(AM.qtl) \ No newline at end of file diff --git a/Heatmap.R b/Heatmap.R new file mode 100644 index 0000000..29e04aa --- /dev/null +++ b/Heatmap.R @@ -0,0 +1,986 @@ +library(GenomicRanges) +library(BSgenome.Mmusculus.UCSC.mm10) +library(DOQTL) +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/") + +# Plot function (w/ binning to average markers and max LOD) +plot.hs.qtl = function(qtl, bin.width = 10000, ...) { + + new.qtl = NULL + for(chr in 1:length(qtl)) { + + print(chr) + + # Create 100 SNP bins. + brks = cut(x = 1:length(qtl[[chr]]), breaks = length(qtl[[chr]]) / bin.width) + # Split up the SNP positions and get the mean. + pos = split(start(qtl[[chr]]), brks) + pos = sapply(pos, mean) + # Split up the p-values and get the max. + pv = split(mcols(qtl[[chr]])$p.value, brks) + pv = sapply(pv, min) + + # Make a single new GRanges object to return. + gr = GRanges(seqnames = seqnames(qtl[[chr]])[1], + ranges = IRanges(start = pos, width = 1), p.value = pv) + + if(chr == 1) { + new.qtl = gr + } else { + new.qtl = c(new.qtl, gr) + } # else + + } # for(chr) + + # Get the chromosome lengths. + chrlen = seqlengths(BSgenome.Mmusculus.UCSC.mm10) + names(chrlen) = sub("^chr", "", names(chrlen)) + chrlen = chrlen[seqlevels(new.qtl)] * 1e-6 + + # Add the chr lengths to the chromosomes for plotting. + # Switch positions to genome Mb. + gmb = start(new.qtl) * 1e-6 + for(chr in 2:length(chrlen)) { + + wh = which(seqnames(new.qtl) == names(chrlen)[chr]) + gmb[wh] = gmb[wh] + sum(chrlen[1:(chr - 1)]) + + } # for(chr) + + # Get chromosome mid-points for plotting the Chr name. + chrmid = (chrlen / 2) + cumsum(c(1, chrlen[-length(chrlen)])) + + # Make the plot. + col = rep(rgb(0,0,0), length(new.qtl)) + even.chr = which(seqnames(new.qtl) %in% (1:10 * 2)) + col[even.chr] = rgb(0.7,0.7,0.7) + plot(gmb, -log10(new.qtl$p.value), pch = 20, xaxt = "n", + col = col, las = 1, xlab = "", ylab = "-log10(p-value)", ...) + mtext(side = 1, line = 0.5, at = chrmid, text = names(chrlen), cex = 1.2) + + return(new.qtl) + +} # plot.hs.qtl + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/") + +##HZE############################################# +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.BHGT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.BHGT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Ectoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Ectoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Endoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Endoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.GCT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.GCT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HCC.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.HCC.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HGAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.HGAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HGT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.HGT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HS.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.HS.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.HSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.HSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Intracranial.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Intracranial.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.LSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.LSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.MalMammary.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.MalMammary.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.MammAdenocarcinoma.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.MalMammAdenocarcinoma.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Mesoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Mesoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Metastatic.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Metastatic.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.Myeloid.Leukemia.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.Myeloid.Leukemia.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.NN.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.NN.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.OSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.OSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PitAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.PitAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulmonaryAdenocarcinoma.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.PulmonaryAdenocarcinoma.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.PulSarcomatoidCarc.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.PulSarcomatoidCarc.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.RhSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.RhSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.STS.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.STS.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.ThyroidAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.ThyroidAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/HZE/AMQTL.ThyTumor.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "HZE.ThyTumor.heatmap.Rdata") +rm(qtl, qtl.smaller) + + +##Gamma############################################# +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.BHGT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.BHGT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Ectoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Ectoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Endoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Endoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.GCT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.GCT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.HCC.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.HCC.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.HGAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.HGAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.HGT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.HGT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.HS.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.HS.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.HSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.HSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Intracranial.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Intracranial.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.LSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.LSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.MalMammary.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.MalMammary.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.MammAdenocarcinoma.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.MalMammAdenocarcinoma.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Mesoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Mesoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Metastatic.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Metastatic.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.Myeloid.Leukemia.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.Myeloid.Leukemia.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.NN.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.NN.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.OSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.OSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.PitAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.PitAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.PulmonaryAdenocarcinoma.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.PulmonaryAdenocarcinoma.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.PulSarcomatoidCarc.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.PulSarcomatoidCarc.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.RhSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.RhSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.STS.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.STS.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.ThyroidAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.ThyroidAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Gamma/AMQTL.ThyTumor.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Gamma.ThyTumor.heatmap.Rdata") +rm(qtl, qtl.smaller) + + +##Background############################################# +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.BHGT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.BHGT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Ectoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Ectoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Endoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Endoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.HCC.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.HCC.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.HGAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.HGAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.HGT.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.HGT.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.HS.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.HS.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.HSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.HSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Intracranial.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Intracranial.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.LSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.LSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.MalMammary.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.MalMammary.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.MammAdenocarcinoma.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.MalMammAdenocarcinoma.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Mesoderm.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Mesoderm.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Metastatic.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Metastatic.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.Myeloid.Leukemia.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.Myeloid.Leukemia.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.NN.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.NN.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.OSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.OSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.PitAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.PitAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.PulmonaryAdenocarcinoma.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.PulmonaryAdenocarcinoma.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.PulSarcomatoidCarc.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.PulSarcomatoidCarc.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.RhSA.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.RhSA.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.STS.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.STS.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.ThyroidAd.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.ThyroidAd.heatmap.Rdata") +rm(qtl, qtl.smaller) + +load(file ="/Users/elijahedmondson/Desktop/R/QTL/WD/Mapping Files/Background/AMQTL.ThyTumor.Rdata") +qtl <- AM.qtl +rm(AM.qtl) +qtl.smaller = plot.hs.qtl(qtl) +save(qtl.smaller, file = "Background.ThyTumor.heatmap.Rdata") +rm(qtl, qtl.smaller) + + +#Load all files for combination############################################# +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.BHGT.heatmap.Rdata") +HZE.BHGT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Ectoderm.heatmap.Rdata") +HZE.Ectoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Endoderm.heatmap.Rdata") +HZE.Endoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.GCT.heatmap.Rdata") +HZE.GCT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.HCC.heatmap.Rdata") +HZE.HCC <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.HGAd.heatmap.Rdata") +HZE.HGAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.HGT.heatmap.Rdata") +HZE.HGT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.HS.heatmap.Rdata") +HZE.HS <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.HSA.heatmap.Rdata") +HZE.HSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Intracranial.heatmap.Rdata") +HZE.Intracranial <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.LSA.heatmap.Rdata") +HZE.LSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.MalMammAdenocarcinoma.heatmap.Rdata") +HZE.MammAdenocarcinoma <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.MalMammary.heatmap.Rdata") +HZE.MalMammary <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Mesoderm.heatmap.Rdata") +HZE.Mesoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Metastatic.heatmap.Rdata") +HZE.Metastatic <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.Myeloid.Leukemia.heatmap.Rdata") +HZE.AML <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.NN.heatmap.Rdata") +HZE.NN <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.OSA.heatmap.Rdata") +HZE.OSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.PitAd.heatmap.Rdata") +HZE.PitAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.PulmonaryAdenocarcinoma.heatmap.Rdata") +HZE.PulmonaryAdenocarcinoma <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.PulSarcomatoidCarc.heatmap.Rdata") +HZE.PulSarcomatoidCarc <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.RhSA.heatmap.Rdata") +HZE.RhSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.STS.heatmap.Rdata") +HZE.STS <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.ThyroidAd.heatmap.Rdata") +HZE.ThyroidAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/HZE.ThyTumor.heatmap.Rdata") +HZE.ThyTumor <- qtl.smaller +rm(qtl.smaller) + +######################Load GAMMA####################################### +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.BHGT.heatmap.Rdata") +Gamma.BHGT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Ectoderm.heatmap.Rdata") +Gamma.Ectoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Endoderm.heatmap.Rdata") +Gamma.Endoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.GCT.heatmap.Rdata") +Gamma.GCT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.HCC.heatmap.Rdata") +Gamma.HCC <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.HGAd.heatmap.Rdata") +Gamma.HGAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.HGT.heatmap.Rdata") +Gamma.HGT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.HS.heatmap.Rdata") +Gamma.HS <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.HSA.heatmap.Rdata") +Gamma.HSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Intracranial.heatmap.Rdata") +Gamma.Intracranial <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.LSA.heatmap.Rdata") +Gamma.LSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.MalMammAdenocarcinoma.heatmap.Rdata") +Gamma.MammAdenocarcinoma <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.MalMammary.heatmap.Rdata") +Gamma.MalMammary <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Mesoderm.heatmap.Rdata") +Gamma.Mesoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Metastatic.heatmap.Rdata") +Gamma.Metastatic <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.Myeloid.Leukemia.heatmap.Rdata") +Gamma.AML <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.NN.heatmap.Rdata") +Gamma.NN <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.OSA.heatmap.Rdata") +Gamma.OSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.PitAd.heatmap.Rdata") +Gamma.PitAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.PulmonaryAdenocarcinoma.heatmap.Rdata") +Gamma.PulmonaryAdenocarcinoma <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.PulSarcomatoidCarc.heatmap.Rdata") +Gamma.PulSarcomatoidCarc <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.RhSA.heatmap.Rdata") +Gamma.RhSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.STS.heatmap.Rdata") +Gamma.STS <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.ThyroidAd.heatmap.Rdata") +Gamma.ThyroidAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Gamma.ThyTumor.heatmap.Rdata") +Gamma.ThyTumor <- qtl.smaller +rm(qtl.smaller) + +#########################load BACKGROUND############################ +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.BHGT.heatmap.Rdata") +Background.BHGT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Ectoderm.heatmap.Rdata") +Background.Ectoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Endoderm.heatmap.Rdata") +Background.Endoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.HCC.heatmap.Rdata") +Background.HCC <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.HGAd.heatmap.Rdata") +Background.HGAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.HGT.heatmap.Rdata") +Background.HGT <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.HS.heatmap.Rdata") +Background.HS <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.HSA.heatmap.Rdata") +Background.HSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Intracranial.heatmap.Rdata") +Background.Intracranial <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.LSA.heatmap.Rdata") +Background.LSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.MalMammAdenocarcinoma.heatmap.Rdata") +Background.MammAdenocarcinoma <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.MalMammary.heatmap.Rdata") +Background.MalMammary <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Mesoderm.heatmap.Rdata") +Background.Mesoderm <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Metastatic.heatmap.Rdata") +Background.Metastatic <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.Myeloid.Leukemia.heatmap.Rdata") +Background.AML <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.NN.heatmap.Rdata") +Background.NN <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.OSA.heatmap.Rdata") +Background.OSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.PitAd.heatmap.Rdata") +Background.PitAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.PulmonaryAdenocarcinoma.heatmap.Rdata") +Background.PulmonaryAdenocarcinoma <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.PulSarcomatoidCarc.heatmap.Rdata") +Background.PulSarcomatoidCarc <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.RhSA.heatmap.Rdata") +Background.RhSA <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.STS.heatmap.Rdata") +Background.STS <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.ThyroidAd.heatmap.Rdata") +Background.ThyroidAd <- qtl.smaller +rm(qtl.smaller) + +load(file="/Users/elijahedmondson/Desktop/R/QTL/WD/Heatmap/Background.ThyTumor.heatmap.Rdata") +Background.ThyTumor <- qtl.smaller +rm(qtl.smaller) + +#Combining the columns############################################# +combined <- cbind(-log10(HZE.AML$p.value), + -log10(HZE.GCT$p.value), + -log10(HZE.HCC$p.value), + -log10(HZE.HGT$p.value), + -log10(HZE.HS$p.value), + -log10(HZE.HSA$p.value), + -log10(HZE.LSA$p.value), + -log10(HZE.MalMammary$p.value), + -log10(HZE.Metastatic$p.value), + -log10(HZE.OSA$p.value), + -log10(HZE.PitAd$p.value), + -log10(HZE.PulmonaryAdenocarcinoma$p.value), + -log10(HZE.PulSarcomatoidCarc$p.value), + -log10(HZE.RhSA$p.value), + -log10(HZE.STS$p.value), + -log10(HZE.ThyTumor$p.value), + -log10(Gamma.AML$p.value), + -log10(Gamma.GCT$p.value), + -log10(Gamma.HCC$p.value), + -log10(Gamma.HGT$p.value), + -log10(Gamma.HS$p.value), + -log10(Gamma.HSA$p.value), + -log10(Gamma.LSA$p.value), + -log10(Gamma.MalMammary$p.value), + -log10(Gamma.Metastatic$p.value), + -log10(Gamma.OSA$p.value), + -log10(Gamma.PitAd$p.value), + -log10(Gamma.PulmonaryAdenocarcinoma$p.value), + -log10(Gamma.PulSarcomatoidCarc$p.value), + -log10(Gamma.RhSA$p.value), + -log10(Gamma.STS$p.value), + -log10(Gamma.ThyTumor$p.value), + -log10(Background.AML$p.value), + -log10(Background.HCC$p.value), + -log10(Background.HGT$p.value), + -log10(Background.HS$p.value), + -log10(Background.HSA$p.value), + -log10(Background.LSA$p.value), + -log10(Background.MalMammary$p.value), + -log10(Background.Metastatic$p.value), + -log10(Background.OSA$p.value), + -log10(Background.PitAd$p.value), + -log10(Background.PulmonaryAdenocarcinoma$p.value), + -log10(Background.PulSarcomatoidCarc$p.value), + -log10(Background.RhSA$p.value), + -log10(Background.STS$p.value), + -log10(Background.ThyTumor$p.value)) + +write.csv(combined, file="/Users/elijahedmondson/Desktop/csv.csv") + +csv <-read.csv(file="/Users/elijahedmondson/Desktop/csv.csv", comment.char="#") +rnames <- csv[,1] +mat_data <- data.matrix(csv[,2:ncol(csv)]) + +##plot############################################# +mypalette <- colorRampPalette(c("green", "yellow", "red"))(n = 299) + +heatmap.2(t(mat_data), Colv=NA, labCol=NA, trace ="row", col=mypalette, + tracecol = "black", + RowSideColors = c( + rep("gray", 0), + rep("blue", 13), + rep("black", 13))) + +par(lend = 1) +legend(.75, 3, legend = c("Unirradiated", "HZE", "Gamma"), + col = c("gray", "blue", "black"), lty= 1, lwd = 10) + + +##Plotting 3 QTL maps for comparison## +layout(matrix(3:1, 3, 1)) +DOQTL:::plot.scanone.assoc(HZE.AML, chr=15, bin.size = 100, main = "HZE Ion") +DOQTL:::plot.scanone.assoc(Gamma.AML, chr=15, bin.size = 100, main = "Gamma ray") +DOQTL:::plot.scanone.assoc(Unirradiate.AML, chr=15, bin.size = 100, main = "Unirradiated") + + +##plot w perms############################################# + +perms <- scanone.perm(pheno, pheno.col = "OSA", probs = model.probs, + addcovar = addcovar, snps = MM_snps, nperm=5) +thr1 = quantile(perms, probs = 0.90) +thr2 = quantile(perms, probs = 0.95) +thr3 = quantile(perms, probs = 0.99) + +plot(AM.qtl, chr = 14, sig.thr = c(thr1, thr2, thr3), main = "") + + + + + + + + diff --git a/KM code.R b/KM code.R new file mode 100644 index 0000000..c462882 --- /dev/null +++ b/KM code.R @@ -0,0 +1,81 @@ +# install.packages("survival") +library(splines) +library(survival) +library(KMsurv) +library(OIsurv) + + +attach(GRSD) +names(GRSD) + +time <- days +event <- HCC +X <- cbind(GROUP, sex, family, coat.color) +group <- GROUP + +#Log-logistic parametric model coefficients +loglogistic <- survreg(Surv(time,event) ~ X, dist="loglogistic") +summary(loglogistic) + +# Cox proportional hazard model - coefficients and hazard rates +coxph <- coxph(Surv(time,event) ~ X, method="breslow") +summary(coxph) + + + + + + + + +# Descriptive statistics +summary(time) +summary(event) +summary(X) +summary(group) + +# Kaplan-Meier non-parametric analysis +kmsurvival <- survfit(Surv(time,event) ~ 1) +summary(kmsurvival) +plot(kmsurvival, mark.time=TRUE, mark=1, col=1, lty=1, lwd=3, cex=1, log=FALSE, xlab="Days Post-Irradiation", ylab="Survival Probability") +title("GRSD Lymphoma") + +# Kaplan-Meier non-parametric analysis by group +kmsurvival1 <- survfit(Surv(time, event) ~ group.broad) +summary(kmsurvival1) +plot(kmsurvival1, conf.int="both", mark.time=TRUE, + mark=4, col=1, lty=1:5, lwd=2, cex=1, log=FALSE, xscale=1, yscale=1, + firstx=0, firsty=1, ymin=0, xlab="Days Post-Irradiation", ylab="Survival Probability") +legend(30, .3, c("Gamma", "HZE", "Unirradiated"), lty = 1:5, lwd=2) +title("GRSD Lymphoma") + +#The previous without 95% CI +kmsurvival1 <- survfit(Surv(time, event) ~ group.broad) +summary(kmsurvival1) +plot(kmsurvival1, conf.int="none", mark.time=TRUE, + mark=4, col=1, lty=1:5, lwd=2, cex=1, log=FALSE, xscale=1, yscale=1, + firstx=0, firsty=1, ymin=0, xlab="Days Post-Irradiation", ylab="Survival Probability") +legend(30, .3, c("Gamma", "HZE", "Unirradiated"), lty = 1:5, lwd=2) +title("GRSD Lymphoma") + +# Nelson-Aalen non-parametric analysis +nasurvival <- survfit(coxph(Surv(time,event)~1), type="aalen") +summary(nasurvival) +plot(nasurvival, xlab="Time", ylab="Survival Probability") + + +# Cox proportional hazard model - coefficients and hazard rates +coxph <- coxph(Surv(time,event) ~ X, method="breslow") +summary(coxph) + + +# Exponential, Weibull, and log-logistic parametric model coefficients +exponential <- survreg(Surv(time,event) ~ X, dist="exponential") +summary(exponential) + +weibull <- survreg(Surv(time,event) ~ X, dist="weibull") +summary(weibull) + +loglogistic <- survreg(Surv(time,event) ~ X, dist="loglogistic") +summary(loglogistic) + diff --git a/QTL.R b/QTL.R new file mode 100644 index 0000000..5196666 --- /dev/null +++ b/QTL.R @@ -0,0 +1,97 @@ +library(DOQTL) + +load(file = "~/Desktop/R/Build/K.Rdata") +load(file = "~/Desktop/R/Build/model.probs.Rdata") +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + +save(MM_snps, K, model.probs, sdp.file, file = "GRSD_master.Rdata") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/GRSD_master.Rdata") + + + +Sarcomatoid = read.csv("/Users/elijahedmondson/Desktop/R/GRSD.phenotype/CSV/PSC.csv") + +pheno = data.frame(row.names = Sarcomatoid$row.names, sex = as.numeric(Sarcomatoid$Sex == "M"), + sarcomatoid = as.numeric(Sarcomatoid$Sarcomatoid.Score)) + +covar = data.frame(sex = as.numeric(Sarcomatoid$Sex == "M")) +rownames(covar) = rownames(pheno) + +GRSD.phenotype = read.csv("/Users/elijahedmondson/Desktop/R/GRSD.phenotype/CSV/GRSD.phenotype.csv") + +pheno = data.frame(row.names = GRSD.phenotype$row.names, sex = as.numeric(GRSD.phenotype$sex == "M"), + Age = as.numeric(GRSD.phenotype$days), + Weight = GRSD.phenotype$weight, + BCS = GRSD.phenotype$BCS, + Albino = as.numeric(GRSD.phenotype$albino), + Black = as.numeric(GRSD.phenotype$black), + AML = as.numeric(GRSD.phenotype$Myeloid.Leukemia), + Lymphoma = as.numeric(GRSD.phenotype$Lymphoma)) + +covar = data.frame(sex = as.numeric(GRSD.phenotype$sex == "M")) +rownames(covar) = rownames(pheno) + +qtl = scanone(pheno = pheno, pheno.col = "Lymphoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) + +plot(qtl, main = "") + +perms = scanone.perm(pheno = pheno, pheno.col = "Amyloidosis", probs = model.probs, addcovar = covar, + snps = MM_snps, path = "/Users/elijahedmondson/Desktop/R/QTL/perms", + nperm = 1000) + +thr1 = quantile(perms, probs = 0.90) +thr2 = quantile(perms, probs = 0.95) +thr3 = quantile(perms, probs = 0.99) + +plot(qtl, sig.thr = c(thr1, thr2, thr3), main = "") + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +save(perms, file = "OSAPerms.Rdata") +save(qtl, file = "LSA.AMLQTL.Rdata") +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + +interval = bayesint(qtl, chr = 14) +interval +mgi = get.mgi.features(chr = interval[1,2], start = interval[1,3], end = interval[3,3], type = "gene", source = "MGI") +nrow(mgi) +head(mgi) + + +ma = assoc.map(pheno = pheno, pheno.col = "sarcomatoid", probs = model.probs, K = K, addcovar = covar, + snps = MM_snps, chr = interval[1,2], start = interval[1,3], end = interval[3,3]) +coefplot(qtl, chr = 1) +tmp = assoc.plot(ma, thr = 1) +unique(tmp$sdps) + + +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/GRSD.K.model.probs.RData") +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) +load(file = "/Users/elijahedmondson/Desktop/R/QTL/HMM/chr19.emission.probs.Rdata") +load(file = "") +library(DOQTL) + +# ASSOCIATION FROM D GATTI 2/4/15 # + +library(DOQTL) +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") + +sdp.file = "/Users/elijahedmondson/Desktop/R/QTL/WD/HS_Sanger_SDPs.txt.bgz" + +pheno[,2] = as.numeric(pheno[,2]) - 1 + +qtlscan = scanone.assoc(pheno = pheno, pheno.col = "", probs = model.probs, K = K, + addcovar = covar, markers = MM_snps, sdp.file = sdp.file, ncl = 2) + +save(qtlscan, file = "Amyloidosis_AM.Rdata") + +png("QTL.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtlscan, bin.size = 100) +dev.off() + +png("sarcomatoid_QTL_chr1.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtlscan, chr = 6, bin.size = 10) +dev.off() + + diff --git a/SNP Retrieval and Manipulation.R b/SNP Retrieval and Manipulation.R new file mode 100644 index 0000000..d61b7ae --- /dev/null +++ b/SNP Retrieval and Manipulation.R @@ -0,0 +1,4 @@ +source("http://bioconductor.org/biocLite.R") +biocLite(c("IRanges", "GenomicRanges", "Biostrings", "Rsamtools")) +install.packages("SNPtools") +library(SNPtools) diff --git a/Test.R b/Test.R new file mode 100644 index 0000000..e95973c --- /dev/null +++ b/Test.R @@ -0,0 +1,65 @@ +#Loading Packages and Data +library(DOQTL) +library(doParallel) +library(foreach) +library(Rsamtools) +library(VariantAnnotation) +library(GenomicRanges) +library(survival) +library(regress) +sample <- read.csv(file = "/Users/elijahedmondson/Desktop/sample.csv") +load(file = "/Users/elijahedmondson/Desktop/GRSD_master.Rdata") +cross = "HS" +options(stringsAsFactors = F) +snp.file = "/Users/elijahedmondson/Desktop/R/Build/mgp.v4.snps.dbSNP.vcf.gz" +sdp.file = "/Users/elijahedmondson/Desktop/R/Build/HS_Sanger_SDPs.txt.bgz" +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +pheno = data.frame(row.names = sample$row.names, sex = as.numeric(sample$sex == "M"), + albino = as.numeric(sample$albino), + days = as.numeric(sample$days)) +covar = data.frame(sex = as.numeric(sample$sex == "M")) +addcovar = covar +rownames(covar) = rownames(pheno) +rownames(addcovar) = rownames(pheno) + +#Linkage Mapping +LM.qtl = scanone(pheno = pheno, pheno.col = "days", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) +plot(LM.qtl, main = "test") +save(LM.qtl, file = "") +perms = scanone.perm(pheno = pheno, pheno.col = "days", probs = model.probs, addcovar = covar, + snps = MM_snps, path = "/Users/elijahedmondson/Desktop/R/QTL/perms", + nperm = 10) +thr1 = quantile(perms, probs = 0.90) +thr2 = quantile(perms, probs = 0.95) +thr3 = quantile(perms, probs = 0.99) +plot(qtl, sig.thr = c(thr1, thr2, thr3), main = "") +interval = bayesint(qtl, chr = 7) +interval +mgi = get.mgi.features(chr = interval[1,2], start = interval[1,3], end = interval[3,3], + type = "gene", source = "MGI") +nrow(mgi) +head(mgi) + +#Association Mapping +pheno[,2] = as.numeric(pheno[,2]) - 1 + +AM.qtl = scanone.assoc(pheno = pheno, pheno.col = 2, probs = probs, K = K, + addcovar = covar, markers = markers, cross = "HS", sdp.file = sdp.file, ncl = 2) +plot(AM.qtl, main = "test") +save(AM.qtl, file = "") + +png("albino_QTL.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtl, bin.size = 100) +dev.off() + +png("albino_QTL_chr7.png", width = 2000, height = 1600, res = 128) +DOQTL:::plot.scanone.assoc(qtl, chr = 7, bin.size = 10) +dev.off() + + + + + + + diff --git a/Test2.R b/Test2.R new file mode 100644 index 0000000..db33c2b --- /dev/null +++ b/Test2.R @@ -0,0 +1,62 @@ +#Working with data + +Total <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/Total-Table 1.csv") +str(Total) + +LSA <- Total[ which(Total$Lymphoma == 1), ] + +correct <- function(x){ + if(x == "gamma") + return("Gamma") + if(x == "HZE-Fe") + return("HZE") + if(x == "HZE-Si") + return("HZE") + if(x == "sham irradiated") + return("Unirradiated") + if(x == "unirradiated") + return("Unirradiated") + else + return(NA) +} + +LSA$GROUP <- sapply(LSA$group, correct) + +LSA <- Total[ which(Total$Lymphoma == 1), ] +table(LSA$LSA.MI) +table(LSA$LSA.B.T) + +hist(LSA$LSA.MI) +hist(LSA$LSA.MI, group = "LSA$LSA.Subtype") + +plot(LSA$LSA.MI, LSA$days) +plot(LSA$LSA.Grade, LSA$days) + +boxplot(formula = days ~ LSA.Grade, data = LSA) +boxplot(formula = days ~ LSA.B.T, data = LSA) +boxplot(formula = days ~ LSA.Subtype, data = LSA) +boxplot(formula = days ~ LSA.Subtype..simple., data = LSA) +boxplot(formula = days ~ LSA.Notch, data = LSA) +boxplot(formula = days ~ coat.color, data = LSA) + +#ggplot2 + +qplot(data = LSA, LSA.MI, days) +qplot(data = LSA, LSA.MI, days, color = LSA.Subtype) +qplot(data = LSA, LSA.MI, days, geom = c("point", "smooth")) + +qplot(data = LSA, LSA.MI, fill = LSA.Subtype) +qplot(data = LSA, log(LSA.MI), fill = group) +qplot(data = LSA, LSA.MI, fill = group) + +qplot(data = LSA, LSA.MI, facets = LSA.Subtype..simple. ~ ., binwidth = 5) +qplot(data = LSA, LSA.MI, days, facets = .~LSA.Subtype..simple.) +qplot(data = LSA, LSA.MI, facets = group~ ., binwidth = 5) +qplot(data = LSA, LSA.MI, days, facets = .~group) + +begin <- Sys.time() + + + +end <- difftime(Sys.time(), begin, units = 'hours') +end diff --git a/assoc_coxph_hq.R b/assoc_coxph_hq.R new file mode 100644 index 0000000..76ca248 --- /dev/null +++ b/assoc_coxph_hq.R @@ -0,0 +1,320 @@ +# Lifespan, females only, COXPH with unique SDPs. +library(DOQTL) +library(doParallel) +library(foreach) +library(Rsamtools) +library(VariantAnnotation) +library(GenomicRanges) +library(survival) +library(regress) +library(Rmpi) +options(stringsAsFactors = F) +setwd("/Users/elijah/Desktop/R/QTL/WD") + +# Pass in the number of clusters (nodes). +args = commandArgs(trailingOnly = TRUE) +ncl = as.numeric(args[[1]]) + +#################### +# THINGS TO CHANGE + +# Set the output file directory. +outdir = "/Users/elijah/Desktop/R/QTL/WD/hq_snps" + +# Load in your data. This file contains pheno, probs, markers and K. +HZE <- read.csv("~/Desktop/HZE-Fe.csv") +load(file = "/Users/elijah/Desktop/R/QTL/WD/model.probs.Rdata") +probs <- model.probs +rm(model.probs) + +load(file = "/Users/elijah/Desktop/R/QTL/WD/K.Rdata") + +pheno = data.frame(row.names = HZE$row.names, sex = as.numeric(HZE$sex == "M"), + days = as.numeric(HZE$Cataract.2.0.Score), + cataract = as.numeric(HZE$Cataract.2.0.Event), + LSA = as.numeric(HZE$Lymphoma)) +rm(HZE) +covar = data.frame(sex = as.numeric(pheno$sex == "M")) +addcovar = cbind(sex = as.numeric(factor(pheno$sex)) - 1) +rownames(addcovar) = rownames(pheno) +rownames(covar) = rownames(pheno) + +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) +markers <- MM_snps +rm(MM_snps) +snps = markers[markers[,1] %in% dimnames(probs)[[3]],] +markers <- snps +rm(snps) + +stopifnot(nrow(markers) == dim(probs)[3]) +stopifnot(markers[,1] == dimnames(probs)[[3]]) + +# Set the Sanger SNP file location. +sdp.file = "/Users/elijah/Desktop/R/QTL/WD/HS_Sanger_SDPs.txt.bgz" +snp.file = "ftp://ftp.jax.org/SNPtools/variants/mgp.v5.merged.snps_all.dbSNP142.vcf.gz" + +# Set the cross type (DO or HS). +cross = "HS" + +# Set a file prefix for the output files. +file.prefix = "Cataract_Latency_coxph" + +# Set the plot title. +plot.title = "Cataract Latency, CoxPH, HQ SNPs" + +#################### + +# Set up covariates +rownames(addcovar) = rownames(pheno) + +## Remove unused samples (?) +pheno = pheno[rownames(pheno) %in% dimnames(probs)[[1]],,drop = FALSE] +probs = probs[dimnames(probs)[[1]] %in% rownames(pheno),,] +probs = probs[match(rownames(pheno), dimnames(probs)[[1]]),,] +probs = probs[,,dimnames(probs)[[3]] %in% markers[,1]] + +# Split up the data by chromosome. +chrs = c(1:19, "X") +data = vector("list", length(chrs)) +names(data) = chrs +for(i in 1:length(chrs)) { + + rng = which(markers[,2] == chrs[i]) + data[[i]] = list(probs = probs[,,rng], K = K[[i]], + markers = markers[rng,]) + +} # for(i) +rm(probs, K, markers) + +setwd(outdir) + +# Make a function for each worker to execute. +workfxn = function(data) { + + chr = data$markers[1,2] + + setwd(outdir) + + # Get the Sanger SNPs. + strains = sub("/", "_", do.colors[,2]) + if(cross == "HS") { + strains = sub("/", "_", hs.colors[,2]) + } # if(cross = "HS") + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # We have to do some work to extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + # Extract the SNP positions and genotypes. + sanger.hdr = data.frame(ID = names(rowData(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + + # Add C57BL/6J to the Sanger SNPs. + if(cross == "DO") { + sanger = cbind("A_J" = geno(sanger)$GT[,1,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,2:7,drop = FALSE]) + } else if(cross == "HS") { + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) + } # else + + # Convert allele calls to numeric values. + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + + # Create the survival object. + surv = Surv(pheno$days, pheno$cataract) + + # Null model. + null.mod = coxph(surv ~ addcovar) + null.ll = logLik(null.mod) + pv = rep(0, nrow(sanger)) + + # Get the unique SDPs between each pair of markers and + # calculate the COXPH LOD. + + # CoxPH function. + coxph.fxn = function(snp.rng, local.probs) { + + # Get the SDPs. + sdps = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdps)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdps = sdps[sdps2keep] + m = match(sdps, unique.sdps) + + # Calculate the SNP probs. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ll = rep(0, nrow(cur.sdps)) + + # Run the Cox PH model at each unique SDP. + for(j in 1:nrow(cur.sdps)) { + + mod = coxph(surv ~ addcovar + cur.alleles[j,]) + cur.ll[j] = logLik(mod) + + } # for(j) + # This is the LRS. + cur.ll = cur.ll - null.ll + + # Return the results. + cur.ll[m] + + } # coxph.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= data$markers[1,3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, data$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(data$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > data$markers[i,3] & + sanger.hdr$POS <= data$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = coxph.fxn(snp.rng, (data$probs[,,i] + + data$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > data$markers[nrow(data$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = coxph.fxn(snp.rng, data$probs[,,nrow(data$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LRS to p-values using the chi-squared distribution. + pv = pchisq(2 * pv, df = 1, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn() + +# Set up the worker cluster. +cl = makeCluster(ncl, type = "MPI") +registerDoParallel(cl) +tmp = clusterEvalQ(cl, library(DOQTL)) +tmp = clusterEvalQ(cl, library(VariantAnnotation)) +tmp = clusterEvalQ(cl, library(regress)) +tmp = clusterEvalQ(cl, library(survival)) +clusterExport(cl, c("pheno", "addcovar", "snp.file", "outdir", "cross")) + +result = foreach(i = iter(data)) %dopar% { + + workfxn(i) + +} # for(each(i) + +save(result, file = paste0(file.prefix, ".Rdata")) + +stopCluster(cl) + +################# Without cluster +result1 <- workfxn(data[[1]]) +result2 <- workfxn(data[[2]]) +result3 <- workfxn(data[[3]]) +result4 <- workfxn(data[[4]]) +result5 <- workfxn(data[[5]]) +result6 <- workfxn(data[[6]]) +result7 <- workfxn(data[[7]]) +result8 <- workfxn(data[[8]]) +result9 <- workfxn(data[[9]]) +result10 <- workfxn(data[[10]]) +result11 <- workfxn(data[[11]]) +result12 <- workfxn(data[[12]]) +result13 <- workfxn(data[[13]]) +result14 <- workfxn(data[[14]]) +result15 <- workfxn(data[[15]]) +result16 <- workfxn(data[[16]]) +result17 <- workfxn(data[[17]]) +result18 <- workfxn(data[[18]]) +result19 <- workfxn(data[[19]]) +resultX <- workfxn(data[["X"]]) + + +result <- for(i=1:length(data)) { + workfxn(data[[i]]) +} + + +# Plotting function. +setwd(outdir) +files = dir(pattern = file.prefix) +png.files = grep("png$", files) +if(length(png.files) > 0) { + files = files[-png.files] +} +num = gsub(paste0("^", file.prefix, "_chr|\\.Rdata$"), "", files) +files = files[order(as.numeric(num))] +data = vector("list", length(files)) +names(data) = num[order(as.numeric(num))] +for(i in 1:length(files)) { + + print(i) + load(files[i]) + data[[i]] = pv + data[[i]][,6] = -log10(data[[i]][,6]) + +} # for(i) + +num.snps = sapply(data, nrow) +chrs = c(1:19, "X") + +xlim = c(0, sum(num.snps)) +ylim = c(0, max(sapply(data, function(z) { max(z[,6]) }))) + +# This plots all chromosomes. +png(paste0(file.prefix, "_QTL.png"), width = 2000, height = 1600, res = 200) +plot(-1, -1, col = 0, xlim = xlim, ylim = ylim, xlab = "", + ylab = "-log10(p-value)", las = 1, main = plot.title) +idx = 1 +for(i in 1:length(data)) { + print(i) + rng = idx:(idx + num.snps[i] - 1) + points(rng, data[[i]][,6], col = c("black", "grey50")[i %% 2 + 1], pch = 20) + idx = idx + num.snps[i] +} # for(i) +dev.off() diff --git a/assoc_loco_lm_hq.R b/assoc_loco_lm_hq.R new file mode 100644 index 0000000..08e9105 --- /dev/null +++ b/assoc_loco_lm_hq.R @@ -0,0 +1,304 @@ +# Association Mapping, LOCO LM, high quality SNPs. +library(DOQTL) +library(doParallel) +library(foreach) +library(Rsamtools) +library(VariantAnnotation) +library(GenomicRanges) +library(survival) +library(regress) +options(stringsAsFactors = F) +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") + +# Pass in the number of clusters (nodes). +args = commandArgs(trailingOnly = TRUE) +ncl = as.numeric(args[[1]]) + +#################### +# THINGS TO CHANGE + +# Set the output file directory. +outdir = "/Users/elijahedmondson/Desktop/R/QTL/WD/hq_snps" + +# Load in your data. This file contains pheno, probs, markers and K. +HZE.Fe <- read.csv("~/Desktop/R/GRSD.phenotype/CSV/HZE-Fe.csv") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/model.probs.Rdata") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/K.Rdata") +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) +pheno = data.frame(row.names = HZE.Fe$row.names, sex = as.numeric(HZE.Fe$sex == "M"), + albino = as.numeric(HZE.Fe$albino), + days = as.numeric(HZE.Fe$days), + LSA = as.numeric(HZE.Fe$Lymphoma)) +covar = data.frame(sex = as.numeric(HZE.Fe$sex == "M")) +addcovar = cbind(sex = as.numeric(factor(pheno$sex)) - 1) +rownames(addcovar) = rownames(pheno) +rownames(covar) = rownames(pheno) + +# Set the Sanger SNP file location. +snp.file = "/Users/elijahedmondson/Desktop/R/QTL/WD/HS_Sanger_SDPs.txt.bgz" +#above correct? + +# Set the cross type (DO or HS). +cross = "HS" + +# Set a file prefix for the output files. +file.prefix = "lifespan_assoc_loco_lm_hq" + +# Set the plot title. +plot.title = "Lifespan Association, LOCO LM, HQ SNPs" + +#################### + +# Remove censored data and RankZ the lifespan. +pheno = pheno[pheno$albino == 1,] +pheno$lifespan = rankZ(pheno$days) +probs= probs[rownames(pheno),,] +for(i in 1:length(K)) { + K[[i]] = K[[i]][rownames(pheno), rownames(pheno)] +} # for(i) + +addcovar = cbind(sex = as.numeric(factor(phenosSex)) - 1, + model.matrix(~pheno$Diet)[,-1]) +rownames(addcovar) = rownames(pheno) + +# Split up the data by chromosome. +chrs = c(1:19, "X") +data = vector("list", length(chrs)) +names(data) = chrs +for(i in 1:length(chrs)) { + + rng = which(markers[,2] == chrs[i]) + data[[i]] = list(probs = probs[,,rng], K = K[[i]], + markers = markers[rng,]) + +} # for(i) +rm(probs, K, markers) + +setwd(outdir) + +# Make a function for each worker to execute. +workfxn = function(data) { + + chr = data$markers[1,2] + + setwd(outdir) + + # Get the Sanger SNPs. + strains = sub("/", "_", do.colors[,2]) + if(cross == "HS") { + strains = sub("/", "_", hs.colors[,2]) + } # if(cross = "HS") + + hdr = scanVcfHeader(snp.file) + gr = GRanges(seqnames = chr, range = IRanges(start = 0, + end = 200e6)) + param = ScanVcfParam(geno = c("GT", "FI"), fixed = "ALT", + samples = strains[strains != "C57BL_6J"], which = gr) + sanger = readVcf(file = snp.file, genome = "mm10", param = param) + + # Keep high quality SNPs (quality == 1) + sanger = sanger[rowSums(geno(sanger)$FI, na.rm = TRUE) == 7] + + # Keep polymorphic SNPs. + keep = which(rowSums(geno(sanger)$GT == "0/0", na.rm = TRUE) < 7) + sanger = sanger[keep] + rm(keep) + + # Extract the alternate allele. + alt = CharacterList(fixed(sanger)$ALT) + alt = unstrsplit(alt, sep = ",") + + # Extract the SNP positions and genotypes. + sanger.hdr = data.frame(ID = names(rowData(sanger)), CHR = as.character(seqnames(sanger)), + POS = start(sanger), REF = as.character(fixed(sanger)$REF), + ALT = alt, stringsAsFactors = FALSE) + rm(alt) + + # Add C57BL/6J to the Sanger SNPs. + if(cross == "DO") { + sanger = cbind("A_J" = geno(sanger)$GT[,1,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,2:7,drop = FALSE]) + } else if(cross == "HS") { + sanger = cbind(geno(sanger)$GT[,1:4,drop = FALSE], + "C57BL_6J" = "0/0", + geno(sanger)$GT[,5:7,drop = FALSE]) + } # else + + # Convert allele calls to numeric values. + sanger = (sanger != "0/0") * 1 + + # Make the MAF between 1/8 and 4/8. + flip = which(rowSums(sanger) > 4) + sanger[flip,] = 1 - sanger[flip,,drop = FALSE] + rm(flip) + + # Calulcate the variance components. + mod = regress(pheno$lifespan ~ addcovar, ~data$K, pos = c(TRUE, TRUE)) + + # Create the error covariance matrix. + err.cov = mod$sigma[1] * data$K + mod$sigma[2] * diag(nrow(pheno)) + + # Invert the error covariance matrix. + eig = eigen(err.cov, symmetric = TRUE) + if(any(eig$values <= 0)) { + stop("The covariance matrix is not positive definite") + } # if(any(eig$values <= 0)) + err.cov = eig$vectors %*% diag(1.0 / sqrt(eig$values)) %*% t(eig$vectors) + rm(eig) + + # Rotate the phenotype and covariates. + ph = (err.cov %*% pheno$lifespan)[,1] + covar = err.cov %*% addcovar + + # Null model. + null.mod = lsfit(covar, ph) + null.ss = sum(null.mod$residuals^2) + pv = rep(0, nrow(sanger)) + + # Get the unique SDPs between each pair of markers and + # calculate the LOD. + + # LOCO LM function. + locolm.fxn = function(snp.rng, local.probs) { + + # Get the SDPs. + sdps = sanger[snp.rng,] %*% 2^(7:0) + sdps2keep = which(!duplicated(sdps)) + cur.sdps = sanger[snp.rng,,drop = FALSE][sdps2keep,,drop = FALSE] + unique.sdps = sdps[sdps2keep] + m = match(sdps, unique.sdps) + + # Calculate the SNP probs. + cur.alleles = tcrossprod(cur.sdps, local.probs) + cur.ss = rep(0, nrow(cur.sdps)) + + # Run the LOCO LM model at each unique SDP. + xmat = cbind(1, covar, 0) + replace.rng = ncol(xmat) + + for(j in 1:nrow(cur.sdps)) { + + xmat[,replace.rng] = cur.alleles[j,] + xrot = err.cov %*% xmat + mod = lsfit(xmat, ph, intercept = FALSE) + cur.ss[j] = sum(mod$residuals^2) + + } # for(j) + + # Return the SS. + cur.ss[m] + + } # locolm.fxn() + + # SNPs before the first marker. + snp.rng = which(sanger.hdr$POS <= data$markers[1,3]) + + if(length(snp.rng) > 0) { + + pv[snp.rng] = locolm.fxn(snp.rng, data$probs[,,1]) + + } # if(length(snp.rng) > 0) + + # SNPs between Markers. + for(i in 1:(nrow(data$markers)-1)) { + + snp.rng = which(sanger.hdr$POS > data$markers[i,3] & + sanger.hdr$POS <= data$markers[i+1,3]) + + if(length(snp.rng) > 0) { + + # Take the mean of the haplotype probs at the surrounding markers. + pv[snp.rng] = locolm.fxn(snp.rng, (data$probs[,,i] + + data$probs[,,i+1]) * 0.5) + + } # if(length(snp.rng) > 0) + + } # for(i) + + # SNPs after the last marker. + snp.rng = which(sanger.hdr$POS > data$markers[nrow(data$markers),3]) + if(length(snp.rng) > 0) { + + pv[snp.rng] = locolm.fxn(snp.rng, data$probs[,,nrow(data$markers)]) + + } # if(length(snp.rng) > 0) + + # Convert LS to p-values using the chi-squared distribution. + pv = -nrow(pheno) * log(pv / null.ss) + pv = pchisq(2 * pv, df = 1, lower.tail = FALSE) + pv = data.frame(sanger.hdr, pv, stringsAsFactors = FALSE) + + save(pv, file = paste0(file.prefix, "_chr", chr, ".Rdata")) + + png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) + plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20, xlab = "Mb", + ylab = "-log10(p-value)") + mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + dev.off() + + # Return the positions and p-values. + return(pv) + +} # workfxn() + +# Set up the worker cluster. +cl = makeCluster(ncl, type = "MPI") +registerDoParallel(cl) +tmp = clusterEvalQ(cl, library(DOQTL)) +tmp = clusterEvalQ(cl, library(VariantAnnotation)) +tmp = clusterEvalQ(cl, library(regress)) +clusterExport(cl, c("pheno", "addcovar", "snp.file", "outdir", "cross")) + +result = foreach(i = iter(data)) %dopar% { + + workfxn(i) + +} # for(each(i) + +save(result, file = paste0(file.prefix, ".Rdata")) + +stopCluster(cl) + + +# Plotting function. +setwd(outdir) +files = dir(pattern = paste0(file.prefix, "_chr")) +png.files = grep("png$", files) +if(length(png.files) > 0) { + files = files[-png.files] +} +num = gsub(paste0("^", file.prefix, "_chr|\\.Rdata$"), "", files) +files = files[order(as.numeric(num))] +data = vector("list", length(files)) +names(data) = num[order(as.numeric(num))] +for(i in 1:length(files)) { + + print(i) + load(files[i]) + data[[i]] = pv + data[[i]][,6] = -log10(data[[i]][,6]) + +} # for(i) + +num.snps = sapply(data, nrow) +chrs = c(1:19, "X") + +xlim = c(0, sum(num.snps)) +ylim = c(0, max(sapply(data, function(z) { max(z[,6]) }))) + +# This plots all chromosomes. +png(paste0(file.prefix, "_QTL.png"), width = 2000, height = 1600, res = 200) +plot(-1, -1, col = 0, xlim = xlim, ylim = ylim, xlab = "", + ylab = "-log10(p-value)", las = 1, main = plot.title) +idx = 1 +for(i in 1:length(data)) { + print(i) + rng = idx:(idx + num.snps[i] - 1) + points(rng, data[[i]][,6], col = c("black", "grey50")[i %% 2 + 1], pch = 20) + idx = idx + num.snps[i] +} # for(i) +dev.off() + + diff --git a/plot.hs.qtl.R b/plot.hs.qtl.R new file mode 100644 index 0000000..035005e --- /dev/null +++ b/plot.hs.qtl.R @@ -0,0 +1,81 @@ +library(GenomicRanges) +library(BSgenome.Mmusculus.UCSC.mm10) + +# This is the plot function. Source this into your scripts and you +# should be able to plot. +plot.hs.qtl = function(qtl, bin.width = 100, ...) { + + new.qtl = NULL + for(chr in 1:length(qtl)) { + + print(chr) + + # Create 100 SNP bins. + brks = cut(x = 1:length(qtl[[chr]]), breaks = length(qtl[[chr]]) / bin.width) + # Split up the SNP positions and get the mean. + pos = split(start(qtl[[chr]]), brks) + pos = sapply(pos, mean) + # Split up the p-values and get the max. + pv = split(mcols(qtl[[chr]])$p.value, brks) + pv = sapply(pv, min) + + # Make a single new GRanges object to return. + gr = GRanges(seqnames = seqnames(qtl[[chr]])[1], + ranges = IRanges(start = pos, width = 1), p.value = pv) + + if(chr == 1) { + new.qtl = gr + } else { + new.qtl = c(new.qtl, gr) + } # else + + } # for(chr) + + # Get the chromosome lengths. + chrlen = seqlengths(BSgenome.Mmusculus.UCSC.mm10) + names(chrlen) = sub("^chr", "", names(chrlen)) + chrlen = chrlen[seqlevels(new.qtl)] * 1e-6 + + # Add the chr lengths to the chromosomes for plotting. + # Switch positions to genome Mb. + gmb = start(new.qtl) * 1e-6 + for(chr in 2:length(chrlen)) { + + wh = which(seqnames(new.qtl) == names(chrlen)[chr]) + gmb[wh] = gmb[wh] + sum(chrlen[1:(chr - 1)]) + + } # for(chr) + + # Get chromosome mid-points for plotting the Chr name. + chrmid = (chrlen / 2) + cumsum(c(1, chrlen[-length(chrlen)])) + + # Make the plot. + col = rep(rgb(0,0,0), length(new.qtl)) + even.chr = which(seqnames(new.qtl) %in% (1:10 * 2)) + col[even.chr] = rgb(0.7,0.7,0.7) + plot(gmb, -log10(new.qtl$p.value), pch = 20, xaxt = "n", + col = col, las = 1, xlab = "", ylab = "-log10(p-value)", ...) + mtext(side = 1, line = 0.5, at = chrmid, text = names(chrlen), cex = 1.2) + + return(new.qtl) + +} # plot.hs.qtl + + +# Test the fucntion. +setwd("HS") +load("AMQTL.HCC.Rdata") +png("qtl.png", width = 1200, height = 800, res = 128) +qtl.smaller = plot.hs.qtl(qtl, main = "HCC") +dev.off() +qtl.smaller = plot.hs.qtl(qtl, bin.width = 1000, main = "HCC") + +# Look at a Quantile-Quantile plof of the p-values. +pv = unlist(sapply(AM.qtl, function(z) { z$p.value })) +qqnorm(-log10(pv[sample(1:length(pv), 50000)])) +qqline(-log10(pv[sample(1:length(pv), 50000)])) +# This looks weird. Are there other covariates (like batch) that +# should be in your model? Or is the data full of 0 values with +# only a few non-zero values? + + diff --git a/scanone.R b/scanone.R new file mode 100644 index 0000000..ad4b1fd --- /dev/null +++ b/scanone.R @@ -0,0 +1,60 @@ +#SECOND STEP +library(DOQTL) + +setwd("/Users/elijahedmondson/Desktop/R/QTL/WD") +getwd() +list.files("/Users/elijahedmondson/Desktop/R/QTL/WD") + +load(file = "/Users/elijahedmondson/Desktop/R/QTL/HMM/founder.probs.Rdata") +load(file = "/Users/elijahedmondson/Desktop/R/QTL/WD/kinship.probs1837.RData") +load(url("ftp://ftp.jax.org/MUGA/MM_snps.Rdata")) + + +pheno = data.frame(row.names = Sheet.1.Table.1$row.names, sex = as.numeric(Sheet.1.Table.1$Sex == "M"), + osteosarcoma = as.numeric(Sheet.1.Table.1$osteosarcoma)) + +covar = data.frame(sex = as.numeric(Sheet.1.Table.1$Sex == "M")) +rownames(covar) = rownames(pheno) + +pheno = data.frame(row.names = GRSD.phenotype$row.names, sex = as.numeric(GRSD.phenotype$Sex == "M"), + age = as.numeric(GRSD.phenotype$age.in.days), + weight = as.numeric(GRSD.phenotype$weight), + black = GRSD.phenotype$black, + albino = as.numeric(GRSD.phenotype$albino), + lymphoma = as.numeric(GRSD.phenotype$Thymic.Lymphoma), + HCC = as.numeric(GRSD.phenotype$HCC)) + +covar = data.frame(sex = as.numeric(GRSD.phenotype$Sex == "M")) +rownames(covar) = rownames(pheno) + +qtl = scanone(pheno = pheno, pheno.col = "osteosarcoma", probs = model.probs, K = K, + addcovar = covar, snps = MM_snps) + +save(qtl, file = "OSAqtl.Rdata") + +plot(qtl, main = "Osteosarcoma") + +perms = scanone.perm(pheno = pheno, pheno.col = "osteosarcoma", probs = model.probs, addcovar = covar, + snps = MM_snps, path = "/Users/elijahedmondson/Desktop/R/QTL/perms", nperm = 500) + +save(perms, file = "OSAPerms.Rdata") + +thr = quantile(perms, probs = 0.9) +thr2 = quantile(perms, probs = 0.95) +thr3 = quantile(perms, probs = 0.99) + +plot(qtl, sig.thr = c(thr2, thr, thr3), main = "OSA") + +coefplot(qtl, chr = 14) +interval = bayesint(qtl, chr = 14) +interval +ma = assoc.map(pheno = pheno, pheno.col = "black", probs = model.probs, K = K, addcovar = covar, + snps = MM_snps, chr = interval[1,2], start = interval[1,3], end = interval[3,3]) + +tmp = assoc.plot(ma, thr = 11) +unique(tmp$sdps) +mgi = get.mgi.features(chr = interval[1,2], start = interval[1,3], end = interval[3,3], type = "gene", source = "MGI") +nrow(mgi) +head(mgi) + +save(mgi, file = "Age.mgi.Rdata") diff --git a/temp file.R b/temp file.R new file mode 100644 index 0000000..87a886e --- /dev/null +++ b/temp file.R @@ -0,0 +1,66 @@ + + +result[["5"]] = workfxn(data[["5"]]) + +qtlscan = scanone.assoc(pheno = pheno, pheno.col = "Harderian", probs = probs, K = K, + addcovar = addcovar, markers = markers, sdp.file = sdp.file, ncl = 1) +DOQTL:::plot.scanone.assoc(AM.qtl, 14, bin.size = 10) + +perms = scanone.perm(pheno = pheno, pheno.col = "Harderian", probs = probs, addcovar = addcovar, + snps = markers, path = "/Users/elijah/Desktop/R/QTL/WD/", + nperm = 100) +plot(qtlscan, sig.thr = c(thr1, thr2, thr3), main = "") + + +load(file = "/Users/elijah/Desktop/R/QTL/WD/Association\ Mapping\ Files/HZE/AMQTL.OSA.Rdata") + +#Find the max LOD score# + +LOD = -log10(data[[2]]$pv) +LOD + +max.LOD.SNP.ID <- data$ID[which(-log10(data[[4]]$pv) > 4)] +max.LOD.SNP.ID + +max.LOD.position <- result$POS[which(-log10(result[[4]]$pv) > 4)] +max.LOD.position + + +# PLOT ONE CHROMOSOME # +load(file = "/Users/elijah/Desktop/R/QTL/WD/hq_snps/Thymic\ LSA\ HZE_plotting.Rdata") + +data4 <- data[[4]] + +png(paste0("ThyLSA_chr4",".png"), width = 2000, + height = 1600, res = 200) +plot(as.numeric(data4$POS) * 1e-6, -log10(data4$pv), pch = 20) +mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr")) +dev.off() + + + + +mgi = get.mgi.features(chr = 14, start = 68772000, + end = 68774069, type = "gene", source = "MGI") + +png(paste0(file.prefix, "_chr", chr,".png"), width = 2000, + height = 1600, res = 200) +plot(as.numeric(pv[,3]) * 1e-6, -log10(pv[,6]), pch = 20) +mtext(side = 3, line = 0.5, text = paste(plot.title, ": Chr", chr)) + + +# CONVERT TO GRANGES # + +load(file = "~/Desktop/albino.Rdata") +chrs = c(1:19, "X") +qtl = GRangesList(GRanges("list", length(result))) + +for(i in 1:length(chrs)) { + print(i) + qtl[[i]] <- GRanges(seqnames = Rle(result[[i]]$ID), ranges = IRanges(start = result[[i]]$POS, width = 1), p.value = result[[i]]$pv) +} # for(i) + + save(result, file = "~/Desktop/albino.RData") + + +