<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />


<meta name="author" content="Briana Mittleman" />


<title>cov.200bp.wind</title>

<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/journal.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-4.5.0/css/font-awesome.min.css" rel="stylesheet" />

<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
  pre:not([class]) {
    background-color: white;
  }
</style>
<script type="text/javascript">
if (window.hljs) {
  hljs.configure({languages: []});
  hljs.initHighlightingOnLoad();
  if (document.readyState && document.readyState === "complete") {
    window.setTimeout(function() { hljs.initHighlighting(); }, 0);
  }
}
</script>



<style type="text/css">
h1 {
  font-size: 34px;
}
h1.title {
  font-size: 38px;
}
h2 {
  font-size: 30px;
}
h3 {
  font-size: 24px;
}
h4 {
  font-size: 18px;
}
h5 {
  font-size: 16px;
}
h6 {
  font-size: 12px;
}
.table th:not([align]) {
  text-align: left;
}
</style>


</head>

<body>

<style type = "text/css">
.main-container {
  max-width: 940px;
  margin-left: auto;
  margin-right: auto;
}
code {
  color: inherit;
  background-color: rgba(0, 0, 0, 0.04);
}
img {
  max-width:100%;
  height: auto;
}
.tabbed-pane {
  padding-top: 12px;
}
button.code-folding-btn:focus {
  outline: none;
}
</style>


<style type="text/css">
/* padding for bootstrap navbar */
body {
  padding-top: 51px;
  padding-bottom: 40px;
}
/* offset scroll position for anchor links (for fixed navbar)  */
.section h1 {
  padding-top: 56px;
  margin-top: -56px;
}

.section h2 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h3 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h4 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h5 {
  padding-top: 56px;
  margin-top: -56px;
}
.section h6 {
  padding-top: 56px;
  margin-top: -56px;
}
</style>

<script>
// manage active state of menu based on current page
$(document).ready(function () {
  // active menu anchor
  href = window.location.pathname
  href = href.substr(href.lastIndexOf('/') + 1)
  if (href === "")
    href = "index.html";
  var menuAnchor = $('a[href="' + href + '"]');

  // mark it active
  menuAnchor.parent().addClass('active');

  // if it's got a parent navbar menu mark it active as well
  menuAnchor.closest('li.dropdown').addClass('active');
});
</script>


<div class="container-fluid main-container">

<!-- tabsets -->
<script>
$(document).ready(function () {
  window.buildTabsets("TOC");
});
</script>

<!-- code folding -->




<script>
$(document).ready(function ()  {

    // move toc-ignore selectors from section div to header
    $('div.section.toc-ignore')
        .removeClass('toc-ignore')
        .children('h1,h2,h3,h4,h5').addClass('toc-ignore');

    // establish options
    var options = {
      selectors: "h1,h2,h3",
      theme: "bootstrap3",
      context: '.toc-content',
      hashGenerator: function (text) {
        return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_').toLowerCase();
      },
      ignoreSelector: ".toc-ignore",
      scrollTo: 0
    };
    options.showAndHide = true;
    options.smoothScroll = true;

    // tocify
    var toc = $("#TOC").tocify(options).data("toc-tocify");
});
</script>

<style type="text/css">

#TOC {
  margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
  position: relative;
  width: 100%;
}
}


.toc-content {
  padding-left: 30px;
  padding-right: 40px;
}

div.main-container {
  max-width: 1200px;
}

div.tocify {
  width: 20%;
  max-width: 260px;
  max-height: 85%;
}

@media (min-width: 768px) and (max-width: 991px) {
  div.tocify {
    width: 25%;
  }
}

@media (max-width: 767px) {
  div.tocify {
    width: 100%;
    max-width: none;
  }
}

.tocify ul, .tocify li {
  line-height: 20px;
}

.tocify-subheader .tocify-item {
  font-size: 0.90em;
  padding-left: 25px;
  text-indent: 0;
}

.tocify .list-group-item {
  border-radius: 0px;
}


</style>

<!-- setup 3col/9col grid for toc_float and main content  -->
<div class="row-fluid">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>

<div class="toc-content col-xs-12 col-sm-8 col-md-9">




<div class="navbar navbar-default  navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.html">Three Prime Sequencing in Human LCLs</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li>
  <a href="index.html">Home</a>
</li>
<li>
  <a href="about.html">About</a>
</li>
<li>
  <a href="license.html">License</a>
</li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
  <a href="https://github.com/brimittleman/threeprimeseq">
    <span class="fa fa-github"></span>
     
  </a>
</li>
      </ul>
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

<!-- Add a small amount of space between sections. -->
<style type="text/css">
div.section {
  padding-top: 12px;
}
</style>

<div class="fluid-row" id="header">



<h1 class="title toc-ignore">cov.200bp.wind</h1>
<h4 class="author"><em>Briana Mittleman</em></h4>
<h4 class="date"><em>5/29/2018</em></h4>

</div>


<p><strong>Last updated:</strong> 2018-06-05</p>
<strong>workflowr checks:</strong> <small>(Click a bullet for more information)</small>
<ul>
<li>
<p><details> <summary> <strong style="color:blue;">✔</strong> <strong>R Markdown file:</strong> up-to-date </summary></p>
<p>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.</p>
</details>
</li>
<li>
<p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Environment:</strong> empty </summary></p>
<p>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.</p>
</details>
</li>
<li>
<p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Seed:</strong> <code>set.seed(12345)</code> </summary></p>
<p>The command <code>set.seed(12345)</code> 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.</p>
</details>
</li>
<li>
<p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Session information:</strong> recorded </summary></p>
<p>Great job! Recording the operating system, R version, and package versions is critical for reproducibility.</p>
</details>
</li>
<li>
<p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Repository version:</strong> <a href="https://github.com/brimittleman/threeprimeseq/tree/5ad72d55fe1725af9c29741fc1162164514b7674" target="_blank">5ad72d5</a> </summary></p>
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. <br><br> 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 <code>wflow_publish</code> or <code>wflow_git_commit</code>). 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:
<pre><code>
Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  data/gene_cov/
    Untracked:  data/leafcutter/
    Untracked:  data/reads_mapped_three_prime_seq.csv
    Untracked:  data/ssFC200.cov.bed
    Untracked:  output/plots/

Unstaged changes:
    Modified:   code/Snakefile

</code></pre>
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. </details>
</li>
</ul>
<details> <summary> <small><strong>Expand here to see past versions:</strong></small> </summary>
<ul>
<table style="border-collapse:separate; border-spacing:5px;">
<thead>
<tr>
<th style="text-align:left;">
File
</th>
<th style="text-align:left;">
Version
</th>
<th style="text-align:left;">
Author
</th>
<th style="text-align:left;">
Date
</th>
<th style="text-align:left;">
Message
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/5ad72d55fe1725af9c29741fc1162164514b7674/analysis/cov200bpwind.Rmd" target="_blank">5ad72d5</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-05
</td>
<td style="text-align:left;">
fix leaf cutter file
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/32223cadca73307df3564b9535e29faad9d1cc73/docs/cov200bpwind.html" target="_blank">32223ca</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-05
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/f3199e2264c0762775bc0b22120dd6f0506fa918/analysis/cov200bpwind.Rmd" target="_blank">f3199e2</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-05
</td>
<td style="text-align:left;">
prepare leaf cutter table
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/4a45d81a3a87bb33a5461c186ca4d8007ba2fb43/docs/cov200bpwind.html" target="_blank">4a45d81</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/0619d81e1deec84f0cb98af691caf076f936925d/analysis/cov200bpwind.Rmd" target="_blank">0619d81</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
<td style="text-align:left;">
nonzero bins analysis
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/7ea0888a9fb5edb268ff7448bc545742d531b18e/docs/cov200bpwind.html" target="_blank">7ea0888</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/1728093aa6691b5a630a812a40b067c52cfcf243/analysis/cov200bpwind.Rmd" target="_blank">1728093</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
<td style="text-align:left;">
cov at 200bp windows by sample and frac
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/8a6915642a6505d3c2cca2287d88ff0985b74026/docs/cov200bpwind.html" target="_blank">8a69156</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-31
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/827c3d1dd7e16da05e95c0180845fb1fff284dad/analysis/cov200bpwind.Rmd" target="_blank">827c3d1</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-31
</td>
<td style="text-align:left;">
create pos and neg window file and do cov analysis
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/5de4753b6a4f37b93fd4f46f70492e60779f6649/docs/cov200bpwind.html" target="_blank">5de4753</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-30
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/87e5145783e438edc43e8a0131dfb80d009c6017/analysis/cov200bpwind.Rmd" target="_blank">87e5145</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-30
</td>
<td style="text-align:left;">
strand spec
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/ecfd1d1b8ebd4579bc52d6d604d3c86fdb0a356b/docs/cov200bpwind.html" target="_blank">ecfd1d1</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-30
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/3a00526d876b05d3044f2f3eadb4d6171ea720ca/analysis/cov200bpwind.Rmd" target="_blank">3a00526</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-30
</td>
<td style="text-align:left;">
fix feature count code for 200 bp analysis
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/710cf6a06e3904e99384341936f5c8b4a2a67428/docs/cov200bpwind.html" target="_blank">710cf6a</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-29
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
Rmd
</td>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/d58bc138fd71227816b58cffda2ccf2df7199808/analysis/cov200bpwind.Rmd" target="_blank">d58bc13</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-05-29
</td>
<td style="text-align:left;">
start 200 bp analysis
</td>
</tr>
</tbody>
</table>
</ul>
<p></details></p>
<hr />
<p>I will use this analysis to bin the genome into 200bp windows and look at coverage for the 3’ seq libraries for each of these windows. I will use this data then in the leafcutter pipeline to look at differences between data from the total and nuclear fractions.</p>
<p>I performed a similar analysis for the net-seq data so some of the code will come from that. <a href="https://brimittleman.github.io/Net-seq/create_blacklist.html" class="uri">https://brimittleman.github.io/Net-seq/create_blacklist.html</a></p>
<div id="map-reads-to-bins" class="section level2">
<h2>Map reads to bins</h2>
<p>The binned genome file is called: genome_200_wind_fix2.saf, it is in my genome annotation directory.</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=cov200
#SBATCH --time=8:00:00
#SBATCH --output=cov200.out
#SBATCH --error=cov200.err
#SBATCH --partition=broadwl
#SBATCH --mem=20G
#SBATCH --mail-type=END

module load Anaconda3  

source activate three-prime-env

#input is a bam 
sample=$1


describer=$(echo ${sample} | sed -e &#39;s/.*\YL-SP-//&#39; | sed -e &quot;s/-sort.bam$//&quot;)



featureCounts -T 5 -a /project2/gilad/briana/genome_anotation_data/an.int.genome_200_strandspec.saf -F &#39;SAF&#39; -o /project2/gilad/briana/threeprimeseq/data/cov_200/${describer}_FC200.cov.bed $1</code></pre>
<p>I will need to create a wrapper to run this for all of the files.</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=w_cov200
#SBATCH --time=8:00:00
#SBATCH --output=w_cov200.out
#SBATCH --error=w_cov200.err
#SBATCH --partition=broadwl
#SBATCH --mem=8G
#SBATCH --mail-type=END


for i in $(ls /project2/gilad/briana/threeprimeseq/data/sort/*.bam); do
            sbatch cov200.sh $i 
        done</code></pre>
<p>Current analysis is not stand specific. I need to make windows for the negative strand. To do this I need to copy the genome_200_wind_fix2.saf file but with geneIDs starting with the last number of the file and with a - for the strand. The last window number is 15685849. I will have to start from 15685850.</p>
<p>In general I will use awk to create the file. The last number is 31371698 because that is 2 * the number of bins in the genome. I w</p>
<pre class="bash"><code>#i will delete the top line at the end
seq 15685849 31371698 &gt; neg.bin.num.txt

 cut -f1 neg.bin.num.txt | paste - genome_200_wind_fix2.saf | awk  &#39;{ if (NR&gt;1) print $1 &quot;\t&quot; $3 &quot;\t&quot; $4 &quot;\t&quot; $5 &quot;\t&quot; &quot;-&quot;}&#39; &gt;  genome_200_wind_fix2.negstrand.saf 

#cat files together  

cat genome_200_wind_fix2.saf  genome_200_wind_fix2.negstrand.saf  &gt; genome_200_strandsspec_wind.saf
 </code></pre>
<p>I can use this to get coverage in all of the windows with strand specificity. I will call this script ss_cov200.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=sscov200
#SBATCH --time=8:00:00
#SBATCH --output=sscov200.out
#SBATCH --error=sscov200.err
#SBATCH --partition=broadwl
#SBATCH --mem=20G
#SBATCH --mail-type=END

module load Anaconda3  

source activate three-prime-env

#input is a bam 
sample=$1


describer=$(echo ${sample} | sed -e &#39;s/.*\YL-SP-//&#39; | sed -e &quot;s/-sort.bam$//&quot;)



featureCounts -T 5 -s 1 -O --fraction -a /project2/gilad/briana/genome_anotation_data/genome_200_strandsspec_wind.saf -F &#39;SAF&#39; -o /project2/gilad/briana/threeprimeseq/data/ss_cov200/${describer}_ssFC200.cov.bed $1</code></pre>
<p>Try this with. /project2/gilad/briana/threeprimeseq/data/sort/YL-SP-18486-N_S10_R1_001-sort.bam</p>
<p>I will update my wrapper to use this script.</p>
<p>The current script does not allow reads that map to multiple bins. We expect then so I will update the featureCounts code to account for this.</p>
<p>-O allows multi mapping -fraction will put a fraction of the read in each bin</p>
<p>The next step is to add genes annotations to each bin. I will do this with bedtools closest on my window file.</p>
<p>gene file: /project2/gilad/briana/genome_anotation_data/gencode.v19.annotation.proteincodinggene.sort.bed</p>
<p>I want to keep the windows with gene and add the name of the gene they are in.</p>
<p>a= windows b= genes</p>
<p>force stranded= -s</p>
<p>I need to make the window file a sorted bed file. It should be the chr number without the ‘chr’ tag, start, end, bin number, “.”, strand.</p>
<pre class="bash"><code>awk &#39;{if (NR&gt;1) print $2 &quot;\t&quot; $3 &quot;\t&quot; $4 &quot;\t&quot; $1 &quot;\t&quot; &quot;.&quot; &quot;\t&quot; $5}&#39; genome_200_strandsspec_wind.saf  | sed &#39;s/^chr//&#39; | sort -k1,1 -k2,2n &gt; genome_200_strandspec.bed
</code></pre>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=annotate_wind
#SBATCH --time=8:00:00
#SBATCH --output=an_wind.out
#SBATCH --error=an_wind.err
#SBATCH --partition=broadwl
#SBATCH --mem=30G
#SBATCH --mail-type=END

module load Anaconda3

source activate three-prime-env


bedtools closest -s -a genome_200_strandspec.bed -b gencode.v19.annotation.proteincodinggene.sort.bed &gt; annotated.genome_200_strandspec.bed</code></pre>
<p>Now i can use intersect to only keep the windows that interdect that protien coding genes.</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=int_wind
#SBATCH --time=8:00:00
#SBATCH --output=int_wind.out
#SBATCH --error=int_wind.err
#SBATCH --partition=broadwl
#SBATCH --mem=30G
#SBATCH --mail-type=END

module load Anaconda3

source activate three-prime-env


bedtools intersect -wa -sorted -s -a annotated.genome_200_strandspec.bed -b gencode.v19.annotation.proteincodinggene.sort.bed &gt; annotated.int.genome_200_strandspec.bed</code></pre>
<pre class="bash"><code>awk &#39;{print $1 &quot;\t&quot; $2 &quot;\t&quot; $3 &quot;\t&quot; $4 &quot;\t&quot; $5 &quot;\t&quot; $6 &quot;\t&quot; $10}&#39;  annotated.int.genome_200_strandspec.bed &gt;  an.int.genome_200_strandspec.bed</code></pre>
<p>I went from 31590487 to 7371747 windows. I need to make this into a saf file and the name of the window will be the number.gene</p>
<pre class="bash"><code>awk &#39;{print $4&quot;.&quot;$7 &quot;\t&quot; $1 &quot;\t&quot; $2 &quot;\t&quot; $3 &quot;\t&quot; $6}&#39;  an.int.genome_200_strandspec.bed &gt; an.int.genome_200_strandspec.saf

#go into the file with vi and add header</code></pre>
<p>Now I can change my feature counts script to use this file instead.</p>
<p>I need to get rid of the lines with 2 genes overlapping in the bin. I will do this by removing the lines with a :.</p>
<pre class="bash"><code>
for i in $(ls *.bed); do
      cat $i | grep -v -e &quot;;&quot; &gt; ../ss_cov200_no_overlap/$i
  done
</code></pre>
<p>The next step is to bind all of these files. This file will have all 6323877 windows as the rows and columns for each of the 32 files</p>
<pre class="bash"><code>
less 18486-N_S10_R1_001_ssFC200.cov.bed  | cut -f1-6 &gt; tmp 
for i in ./*cov.bed; do
echo &quot;$i&quot;
less ${i} | cut -f7 &gt;col
paste tmp col&gt; tmp2; mv tmp2 tmp; rm col; done

mv tmp ssFC200.cov.bed</code></pre>
<p>This in now ready to move to R an work with it here.</p>
</div>
<div id="assess-bin-coverage" class="section level2">
<h2>Assess bin coverage</h2>
<pre class="r"><code>library(workflowr)</code></pre>
<pre><code>Loading required package: rmarkdown</code></pre>
<pre><code>This is workflowr version 1.0.1
Run ?workflowr for help getting started</code></pre>
<pre class="r"><code>library(ggplot2)
library(dplyr)</code></pre>
<pre><code>
Attaching package: &#39;dplyr&#39;</code></pre>
<pre><code>The following objects are masked from &#39;package:stats&#39;:

    filter, lag</code></pre>
<pre><code>The following objects are masked from &#39;package:base&#39;:

    intersect, setdiff, setequal, union</code></pre>
<pre class="r"><code>library(tidyr)
library(edgeR)</code></pre>
<pre><code>Warning: package &#39;edgeR&#39; was built under R version 3.4.3</code></pre>
<pre><code>Loading required package: limma</code></pre>
<pre><code>Warning: package &#39;limma&#39; was built under R version 3.4.3</code></pre>
<pre class="r"><code>library(reshape2)</code></pre>
<pre><code>Warning: package &#39;reshape2&#39; was built under R version 3.4.3</code></pre>
<pre><code>
Attaching package: &#39;reshape2&#39;</code></pre>
<pre><code>The following object is masked from &#39;package:tidyr&#39;:

    smiths</code></pre>
<pre class="r"><code>names=c(&quot;N_18486&quot;,&quot;T_18486&quot;,&quot;N_18497&quot;,&quot;T_18497&quot;,&quot;N_18500&quot;,&quot;T_18500&quot;,&quot;N_18505&quot;,&#39;T_18505&#39;,&quot;N_18508&quot;,&quot;T_18508&quot;,&quot;N_18853&quot;,&quot;T_18853&quot;,&quot;N_18870&quot;,&quot;T_18870&quot;,&quot;N_19128&quot;,&quot;T_19128&quot;,&quot;N_19141&quot;,&quot;T_19141&quot;,&quot;N_19193&quot;,&quot;T_19193&quot;,&quot;N_19209&quot;,&quot;T_19209&quot;,&quot;N_19223&quot;,&quot;N_19225&quot;,&quot;T_19225&quot;,&quot;T_19223&quot;,&quot;N_19238&quot;,&quot;T_19238&quot;,&quot;N_19239&quot;,&quot;T_19239&quot;,&quot;N_19257&quot;,&quot;T_19257&quot;)</code></pre>
<pre class="r"><code>cov_all=read.table(&quot;../data/ssFC200.cov.bed&quot;, header = T, stringsAsFactors = FALSE)
#remember name switch!
names=c(&quot;Geneid&quot;,&quot;Chr&quot;, &quot;Start&quot;, &quot;End&quot;, &quot;Strand&quot;, &quot;Length&quot;, &quot;N_18486&quot;,&quot;T_18486&quot;,&quot;N_18497&quot;,&quot;T_18497&quot;,&quot;N_18500&quot;,&quot;T_18500&quot;,&quot;N_18505&quot;,&#39;T_18505&#39;,&quot;N_18508&quot;,&quot;T_18508&quot;,&quot;N_18853&quot;,&quot;T_18853&quot;,&quot;N_18870&quot;,&quot;T_18870&quot;,&quot;N_19128&quot;,&quot;T_19128&quot;,&quot;N_19141&quot;,&quot;T_19141&quot;,&quot;N_19193&quot;,&quot;T_19193&quot;,&quot;N_19209&quot;,&quot;T_19209&quot;,&quot;N_19223&quot;,&quot;N_19225&quot;,&quot;T_19225&quot;,&quot;T_19223&quot;,&quot;N_19238&quot;,&quot;T_19238&quot;,&quot;N_19239&quot;,&quot;T_19239&quot;,&quot;N_19257&quot;,&quot;T_19257&quot;)

colnames(cov_all)= names</code></pre>
<p>Plot the density of the log of the counts.</p>
<pre class="r"><code>cov_nums_only=cov_all[,7:38]
cov_nums_only_log=log10(cov_nums_only)
plotDensities(cov_nums_only_log,legend = &quot;bottomright&quot;, main=&quot;bin log 10 counts&quot;)</code></pre>
<p><img src="figure/cov200bpwind.Rmd/unnamed-chunk-15-1.png" width="672" style="display: block; margin: auto;" /></p>
<details> <summary><em>Expand here to see past versions of unnamed-chunk-15-1.png:</em></summary>
<table style="border-collapse:separate; border-spacing:5px;">
<thead>
<tr>
<th style="text-align:left;">
Version
</th>
<th style="text-align:left;">
Author
</th>
<th style="text-align:left;">
Date
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/7ea0888a9fb5edb268ff7448bc545742d531b18e/docs/figure/cov200bpwind.Rmd/unnamed-chunk-15-1.png" target="_blank">7ea0888</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
</tr>
</tbody>
</table>
<p></details></p>
<p>Now I want to filter for bins that have 0 reads in &gt;16 samples.</p>
<pre class="r"><code>keep.exprs=rowSums(cov_nums_only&gt;0) &gt;= 16

cov_all_filt=cov_all[keep.exprs,]
bin.genes=cov_all_filt[,1]</code></pre>
<p>I will now look at the densities.</p>
<pre class="r"><code>cov_all_filt_log=log10(cov_all_filt[,7:38] + 1) 

plotDensities(cov_all_filt_log,legend = &quot;bottomright&quot;, main=&quot;Filtered bin log10 +1 counts&quot;)</code></pre>
<p><img src="figure/cov200bpwind.Rmd/unnamed-chunk-17-1.png" width="672" style="display: block; margin: auto;" /></p>
<details> <summary><em>Expand here to see past versions of unnamed-chunk-17-1.png:</em></summary>
<table style="border-collapse:separate; border-spacing:5px;">
<thead>
<tr>
<th style="text-align:left;">
Version
</th>
<th style="text-align:left;">
Author
</th>
<th style="text-align:left;">
Date
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/7ea0888a9fb5edb268ff7448bc545742d531b18e/docs/figure/cov200bpwind.Rmd/unnamed-chunk-17-1.png" target="_blank">7ea0888</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
</tr>
</tbody>
</table>
<p></details></p>
<p>I want to make boxplots for each of these lines. I should tidy the data with a column for total or nuclear.</p>
<pre class="r"><code>sample=c(&quot;N_18486&quot;,&quot;T_18486&quot;,&quot;N_18497&quot;,&quot;T_18497&quot;,&quot;N_18500&quot;,&quot;T_18500&quot;,&quot;N_18505&quot;,&#39;T_18505&#39;,&quot;N_18508&quot;,&quot;T_18508&quot;,&quot;N_18853&quot;,&quot;T_18853&quot;,&quot;N_18870&quot;,&quot;T_18870&quot;,&quot;N_19128&quot;,&quot;T_19128&quot;,&quot;N_19141&quot;,&quot;T_19141&quot;,&quot;N_19193&quot;,&quot;T_19193&quot;,&quot;N_19209&quot;,&quot;T_19209&quot;,&quot;N_19223&quot;,&quot;N_19225&quot;,&quot;T_19225&quot;,&quot;T_19223&quot;,&quot;N_19238&quot;,&quot;T_19238&quot;,&quot;N_19239&quot;,&quot;T_19239&quot;,&quot;N_19257&quot;,&quot;T_19257&quot;)
fraction=c(&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&#39;T&#39;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;N&quot;,&quot;T&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;,&quot;N&quot;,&quot;T&quot;)

cov_all_filt_log_gen=cbind(bin.genes,cov_all_filt_log)

cov_all_tidy= cov_all_filt_log_gen%&gt;% gather(sample, value, -bin.genes)


#add fraction column

cov_all_tidy_frac=cov_all_tidy %&gt;% mutate(fraction=ifelse(grepl(&quot;T&quot;,sample), &quot;total&quot;, &quot;nuclear&quot;)) %&gt;% mutate(line=substr(sample,3,7))</code></pre>
<p>Make a heatmap:</p>
<pre class="r"><code>bin_count=ggplot(cov_all_tidy_frac, aes(x = line, y=value,fill=fraction )) + geom_boxplot(position=&quot;dodge&quot;) + labs(y=&quot;log10 count + 1&quot;, title=&quot;Bins in nuclear fractions have larger counts &quot; )
bin_count</code></pre>
<p><img src="figure/cov200bpwind.Rmd/unnamed-chunk-19-1.png" width="672" style="display: block; margin: auto;" /></p>
<details> <summary><em>Expand here to see past versions of unnamed-chunk-19-1.png:</em></summary>
<table style="border-collapse:separate; border-spacing:5px;">
<thead>
<tr>
<th style="text-align:left;">
Version
</th>
<th style="text-align:left;">
Author
</th>
<th style="text-align:left;">
Date
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/7ea0888a9fb5edb268ff7448bc545742d531b18e/docs/figure/cov200bpwind.Rmd/unnamed-chunk-19-1.png" target="_blank">7ea0888</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
</tr>
</tbody>
</table>
<p></details></p>
<pre class="r"><code>#ggsave(&quot;../output/plots/bin_counts_by_line.png&quot;, bin_count)</code></pre>
<div id="non-zero-bins" class="section level3">
<h3>Non-zero bins</h3>
<p>For the next section of this analysis I want to look at how many of the bins have non zero counts. I will do this over all then I will gather per gene and look at this. I will use the filtered non transformed data.</p>
<pre class="r"><code>cov_all_filt_genes=separate(data = cov_all_filt, col = Geneid, into = c(&quot;bin&quot;, &quot;gene&quot;), sep = &quot;.E&quot;) 
cov_all_filt_genes$gene= paste( &quot;E&quot;,  cov_all_filt_genes$gene, sep=&quot;&quot; )
cov_all_filt_num=cov_all_filt_genes[,8:39]
non_zero=colSums(cov_all_filt_num != 0)

#make a data frame to plot this

non_zero_df=data.frame(non_zero)
non_zero_df= non_zero_df %&gt;% mutate(fraction=ifelse(grepl(&quot;T&quot;,rownames(non_zero_df)), &quot;total&quot;, &quot;nuclear&quot;)) %&gt;% mutate(line=substr(rownames(non_zero_df),3,7))


non_zero_plot=ggplot(non_zero_df, aes(x = line, y=non_zero, fill=fraction )) + geom_bar(position=&quot;dodge&quot;,stat=&quot;identity&quot;) + labs(y=&quot;Non zero bins&quot;, title=&quot;Number of bins with reads after filtering&quot;)
non_zero_plot</code></pre>
<p><img src="figure/cov200bpwind.Rmd/unnamed-chunk-20-1.png" width="672" style="display: block; margin: auto;" /></p>
<details> <summary><em>Expand here to see past versions of unnamed-chunk-20-1.png:</em></summary>
<table style="border-collapse:separate; border-spacing:5px;">
<thead>
<tr>
<th style="text-align:left;">
Version
</th>
<th style="text-align:left;">
Author
</th>
<th style="text-align:left;">
Date
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
<a href="https://github.com/brimittleman/threeprimeseq/blob/4a45d81a3a87bb33a5461c186ca4d8007ba2fb43/docs/figure/cov200bpwind.Rmd/unnamed-chunk-20-1.png" target="_blank">4a45d81</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-06-04
</td>
</tr>
</tbody>
</table>
<p></details></p>
<pre class="r"><code>#ggsave(&quot;../output/plots/non_zero_bins.png&quot;, non_zero_plot)</code></pre>
<p>This analysis is bins over all. I want to look at this by gene. I want to get a number of nonzero bins per gene/ number of bins for that gene. I will use the gather function.</p>
<pre class="r"><code>cov_all_filt_small=cbind(cov_all_filt_genes[,1:2],cov_all_filt_genes[,8:39])
cov_all_filt_pergene=cov_all_filt_small %&gt;% gather(sample, value, -gene, -bin)  %&gt;% group_by(gene, sample) %&gt;% summarise(non_zero=sum(value!=0)/n())%&gt;% mutate(fraction=ifelse(grepl(&quot;T&quot;,sample), &quot;total&quot;, &quot;nuclear&quot;)) %&gt;% mutate(line=substr(sample,3,7))</code></pre>
<p>Now I have the number of non zero bins in that gene/ number of bins in that gene. I need to think about the way to plot this.</p>
</div>
</div>
<div id="prepare-data-for-leafcutter" class="section level2">
<h2>Prepare data for leafcutter:</h2>
<p>For leafcutter I need the data to look like:</p>
<p>chr1:APA1:gene_name count.ind1 count.ind2</p>
<p>chr1:APA2:gene_name ind1 count.ind2</p>
<p>I will separate the fractions into 2 data frames them filter each by bins with at least 5 counts in 1/3 of the individuals.</p>
<pre class="r"><code>#counts only
cov_nuc=cov_all %&gt;% select(contains(&quot;N_&quot;))
#with annotations
cov_nuc_anno=cbind(cov_all[,1:6], cov_nuc)

keep.nuc= rowSums(cov_nuc&gt;=5) &gt;= 5

#annotated and filtered nuclear
cov_nuc_anno_filt=cov_nuc_anno[keep.nuc,]</code></pre>
<p>Run the same filter for the total fraction.</p>
<pre class="r"><code>#counts total only  
cov_tot=cov_all %&gt;% select(contains(&quot;T_&quot;))
#with annotaiton
cov_tot_anno=cbind(cov_all[,1:6], cov_tot)

keep_tot=rowSums(cov_tot&gt;=5)&gt;=5

#annotated and filtered total

cov_tot_anno_filt=cov_tot_anno[keep_tot,]</code></pre>
<p>Now I need to change the annoation to be chrom:apa#:gene. To do this I need to know how many bins for each bin are in the file. I can use groupby and summarize to do this.</p>
<pre class="r"><code>#nuclear genes

genes_nuc= cov_nuc_anno_filt %&gt;% separate(col = Geneid, into = c(&quot;bin&quot;, &quot;gene&quot;), sep = &quot;.E&quot;) %&gt;% group_by(gene) %&gt;% select(gene) %&gt;% tally()
genes_nuc$gene= paste( &quot;E&quot;,  genes_nuc$gene, sep=&quot;&quot; )



#total genes


genes_tot=cov_tot_anno_filt %&gt;% separate(col=Geneid, into=c(&quot;bin&quot;,&quot;gene&quot;), sep=&quot;.E&quot;) %&gt;% group_by(gene) %&gt;% select(gene) %&gt;% tally()


genes_tot$gene=paste(&quot;E&quot;, genes_tot$gene, sep=&quot;&quot;)</code></pre>
<p>Now I need a way to make a vector with APA# counting up for the number of bins in each gene.</p>
<pre class="r"><code>#nuclear APA
apa_nuc=c()
for (row in 1:nrow(genes_nuc)){
  x=1
  i=1
  while(i &lt;= as.numeric(genes_nuc[row,2])){
    apa_nuc= c(apa_nuc, paste(&quot;APA&quot;, x, sep = &quot;&quot;))
    x= x + 1
    i= i + 1
  }
}</code></pre>
<pre class="r"><code>#total APA
apa_tot=c()
for(row in 1:nrow(genes_tot)){
  x=1
  i=1
  while(i&lt;= as.numeric(genes_tot[row,2])){
    apa_tot=c(apa_tot, paste(&quot;APA&quot;, x, sep=&quot;&quot;))
    x= x + 1
    i= i + 1
  }
}</code></pre>
<p>The apa_tot and apa_nuc vector now number the bins with reads for each gene. I can use this to make the table.</p>
<pre class="r"><code>cov_tot_anno_filt_group= cov_tot_anno_filt %&gt;%separate(col=Geneid, into=c(&quot;bin&quot;,&quot;gene&quot;), sep=&quot;.E&quot;) %&gt;% group_by(gene) %&gt;% arrange(gene)
cov_tot_anno_filt_group$gene=  paste( &quot;E&quot;,  cov_tot_anno_filt_group$gene, sep=&quot;&quot; )
total_anno=paste(cov_tot_anno_filt_group$Chr, apa_tot, cov_tot_anno_filt_group$gene, sep=&quot;:&quot;)
total_leaf=cbind(total_anno, cov_tot_anno_filt_group[,8:22]) </code></pre>
<p>To this for nuclear:</p>
<pre class="r"><code>cov_nuc_anno_filt_group = cov_nuc_anno_filt %&gt;% separate(col=Geneid, into=c(&quot;bin&quot;,&quot;gene&quot;), sep=&quot;.E&quot;) %&gt;% group_by(gene) %&gt;% arrange(gene)
cov_nuc_anno_filt_group$gene=paste(&quot;E&quot;,cov_nuc_anno_filt_group$gene, sep=&quot;&quot;)
nuc_anno=paste(cov_nuc_anno_filt_group$Chr,apa_nuc,cov_nuc_anno_filt_group$gene, sep=&quot;:&quot;)
nuc_leaf=cbind(nuc_anno,cov_nuc_anno_filt_group[,8:22])</code></pre>
<p>Write both of these tables out:</p>
<pre class="r"><code>#write.csv(nuc_leaf, file=&quot;../data/leafcutter/nuc_apa_200wind.csv&quot;,row.names = FALSE, quote = FALSE)
#write.csv(total_leaf, file=&quot;../data/leafcutter/tot_apa_200wind.csv&quot;,row.names = FALSE, quote = FALSE)</code></pre>
<p>I actually want both of the samples together and I want the name of the site to be representative of the bin. To do this I can just use the start and end from the bed file. I also will create one table then filter at the end.</p>
<pre class="r"><code>cov_all_anno=cov_all %&gt;% separate(col=Geneid, into=c(&quot;bin&quot;,&quot;gene&quot;), sep=&quot;.E&quot;) 
cov_all_anno$gene=  paste( &quot;E&quot;,  cov_all_anno$gene, sep=&quot;&quot; )
bin_loc=paste(cov_all_anno$Start, cov_all_anno$End, cov_all_anno$Strand,sep=&quot;.&quot;)

leaf_all_anno=paste(cov_all_anno$Chr,bin_loc, cov_all_anno$gene, sep=&quot;:&quot;)

leaf_all=cbind(leaf_all_anno,cov_all_anno[,8:39])</code></pre>
<p>Filter this with an or statement.</p>
<pre class="r"><code>leaf_all_nuc= leaf_all %&gt;% select(contains(&quot;N_&quot;))
keep.nuc.leaf=rowSums(leaf_all_nuc&gt;=5) &gt;= 5
leaf_nuc_filt=leaf_all[keep.nuc.leaf,]


leaf_all_tot= leaf_all %&gt;% select(contains(&quot;T_&quot;))
keep.tot.leaf=rowSums(leaf_all_tot&gt;=5) &gt;= 5
leaf_tot_filt=leaf_all[keep.tot.leaf,]

leaf_all_filt=union(leaf_nuc_filt,leaf_tot_filt)</code></pre>
<p>Write this out:</p>
<pre class="r"><code>#write.table(leaf_all_filt, file=&quot;../data/leafcutter/all_leaf_200wind.csv&quot;, row.names = FALSE, quote = FALSE, sep=&quot; &quot;)</code></pre>
<p>I need to get rid of the first col name. I can do this in vim on the command line.</p>
</div>
<div id="session-information" class="section level2">
<h2>Session information</h2>
<pre class="r"><code>sessionInfo()</code></pre>
<pre><code>R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

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] bindrcpp_0.2    reshape2_1.4.3  edgeR_3.20.9    limma_3.34.9   
[5] tidyr_0.7.2     dplyr_0.7.4     ggplot2_2.2.1   workflowr_1.0.1
[9] rmarkdown_1.8.5

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.15      compiler_3.4.2    pillar_1.1.0     
 [4] git2r_0.21.0      plyr_1.8.4        bindr_0.1        
 [7] R.methodsS3_1.7.1 R.utils_2.6.0     tools_3.4.2      
[10] digest_0.6.14     lattice_0.20-35   evaluate_0.10.1  
[13] tibble_1.4.2      gtable_0.2.0      pkgconfig_2.0.1  
[16] rlang_0.1.6       yaml_2.1.16       stringr_1.2.0    
[19] knitr_1.18        tidyselect_0.2.3  locfit_1.5-9.1   
[22] rprojroot_1.3-2   grid_3.4.2        glue_1.2.0       
[25] R6_2.2.2          purrr_0.2.4       magrittr_1.5     
[28] whisker_0.3-2     backports_1.1.2   scales_0.5.0     
[31] htmltools_0.3.6   assertthat_0.2.0  colorspace_1.3-2 
[34] labeling_0.3      stringi_1.1.6     lazyeval_0.2.1   
[37] munsell_0.4.3     R.oo_1.22.0      </code></pre>
</div>

<hr>
<p>
    
</p>
<hr>

<!-- To enable disqus, uncomment the section below and provide your disqus_shortname -->

<!-- disqus
  <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'rmarkdown'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
-->
<!-- Adjust MathJax settings so that all math formulae are shown using
TeX fonts only; see
http://docs.mathjax.org/en/latest/configuration.html.  This will make
the presentation more consistent at the cost of the webpage sometimes
taking slightly longer to load. Note that this only works because the
footer is added to webpages before the MathJax javascript. -->
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    "HTML-CSS": { availableFonts: ["TeX"] }
  });
</script>

<hr>
<p>
  This reproducible <a href="http://rmarkdown.rstudio.com">R Markdown</a>
  analysis was created with
  <a href="https://github.com/jdblischak/workflowr">workflowr</a> 1.0.1
</p>
<hr>


</div>
</div>

</div>

<script>

// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
  $('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
  bootstrapStylePandocTables();
});


</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src  = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>

</body>
</html>