Last updated: 2016-02-08

Code version: 2d21f84b7c7774f967ba92e9fbd3bf517d53e0dd

Objectives

This file takes Brian’s muscle skeletal (correlation threshold = 0.80) GTex summary files and performs a Gibbs sampler to estimate the posterior probability each gene in the network is UNAFFECTED by the genotype at the SNP. The results are store in ‘../output’, with the same directory structure as the summary data. The only input parameter is the input directory name with summary data and the output directory, which stores the Gibbs sampler posterior probability estimates. After the code finishes, a Perl script will modify the Gibbs sampler output so they have the same information as the summary data files.

Grab functions

Source Gibbs Sampler and Bayes Factor functions.

source("../R/SimulateNetworkExpression.R")  #Compute Bayes factors
source("../R/directionality_CGM.R")    #Gibbs Sampler

The directories to grab and store output files

Directory in which to perform the analysis. Note that this is the muscle skeletal. Results are saved in output, with the same directory structure as the summary data were stored in data

directory.in <- '../data/cis_summary_data/muscleskeletal/thresh_80'
directory.out <- '../output/cis_summary_data/muscleskeletal/thresh_80'
run_gibbs = FALSE;   #Whether or not to run the Gibbs sampler. If not, I just look for the file in 'directory.out' to get the necessary information 

Create directory structure to house output files

if (!file.exists(directory.out)) {
  dir.string <- strsplit(directory.out, split="/")[[1]]
  tmp.string = dir.string[1]
  for (i in 2:length(dir.string)) {
    tmp.string = file.path(tmp.string, dir.string[i])
    if (!file.exists(tmp.string)) {
      dir.create(tmp.string)
    }
  }
}

Run the analysis on all of the files in the directory

all_files <- list.files(directory.in)
N.genes <- rep(0, length(all_files))    #Number of genes in each network
PUP.source <- rep(0, length(all_files))  #Posterior probability the gene cis to the eQTL is unaffected
all.post.probs <- c()   #To be used to generate a ROC plot

count = 1
for (file in all_files) {
  file.path <- paste(directory.in, file, sep="/")
  all_data = readLines(file.path)
  tissue <- strsplit(all_data[1], split='\t', perl=T)[[1]][2]
    n.ind <- as.numeric(strsplit(all_data[2], split='\t', perl=T)[[1]][2])   #Number of independent measurements
    chr <- as.numeric(strsplit(all_data[3], split='\t', perl=T)[[1]][2])    #Chromosome number
    gene <- strsplit(all_data[4], split='\t', perl=T)[[1]][2]    #Gene of interest
    SNP <- strsplit(all_data[5], split='\t', perl=T)[[1]][2]    #eQTL of interest
    Gene.names <- strsplit(all_data[6], split='\t', perl=T)[[1]][2:length(strsplit(all_data[6], split='\t', perl=T)[[1]])]   #Column names for Y'Y
    n.genes <- length(Gene.names)    #Number of genes in the network
  N.genes[count] = n.genes
    
    YtY <- array(NA, dim=c(n.genes, n.genes))   #Y'Y
    for (r in 1:n.genes) {
      YtY[r,] <- as.numeric(strsplit(all_data[7+r], split='\t', perl=T)[[1]])
    }
    
    sxx <- as.numeric(strsplit(all_data[8+n.genes], split='\t', perl=T)[[1]][2])   #X'X, a scalar
    YtX <- as.numeric(strsplit(all_data[10+n.genes], split='\t', perl=T)[[1]])    #Y'X, a vector
    
    suff.stat <- list(SYY = YtY/n.ind, sxx = sxx/n.ind, SYX = YtX/n.ind, SY1 = rep(0, n.genes), mu.g = 0)
    
    if (n.genes <= 15) {
      n.iter <- 3000
      n.burn <- 1000
    } else {
      if (n.genes <= 25) {
        n.iter <- 4000
        n.burn <- 2000
      } else {
        n.iter <- 5000
        n.burn <- 2500
      }
    }
    sigma.a <- c(0.1, 0.4)
    weights.sigma <- c(1, 1)
    
  out.file = file.path(directory.out, sub("(summary)", '\\1.gibbs', file, perl=T))
  if (run_gibbs) {
    gibbs <- Gibbs.dir(n.iter, n.burn, suff.stat, which(Gene.names == gene), n.ind, sigma.a, weights.sigma, n.genes-1)
    PUP.source[count] = gibbs$post.mean[gibbs$D.ind]
  
    gibbs.mat <- rbind(gibbs$post.mean)
    colnames(gibbs.mat) <- Gene.names
    write.table(gibbs.mat, out.file, col.names=T, row.names=F, append=F, quote=F, sep="\t")
    all.post.probs <- c(all.post.probs, gibbs$post.mean[-gibbs$D.ind])
  } else {
    gibbs.file = readLines(out.file)
    tmp.probs <- as.numeric(strsplit(gibbs.file[8], split='\t', perl=T)[[1]])
    PUP.source[count] = tmp.probs[which(Gene.names == gene)]
    all.post.probs <- c(all.post.probs, tmp.probs[-which(Gene.names == gene)])
  }
  
  #print(paste0(as.character(count), " of ", as.character(length(all_files))))
  count = count + 1
}
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000055955.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000077522.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000083845.4_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000084754.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000086061.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000086967.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000099290.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000101470.5_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000105048.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000105193.4_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000105372.2_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000108107.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000108821.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000111640.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000112306.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000114391.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000115268.5_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000118181.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000120694.15_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000122304.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000122367.15_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000122852.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000124614.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000125148.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000125691.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000127184.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000129744.2_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000129749.3_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000130255.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000130595.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000130598.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000131469.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000134419.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000136942.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000137154.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000137959.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000137965.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000138029.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000138326.14_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000140416.15_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000142534.2_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000142615.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000142789.15_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000142937.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000143318.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000143536.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000143631.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000144713.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000148303.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000149806.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000151632.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000151726.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000152234.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000157326.14_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000159189.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000161016.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000161970.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000162438.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000163209.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000163631.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000164776.5_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000165895.13_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000166441.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000167526.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000169347.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000170889.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000171858.13_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000171863.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000172809.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000173369.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000173372.12_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000173432.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000175206.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000175535.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000176681.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000178372.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000180209.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000181092.5_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000182853.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000185303.11_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000185686.13_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000186468.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000187193.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000187288.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000187630.10_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000188508.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000188536.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000196139.7_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000196565.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000197756.5_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000197958.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000198467.9_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000198755.6_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000204983.8_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000206172.4_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000211893.3_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000211896.2_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000213462.4_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000213931.1_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000213934.5_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000219073.3_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000221983.3_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000224389.4_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000231500.2_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000231852.2_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000238083.3_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000241794.1_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000243696.4_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000244116.1_summary.txt'
Warning in readLines(file.path): incomplete final line found on '../data/
cis_summary_data/muscleskeletal/thresh_80/ENSG00000244731.3_summary.txt'

Plot the posterior probability a gene is affected by SNP as a function of the network size:

plot(N.genes, 1-PUP.source, main='Posterior Probability of Source Gene as a Function of Network Size', xlab='Number of Genes in Network', ylab='Posterior Probability Source Gene is Affected by SNP')

jpeg('AnalyzeSummaryData_muscleskeletal80_NetworkSize.jpeg', width = 550)
plot(N.genes, 1-PUP.source, main='Posterior Probability of Source Gene as a Function of Network Size', xlab='Number of Genes in Network', ylab='Posterior Probability Source Gene is Affected by SNP')
dev.off()
quartz_off_screen 
                2 

Plot an estimated ROC curve:

all.post.probs <- sort(all.post.probs)   #Posterior prob a gene is NOT a trans eQTL
est.trans <- sum(1-all.post.probs)   #Expected number of trans genes affected (given the data)

est.FDR <- rep(0, length(all.post.probs))
est.FDR[1] <- all.post.probs[1]
est.sens <- rep(0, length(all.post.probs))
est.sens[1] <- (1 - all.post.probs[1])/est.trans
for (i in 2:length(est.FDR)) {
  est.FDR[i] <- ((i-1)*est.FDR[i-1] + all.post.probs[i])/i
  est.sens[i] <- est.sens[i-1] + (1 - all.post.probs[i])/est.trans
}
plot(est.FDR, est.sens, type="l", main='Estimated ROC Curve for Affected Genes Trans to SNP in Muscle Skeletal', xlab="Estimated (conditional) False Discovery Rate", ylab='Estimated Sensitivity', xlim=c(0, max(0.6, est.FDR)))
lines(seq(max(est.FDR), 1, length=100), rep(1, 100))

jpeg('AnalyzeSummaryData_muscleskeletal80_ROC.jpeg', width = 550)
plot(est.FDR, est.sens, type="l", main='Estimated ROC Curve for Affected Genes Trans to SNP in Muscle Skeletal', xlab="Estimated (conditional) False Discovery Rate", ylab='Estimated Sensitivity', xlim=c(0, max(0.6, est.FDR)))
lines(seq(max(est.FDR), 1, length=100), rep(1, 100))
dev.off()
quartz_off_screen 
                2 

Histgram of posterior probabilities that a gene trans to SNP is affected by SNP

hist(1-all.post.probs, breaks=30, xlab="Posterior Probability Gene Trans to SNP is AFFECTED by SNP", ylab="Frequency", main="Histogram of Posterior Probabilities a Trans Gene is AFFECTED by SNP", xlim=c(0,1))

jpeg('AnalyzeSummaryData_muscleskeletal80_Hist.jpeg', width = 550)
hist(1-all.post.probs, breaks=30, xlab="Posterior Probability Gene Trans to SNP is AFFECTED by SNP", ylab="Frequency", main="Histogram of Posterior Probabilities a Trans Gene is AFFECTED by SNP", xlim=c(0,1))
dev.off()
quartz_off_screen 
                2 

Add additional information to output files

If the information already exists, OrganizeGibbs.pl leaves the file alone

perl OrganizeGibbs.pl ../data/cis_summary_data/muscleskeletal/thresh_80 ../output/cis_summary_data/muscleskeletal/thresh_80

Session information

sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] knitr_1.11

loaded via a namespace (and not attached):
 [1] digest_0.6.8  evaluate_0.8  formatR_1.2.1 htmltools_0.3 magrittr_1.5 
 [6] rmarkdown_0.7 stringi_1.0-1 stringr_1.0.0 tools_3.1.3   yaml_2.1.13