Last updated: 2018-06-03

workflowr checks: (Click a bullet for more information)
  • R Markdown file: up-to-date

    Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

  • Environment: empty

    Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

  • Seed: set.seed(20180501)

    The command set.seed(20180501) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

  • Session information: recorded

    Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

  • Repository version: 6527008

    Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

    Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
    
    Ignored files:
        Ignored:    .Rhistory
        Ignored:    .Rproj.user/
        Ignored:    log/
    
    Untracked files:
        Untracked:  analysis/binom.Rmd
        Untracked:  analysis/glm.Rmd
        Untracked:  analysis/overdis.Rmd
        Untracked:  analysis/smashtutorial.Rmd
        Untracked:  analysis/test.Rmd
        Untracked:  data/chipexo_examples/
        Untracked:  data/chipseq_examples/
        Untracked:  data/treas_bill.csv
        Untracked:  docs/figure/smashtutorial.Rmd/
        Untracked:  docs/figure/test.Rmd/
    
    Unstaged changes:
        Modified:   analysis/ashpmean.Rmd
        Modified:   analysis/index.Rmd
        Modified:   analysis/missing.Rmd
        Modified:   analysis/nugget.Rmd
    
    
    Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
Expand here to see past versions:
    File Version Author Date Message
    Rmd 6527008 Dongyue 2018-06-03 chip seq data analysis


The lenght of sequence here is 425, which is not a power of 2 hence causing problem when using smashgen. In this real data analysis, we reflect the data both to the left and right so that it has length of 1024 then apply smashgen to the augmented data.

Setup

library(smashrgen)
library(dashr)

extract_counts_CTCF <- function(filename){
  bed_counts <- read.table(filename, header = F, stringsAsFactors = F)
  colnames(bed_counts) <- c("chr", "start", "end", "name", "width", "counts")

  counts <- strsplit(bed_counts$counts, split = ",")[[1]]
  counts[counts == "NA"] <- 0
  counts <- as.numeric(counts)

  return(counts.l = list(chr = bed_counts$chr, start = bed_counts$start, end = bed_counts$end, counts = counts))
}

CTCF raw - Rep 1

Forward

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_raw_rep1_Forward_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Reverse

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_raw_rep1_Reverse_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

CTCF raw - Rep 2

Forward

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_raw_rep2_Forward_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Reverse

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_raw_rep2_Reverse_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

CTCF raw - Rep 3

Forward

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_raw_rep3_Forward_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Reverse

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_raw_rep3_Reverse_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

CTCF - Rep 1

Forward

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_rep1_Forward_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Reverse

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_rep1_Reverse_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

CTCF - Rep 2

Forward

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_rep2_Forward_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Reverse

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_rep2_Reverse_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

CTCF - Rep 3

Forward

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_rep3_Forward_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Reverse

chipexo1 <- extract_counts_CTCF("D:/smashgen/data/chipseq_examples/example_CTCF_rep3_Reverse_counts.txt")

dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.out=smash_gen_lite(y)

plot(chipexo1$counts, col = "gray80", type = "h", ylab = "forward strand", xlab = "", main = "CTCF raw rep 1")
lines(smash.out, col = "blue", lwd = 1)
lines(dash.out$estimate, col = "red", lwd = 2)
lines(smashgen.out[301:725],col=3,lwd=3)

legend("topright", # places a legend at the appropriate place
       c("truth","dash-m", "smash-poiss",'smash-gen'), # puts text in the legend
       lty=c(1,1,1,1), # gives the legend appropriate symbols (lines)
       lwd=c(1,2,1,3),
       cex = 0.5,
       col=c("gray80","red", "blue",3))

Session information

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] dashr_0.99.0     inline_0.3.14    Rcpp_0.12.16     smashrgen_0.1.0 
[5] wavethresh_4.6.8 MASS_7.3-47      caTools_1.17.1   ashr_2.2-7      
[9] smashr_1.1-5    

loaded via a namespace (and not attached):
 [1] compiler_3.4.0       git2r_0.21.0         workflowr_1.0.1     
 [4] R.methodsS3_1.7.1    R.utils_2.6.0        bitops_1.0-6        
 [7] iterators_1.0.8      tools_3.4.0          digest_0.6.13       
[10] evaluate_0.10        lattice_0.20-35      Matrix_1.2-9        
[13] foreach_1.4.3        yaml_2.1.19          parallel_3.4.0      
[16] LaplacesDemon_16.1.0 stringr_1.3.0        knitr_1.20          
[19] REBayes_1.3          rprojroot_1.3-2      grid_3.4.0          
[22] data.table_1.10.4-3  rmarkdown_1.8        magrittr_1.5        
[25] whisker_0.3-2        backports_1.0.5      codetools_0.2-15    
[28] htmltools_0.3.5      assertthat_0.2.0     stringi_1.1.6       
[31] Rmosek_8.0.69        doParallel_1.0.11    pscl_1.4.9          
[34] truncnorm_1.0-7      SQUAREM_2017.10-1    R.oo_1.21.0         

This reproducible R Markdown analysis was created with workflowr 1.0.1