<!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" />

<meta name="date" content="2018-12-19" />

<title>Compare to data from Lianogluo et al LCLse</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-5.0.13/css/fa-svg-with-js.css" rel="stylesheet" />
<script src="site_libs/font-awesome-5.0.13/js/fontawesome-all.min.js"></script>
<script src="site_libs/font-awesome-5.0.13/js/fa-v4-shims.min.js"></script>

<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;
}
.html-widget {
  margin-bottom: 20px;
}
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">Compare to data from Lianogluo et al LCLse</h1>
<h4 class="author"><em>Briana Mittleman</em></h4>
<h4 class="date"><em>12/19/2018</em></h4>

</div>


<p><strong>Last updated:</strong> 2019-01-09</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/f6ea8255b211152a91758101fddf5d7389daac93" target="_blank">f6ea825</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:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    data/.DS_Store
    Ignored:    output/.DS_Store

Untracked files:
    Untracked:  KalistoAbundance18486.txt
    Untracked:  analysis/DirectionapaQTL.Rmd
    Untracked:  analysis/ncbiRefSeq_sm.sort.mRNA.bed
    Untracked:  analysis/snake.config.notes.Rmd
    Untracked:  analysis/verifyBAM.Rmd
    Untracked:  code/PeaksToCoverPerReads.py
    Untracked:  code/strober_pc_pve_heatmap_func.R
    Untracked:  data/18486.genecov.txt
    Untracked:  data/APApeaksYL.total.inbrain.bed
    Untracked:  data/ChromHmmOverlap/
    Untracked:  data/GM12878.chromHMM.bed
    Untracked:  data/GM12878.chromHMM.txt
    Untracked:  data/LianoglouLCL/
    Untracked:  data/LocusZoom/
    Untracked:  data/NuclearApaQTLs.txt
    Untracked:  data/PeakCounts/
    Untracked:  data/PeaksUsed/
    Untracked:  data/RNAkalisto/
    Untracked:  data/TotalApaQTLs.txt
    Untracked:  data/Totalpeaks_filtered_clean.bed
    Untracked:  data/UnderstandPeaksQC/
    Untracked:  data/YL-SP-18486-T-combined-genecov.txt
    Untracked:  data/YL-SP-18486-T_S9_R1_001-genecov.txt
    Untracked:  data/apaExamp/
    Untracked:  data/bedgraph_peaks/
    Untracked:  data/bin200.5.T.nuccov.bed
    Untracked:  data/bin200.Anuccov.bed
    Untracked:  data/bin200.nuccov.bed
    Untracked:  data/clean_peaks/
    Untracked:  data/comb_map_stats.csv
    Untracked:  data/comb_map_stats.xlsx
    Untracked:  data/comb_map_stats_39ind.csv
    Untracked:  data/combined_reads_mapped_three_prime_seq.csv
    Untracked:  data/diff_iso_trans/
    Untracked:  data/ensemble_to_genename.txt
    Untracked:  data/example_gene_peakQuant/
    Untracked:  data/explainProtVar/
    Untracked:  data/filtered_APApeaks_merged_allchrom_refseqTrans.closest2End.bed
    Untracked:  data/filtered_APApeaks_merged_allchrom_refseqTrans.closest2End.noties.bed
    Untracked:  data/first50lines_closest.txt
    Untracked:  data/gencov.test.csv
    Untracked:  data/gencov.test.txt
    Untracked:  data/gencov_zero.test.csv
    Untracked:  data/gencov_zero.test.txt
    Untracked:  data/gene_cov/
    Untracked:  data/joined
    Untracked:  data/leafcutter/
    Untracked:  data/merged_combined_YL-SP-threeprimeseq.bg
    Untracked:  data/mol_overlap/
    Untracked:  data/mol_pheno/
    Untracked:  data/nom_QTL/
    Untracked:  data/nom_QTL_opp/
    Untracked:  data/nom_QTL_trans/
    Untracked:  data/nuc6up/
    Untracked:  data/other_qtls/
    Untracked:  data/pQTL_otherphen/
    Untracked:  data/peakPerRefSeqGene/
    Untracked:  data/perm_QTL/
    Untracked:  data/perm_QTL_opp/
    Untracked:  data/perm_QTL_trans/
    Untracked:  data/perm_QTL_trans_filt/
    Untracked:  data/reads_mapped_three_prime_seq.csv
    Untracked:  data/smash.cov.results.bed
    Untracked:  data/smash.cov.results.csv
    Untracked:  data/smash.cov.results.txt
    Untracked:  data/smash_testregion/
    Untracked:  data/ssFC200.cov.bed
    Untracked:  data/temp.file1
    Untracked:  data/temp.file2
    Untracked:  data/temp.gencov.test.txt
    Untracked:  data/temp.gencov_zero.test.txt
    Untracked:  data/threePrimeSeqMetaData.csv
    Untracked:  output/picard/
    Untracked:  output/plots/
    Untracked:  output/qual.fig2.pdf

Unstaged changes:
    Modified:   analysis/28ind.peak.explore.Rmd
    Modified:   analysis/InvestigatePeak2GeneAssignment.Rmd
    Modified:   analysis/apaQTLoverlapGWAS.Rmd
    Modified:   analysis/cleanupdtseq.internalpriming.Rmd
    Modified:   analysis/coloc_apaQTLs_protQTLs.Rmd
    Modified:   analysis/dif.iso.usage.leafcutter.Rmd
    Modified:   analysis/diff_iso_pipeline.Rmd
    Modified:   analysis/explainpQTLs.Rmd
    Modified:   analysis/explore.filters.Rmd
    Modified:   analysis/flash2mash.Rmd
    Modified:   analysis/overlapMolQTL.Rmd
    Modified:   analysis/overlap_qtls.Rmd
    Modified:   analysis/peakOverlap_oppstrand.Rmd
    Modified:   analysis/pheno.leaf.comb.Rmd
    Modified:   analysis/swarmPlots_QTLs.Rmd
    Modified:   analysis/test.max2.Rmd
    Modified:   analysis/understandPeaks.Rmd
    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/f6ea8255b211152a91758101fddf5d7389daac93/analysis/CompareLianoglouData.Rmd" target="_blank">f6ea825</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2019-01-09
</td>
<td style="text-align:left;">
add RNAseq dt code and cov by annotation plots
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/a6be7bd4e21adbbf92fa7483a8b0e9bc71c55b12/docs/CompareLianoglouData.html" target="_blank">a6be7bd</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2019-01-08
</td>
<td style="text-align:left;">
Build site.
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/dfb2cb741021d7ae77715910327f53586714c40e/docs/CompareLianoglouData.html" target="_blank">dfb2cb7</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</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/479293dbaff3181baf092ae2257ac1cef89685d4/analysis/CompareLianoglouData.Rmd" target="_blank">479293d</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</td>
<td style="text-align:left;">
qtl res
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/29e77fba492248f868b92e71603296fab7c0f877/docs/CompareLianoglouData.html" target="_blank">29e77fb</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</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/490f857dbd3b79b9786210940bdba6e856cebc95/analysis/CompareLianoglouData.Rmd" target="_blank">490f857</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</td>
<td style="text-align:left;">
add QTL map code
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/8d6e55ea94bdac813222ef47ecbc0d4b6f346900/docs/CompareLianoglouData.html" target="_blank">8d6e55e</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</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/895acea6c27f49736c24cf4a5d3517702c88107f/analysis/CompareLianoglouData.Rmd" target="_blank">895acea</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</td>
<td style="text-align:left;">
add QTL map code
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/b49ffd93794c69c8be122f59f958c268d21643ad/docs/CompareLianoglouData.html" target="_blank">b49ffd9</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-20
</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/892532067dc7e6560bd77493b948aac17900c3ad/analysis/CompareLianoglouData.Rmd" target="_blank">8925320</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-20
</td>
<td style="text-align:left;">
filter annotated clusters
</td>
</tr>
<tr>
<td style="text-align:left;">
html
</td>
<td style="text-align:left;">
<a href="https://cdn.rawgit.com/brimittleman/threeprimeseq/785b8216e916fcc9ecfa66ee7f35622fd210b602/docs/CompareLianoglouData.html" target="_blank">785b821</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-20
</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/d99a6f3a3875fd4b2482084467c9875b1579f9ca/analysis/CompareLianoglouData.Rmd" target="_blank">d99a6f3</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-20
</td>
<td style="text-align:left;">
initializa comparison analysis
</td>
</tr>
</tbody>
</table>
</ul>
<p></details></p>
<hr />
<p>The Lianoglou et al paper has data from LCLs as well. I am going to download their high confidence peaks from <a href="http://www.polyasite.unibas.ch" class="uri">http://www.polyasite.unibas.ch</a></p>
<p>“In total, we collected 351,840 Poly(A) sites comprising a total of 4,394,848 reads. We calculated 35.20% of the poly(A) sites, which are 2.68% of all reads, to originate from internal priming.”</p>
<pre class="r"><code>library(workflowr)</code></pre>
<pre><code>This is workflowr version 1.1.1
Run ?workflowr for help getting started</code></pre>
<pre class="r"><code>library(tidyverse)</code></pre>
<pre><code>── Attaching packages ──────────────────────────────────────────────────── tidyverse 1.2.1 ──</code></pre>
<pre><code>✔ ggplot2 3.0.0     ✔ purrr   0.2.5
✔ tibble  1.4.2     ✔ dplyr   0.7.6
✔ tidyr   0.8.1     ✔ stringr 1.3.1
✔ readr   1.1.1     ✔ forcats 0.3.0</code></pre>
<pre><code>── Conflicts ─────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()</code></pre>
<pre class="r"><code>library(edgeR)</code></pre>
<pre><code>Loading required package: limma</code></pre>
<pre class="r"><code>library(tximport)</code></pre>
<pre class="r"><code>LianoglouLCL=read.table(&quot;../data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.bed&quot;, stringsAsFactors = F, col.names =c(&quot;chr&quot;, &quot;start&quot;, &quot;end&quot;, &quot;Status&quot;, &quot;Score&quot;, &quot;Strand&quot;)) </code></pre>
<pre class="r"><code>LianoglouLCL %&gt;% group_by(Status) %&gt;% tally()</code></pre>
<pre><code># A tibble: 3 x 2
  Status      n
  &lt;chr&gt;   &lt;int&gt;
1 IP     123864
2 OK     227975
3 &lt;NA&gt;        1</code></pre>
<p>Filter on the OK peaks.</p>
<pre class="r"><code>LianoglouLCL_ok=LianoglouLCL %&gt;% filter(Status==&quot;OK&quot;)</code></pre>
<div id="my-reads-in-thier-peaks" class="section level2">
<h2>My reads in thier Peaks</h2>
<p>I can map our reads to these peaks to see what percent of our reads map to these with feature counts. I will need to make this an SAF file.</p>
<p>LianoglouLCLBed2SAF.py</p>
<pre class="bash"><code>from misc_helper import *

fout = open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK.SAF&quot;,&#39;w&#39;)
fout.write(&quot;GeneID\tChr\tStart\tEnd\tStrand\n&quot;)
for ln in open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK.bed&quot;):
    chrom, start, end, name, score, strand = ln.split()
    chrom_F=chrom[3:]
    start_i=int(start)
    end_i=int(end)
    fout.write(&quot;%s\t%s\t%d\t%d\t%s\n&quot;%(name, chrom_F, start_i, end_i, strand))
fout.close()</code></pre>
<p>Feature Counts<br />
LianoglouLCL_FC.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=LianoglouLCL_FC
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=LianoglouLCL_FC.out
#SBATCH --error=LianoglouLCL_FC.err
#SBATCH --partition=broadwl
#SBATCH --mem=12G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

featureCounts -O -a /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK.SAF -F SAF -o /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/LianoglouLCL_CleanPeaks.Total.fc /project2/gilad/briana/threeprimeseq/data/sort/*-T-*-sort.bam -s 2

featureCounts -O -a /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK.SAF -F SAF -o /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/LianoglouLCL_CleanPeaks.Nuclear.fc /project2/gilad/briana/threeprimeseq/data/sort/*-N-*-sort.bam -s 2
</code></pre>
<p>fix_LianoglouLCL_FC.py</p>
<pre class="bash"><code>infile= open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/LianoglouLCL_CleanPeaks.Total.fc.summary&quot;, &quot;r&quot;)
fout = open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/LianoglouLCL_CleanPeaks.Total.fc_fixed.summary&quot;,&#39;w&#39;)
for line, i in enumerate(infile):
    if line == 0:
        i_list=i.split()
        libraries=[i_list[0]]
        for sample in i_list[1:]:
            full = sample.split(&quot;/&quot;)[7]
            samp= full.split(&quot;-&quot;)[2:4]
            lim=&quot;_&quot;
            samp_st=lim.join(samp)
            libraries.append(samp_st)
        print(libraries)
        first_line= &quot;\t&quot;.join(libraries)
        fout.write(first_line + &#39;\n&#39; )
    else:
        fout.write(i)
fout.close()</code></pre>
<p>Pull summary onto computer and explore percent of reads mapping to peaks.</p>
</div>
<div id="peak-overlap" class="section level2">
<h2>Peak Overlap</h2>
<p>I can also ask how many of our peaks overlap with theirs.</p>
<pre class="bash"><code>sed &#39;s/^chr//&#39; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK.bed &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR.bed

#sort

sort -k 1,1 -k2,2n /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR.bed &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort.bed
</code></pre>
<p>Remake file in python:</p>
<pre class="bash"><code>inFile=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort.bed&quot;, &quot;r&quot;)
outFile=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_fixed.bed&quot;, &quot;w&quot;)
for ln in inFile:
  chrom, start, end, stat, score, strand = ln.split()
  start_i=int(start)
  end_i=int(end)
  outFile.write(&quot;%s\t%d\t%d\t%s\t%s\t%s\n&quot;%(chrom, start_i, end_i, stat, score, strand))
outFile.close()
</code></pre>
<pre class="bash"><code>import pybedtools
lian=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_fixed.bed&quot;)
Peak=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/mergedPeaks_comb/filtered_APApeaks_merged_allchrom_refseqTrans.noties_sm.fixed.bed&quot;) 

lianOverPeak=Peak.intersect(lian, u=True)

#this only results in one overlap:  
lianOverPeak.saveas(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/myPeaksInLiangoluLCL.bed&quot;)</code></pre>
<p>This results in 39213 peaks.</p>
<p>I will look at our peaks, thier peaks and our tracks in IGV.</p>
<p>Next I can look at the peaks that are called at IP in the Lianglou data.</p>
<pre class="bash"><code>
sed &#39;s/^chr//&#39; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly.bed &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly_noCHR.bed

#sort

sort -k 1,1 -k2,2n /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly_noCHR.bed &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly_noCHR_sort.bed
</code></pre>
<p>Remake file in python:</p>
<pre class="bash"><code>inFile=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly_noCHR_sort.bed&quot;, &quot;r&quot;)
outFile=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly_noCHR_sort_fixed.bed&quot;, &quot;w&quot;)
for ln in inFile:
  chrom, start, end, stat, score, strand = ln.split()
  start_i=int(start)
  end_i=int(end)
  outFile.write(&quot;%s\t%d\t%d\t%s\t%s\t%s\n&quot;%(chrom, start_i, end_i, stat, score, strand))
outFile.close()
</code></pre>
<pre class="bash"><code>import pybedtools
lian=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ipOnly_noCHR_sort_fixed.bed&quot;)
Peak=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/mergedPeaks_comb/filtered_APApeaks_merged_allchrom_refseqTrans.noties_sm.fixed.bed&quot;) 

lianOverPeak=Peak.intersect(lian, u=True)

#this only results in one overlap:  
lianOverPeak.saveas(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/myPeaksInLiangoluLCL_IPOnly.bed&quot;)</code></pre>
<p>This results in 35700 peaks.</p>
<p>Our peaks are wider and may incompase the ok and IP peaks. Some of these overlap. I will look at how many.</p>
<p>I can ask how many of the OK peaks in our data are also in the IP list of our peaks</p>
<pre class="bash"><code>import pybedtools
ip=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/myPeaksInLiangoluLCL_IPOnly.bed&quot;)
ok=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/myPeaksInLiangoluLCL.bed&quot;) 

okoverip=ok.intersect(ip, u=True)

#this only results in one overlap:  
okoverip.saveas(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/myPeaksInLiangoluLCL_OkandIP.bed&quot;)</code></pre>
<p>This results in 16459 peaks.</p>
<p>One problem is thier peaks are only one base pair and we have peaks tat are 1 bp away, ex chr7:5,528,801-5,528,844.</p>
<p>I can expand thier peaks by 5bp on each side and see how much different the results are. I will do this first for the OK peaks only.</p>
<pre class="bash"><code>inFile=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_fixed.bed&quot;, &quot;r&quot;)
outFile=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_fixed_EXTEND.bed&quot;, &quot;w&quot;)
for ln in inFile:
  chrom, start, end, stat, score, strand = ln.split()
  start_i=int(start) - 5
  end_i=int(end) + 5
  outFile.write(&quot;%s\t%d\t%d\t%s\t%s\t%s\n&quot;%(chrom, start_i, end_i, stat, score, strand))
outFile.close()


import pybedtools
lian=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_fixed_EXTEND.bed&quot;)
Peak=pybedtools.BedTool(&quot;/project2/gilad/briana/threeprimeseq/data/mergedPeaks_comb/filtered_APApeaks_merged_allchrom_refseqTrans.noties_sm.fixed.bed&quot;) 

lianOverPeak=Peak.intersect(lian, u=True)

#this only results in one overlap:  
lianOverPeak.saveas(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/myPeaksInExtendedLiangoluLCL.bed&quot;)</code></pre>
<p>No we have 227975 of our peaks out of 338141 overlapping. This is 67%</p>
<p>I want to do an analysis where I sperate the overlapping and non overlapping peaks (using thier OK peaks) and look at read distributions. To do this I will pull in the overlapping peaks and intersect them with my full peak data. I want to make a data frame with the peak, if it is in their ok list, and the sum coverage in my data (ill do this for total)</p>
<pre class="r"><code>OverlapPeaks=read.table(&quot;../data/LianoglouLCL/myPeaksInExtendedLiangoluLCL.bed&quot;,stringsAsFactors = F, col.names = c(&quot;chr&quot;, &quot;start&quot;, &quot;end&quot;, &quot;name&quot;, &quot;score&quot;, &quot;strand&quot;, &quot;gene&quot;)) %&gt;% mutate(peak=paste(&quot;peak&quot;, name, sep = &quot;&quot;)) 
overlapPeaklist=as.vector(OverlapPeaks$peak)
total_Cov=read.table(&quot;../data/PeakCounts/filtered_APApeaks_merged_allchrom_refseqGenes.Transcript_sm_quant.Total_fixed.fc&quot;, header=T, stringsAsFactors = F) %&gt;% separate(Geneid, into=c(&quot;peak&quot;, &quot;chrom&quot;, &quot;start&quot;, &quot;end&quot;, &quot;strand&quot;, &quot;gene&quot;), sep=&quot;:&quot;) %&gt;% mutate(inLian=ifelse(peak %in% overlapPeaklist, &quot;Yes&quot;, &quot;No&quot;))

total_Cov_num=total_Cov[,12:50] 
PeakSum=rowSums(total_Cov_num)

peakCovSum=as.data.frame(cbind(Annotated=total_Cov$inLian, PeakSum=PeakSum))
peakCovSum$Annotated=as.factor(peakCovSum$Annotated)
peakCovSum$PeakSum=as.numeric(as.character(peakCovSum$PeakSum))</code></pre>
<p>Plot the data:</p>
<pre class="r"><code>library(ggpubr)</code></pre>
<pre><code>Loading required package: magrittr</code></pre>
<pre><code>
Attaching package: &#39;magrittr&#39;</code></pre>
<pre><code>The following object is masked from &#39;package:purrr&#39;:

    set_names</code></pre>
<pre><code>The following object is masked from &#39;package:tidyr&#39;:

    extract</code></pre>
<pre class="r"><code>covbyannoation=ggplot(peakCovSum, aes(x=Annotated, y=log10(PeakSum + 1), by=Annotated, fill=Annotated))+ geom_violin() + stat_compare_means(method = &quot;t.test&quot;) + labs(title=&quot;Sum of peak read count by annotation status&quot;, x=&quot;In Lianoglou Annitation&quot;)
covbyannoation</code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-17-1.png" width="672" style="display: block; margin: auto;" /></p>
<pre class="r"><code>ggsave(file=&quot;../output/plots/PeakCoverageByAnnotationTotal.png&quot;, covbyannoation)</code></pre>
<pre><code>Saving 7 x 5 in image</code></pre>
<p>plot cdf stat_ecdf(geom = “point”)</p>
<pre class="r"><code>ggplot(peakCovSum, aes(x=log10(PeakSum + 1), by=Annotated, col=Annotated))+ stat_ecdf(geom=&quot;point&quot;)  + labs(title=&quot;Sum of peak read count by annotation status&quot;)</code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-18-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>I will do this in nuclear. I expect results to be a bit difference because we expect some peaks not to be in the annotation.</p>
<pre class="r"><code>nuc_Cov=read.table(&quot;../data/PeakCounts/filtered_APApeaks_merged_allchrom_refseqGenes.Transcript_sm_quant.Nuclear_fixed.fc&quot;, header=T, stringsAsFactors = F) %&gt;% separate(Geneid, into=c(&quot;peak&quot;, &quot;chrom&quot;, &quot;start&quot;, &quot;end&quot;, &quot;strand&quot;, &quot;gene&quot;), sep=&quot;:&quot;) %&gt;% mutate(inLian=ifelse(peak %in% overlapPeaklist, &quot;Yes&quot;, &quot;No&quot;))

nuc_Cov_num=nuc_Cov[,12:50] 
PeakSumNuc=rowSums(nuc_Cov_num)

peakCovSumNuc=as.data.frame(cbind(Annotated=nuc_Cov$inLian, PeakSum=PeakSumNuc))
peakCovSumNuc$Annotated=as.factor(peakCovSumNuc$Annotated)
peakCovSumNuc$PeakSum=as.numeric(as.character(peakCovSumNuc$PeakSum))</code></pre>
<pre class="r"><code>covbyannoationnuc=ggplot(peakCovSumNuc, aes(x=Annotated, y=log10(PeakSum + 1), by=Annotated, fill=Annotated))+ geom_violin() + stat_compare_means(method = &quot;t.test&quot;) + labs(title=&quot;Sum of peak read count by annotation status- Nuclear&quot;, x=&quot;In Lianoglou Annitation&quot;)
covbyannoationnuc</code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-20-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>look at them next to eachother:</p>
</div>
<div id="change-annotations-to-full-atlas" class="section level2">
<h2>Change Annotations to full atlas</h2>
<div id="quantify-coverage-at-annotated-clusters" class="section level3">
<h3>Quantify coverage at annotated clusters</h3>
<p>The full atlas has peaks mapped to genes. (<a href="http://www.polyasite.unibas.ch" class="uri">http://www.polyasite.unibas.ch</a>) I will use these and map our data to them. I can then run the QC metrics I had done previously as well as the QTL analysis.</p>
<p>The first step will be processing the data into a format like mine with peakIDs including the gene name. Then I will run feature counts and filter the non used peaks.</p>
<p>Information from site about columns</p>
<ul>
<li><p>The first column stores the chromosome name.</p></li>
<li><p>The second and the third column mark the start and end positions of poly(A) site cluster, respectively.</p></li>
<li><p>The fourth column is the unqiue cluster ID composed of the chromosome name, the strand, the representative poly(A) site of the cluster, and a two letter code for the cluster annotation (TE: terminal exon, DS: 1,000 nt downstream of a terminal exon, EX: exonic, IN: intronic, AU: 1,000 nt upstream in anti-sense direction of a transcription start site, AE: anti-sense to an exon, AI: anti-sense to an intron, IG: intergenic).</p></li>
<li><p>The fifth column stores the number different 3’ end sequencing protocols that support the particular cluster.</p></li>
<li><p>The sixth column stores the strand.</p></li>
<li><p>The seventh column stores information about the poly(A) signal(s) per poly(A) site, including the motif, the location with respect to the cleavage site and the genomic coordinate.</p></li>
</ul>
<p>I am going to use clusters.bed</p>
<p>I am only going to keep PAS with an annotated gene. This is in column 8.</p>
<p>The goal is a dataset like /project2/gilad/briana/threeprimeseq/data/mergedPeaks_comb/filtered_APApeaks_merged_allchrom_refseqTrans.noties_sm.SAF for feature counts. I need to number the peaks here. To do this I can add a column with a number like I did for my peaks.</p>
<p>First sort the clusters file:</p>
<pre class="bash"><code>sort -k 1,1 -k2,2n /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters.bed &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort.bed  

x = wc -l /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort.bed  

seq 1 392912 &gt; cluster.peak.num.txt

paste /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort.bed   cluster.peak.num.txt | column -s $&#39;\t&#39; -t &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort_named.bed  
</code></pre>
<p>Python script to make a SAF.</p>
<p>clusterBed2SAF.py</p>
<pre class="bash"><code>fout = open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort_named.SAF&quot;,&#39;w&#39;)
fout.write(&quot;GeneID\tChr\tStart\tEnd\tStrand\n&quot;)
for ln in open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort_named.bed&quot;):
    chrom, start, end, uniq, score, strand, extra, gene, name = ln.split()
    if gene==&quot;.&quot;:
      continue
    else:
      chrom_o=chrom[3:]
      name_i=int(name)
      start_i=int(start)
      end_i=int(end)
      ID = &quot;peak%d:%s:%d:%d:%s:%s&quot;%(name_i, chrom_o, start_i, end_i, strand, gene)
      fout.write(&quot;%s\t%s\t%d\t%d\t%s\n&quot;%(ID, chrom_o, start_i, end_i, strand))
fout.close()</code></pre>
<p>I can now use this to run feature counts with my bam files.</p>
<p>AnnotatedClustersFC_TN.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=AnnotatedClustersFC_TN
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=AnnotatedClustersFC_TN.out
#SBATCH --error=AnnotatedClustersFC_TN.err
#SBATCH --partition=broadwl
#SBATCH --mem=12G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

featureCounts -O -a /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort_named.SAF -F SAF -o /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fc /project2/gilad/briana/threeprimeseq/data/sort/*-T-*-sort.bam -s 2

featureCounts -O -a /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/clusters_sort_named.SAF -F SAF -o /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Nuclear.fc /project2/gilad/briana/threeprimeseq/data/sort/*-N-*-sort.bam -s 2
</code></pre>
<p>I will next need to fix the headers for the total and nuclear files.</p>
<p>FixHeader_TotalAnnotatedClustersFC.py</p>
<pre class="bash"><code>infile= open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fc&quot;, &quot;r&quot;)
fout = open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.fc&quot;,&#39;w&#39;)
for line, i in enumerate(infile):
    if line == 1:
        i_list=i.split()
        libraries=i_list[:6]
        for sample in i_list[6:]:
            full = sample.split(&quot;/&quot;)[7]
            samp= full.split(&quot;-&quot;)[2:4]
            lim=&quot;_&quot;
            samp_st=lim.join(samp)
            libraries.append(samp_st)
        first_line= &quot;\t&quot;.join(libraries)
        fout.write(first_line + &#39;\n&#39;)
    else :
        fout.write(i)
fout.close()</code></pre>
<p>FixHeader_NucelarAnnotatedClustersFC.py</p>
<pre class="bash"><code>infile= open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Nuclear.fc&quot;, &quot;r&quot;)
fout = open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Nuclear.fixed.fc&quot;,&#39;w&#39;)
for line, i in enumerate(infile):
    if line == 1:
        i_list=i.split()
        libraries=i_list[:6]
        for sample in i_list[6:]:
            full = sample.split(&quot;/&quot;)[7]
            samp= full.split(&quot;-&quot;)[2:4]
            lim=&quot;_&quot;
            samp_st=lim.join(samp)
            libraries.append(samp_st)
        first_line= &quot;\t&quot;.join(libraries)
        fout.write(first_line + &#39;\n&#39;)
    else :
        fout.write(i)
fout.close()</code></pre>
<p>This results in 7-11 million reads mapping to the features in the total fraction. This is in comparison to over 10 mill in our peaks.</p>
<div id="look-at-total-coverage" class="section level4">
<h4>Look at total coverage</h4>
<p>With these results I need to filter the lowley expressed clusters. I will start with one line as I did before.</p>
<pre class="r"><code>total_Cov=read.table(&quot;../data/LianoglouLCL/AnnotatedClusters.Total.fixed.fc&quot;, header=T, stringsAsFactors = F)

peakLength=total_Cov[,6]


total_Cov_m= as.matrix(total_Cov[,7:ncol(total_Cov)])
total_Cov_m=log10(total_Cov_m)</code></pre>
<p>Plot the densities</p>
<pre class="r"><code>plotDensities(total_Cov_m, legend = &quot;bottomright&quot;, main=&quot;Pre-filtering&quot;)
abline(v = .5, lty = 3)</code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-28-1.png" width="672" style="display: block; margin: auto;" /></p>
<details> <summary><em>Expand here to see past versions of unnamed-chunk-28-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/8d6e55ea94bdac813222ef47ecbc0d4b6f346900/docs/figure/CompareLianoglouData.Rmd/unnamed-chunk-28-1.png" target="_blank">8d6e55e</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</td>
</tr>
</tbody>
</table>
<p></details></p>
<p>The cuttoff should be log10=.5. I want to filter on this.</p>
<pre class="r"><code>keep.exprs_T=rowSums(total_Cov_m&gt;.5) &gt;= 26
total_Cov_m_filt= total_Cov_m[keep.exprs_T,]

plotDensities(total_Cov_m_filt, legend = &quot;bottomright&quot;, main=&quot;Post-filtering&quot;)</code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-29-1.png" width="672" style="display: block; margin: auto;" /></p>
<details> <summary><em>Expand here to see past versions of unnamed-chunk-29-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/8d6e55ea94bdac813222ef47ecbc0d4b6f346900/docs/figure/CompareLianoglouData.Rmd/unnamed-chunk-29-1.png" target="_blank">8d6e55e</a>
</td>
<td style="text-align:left;">
Briana Mittleman
</td>
<td style="text-align:left;">
2018-12-21
</td>
</tr>
</tbody>
</table>
<p></details></p>
<p>This looks a lot better and results in 35,197 peaks. Now I can filter the full dataframe and start comparing this to the RNA seq.</p>
<pre class="r"><code>total_Cov_18486_filt=total_Cov[keep.exprs_T,1:7] %&gt;% separate(Geneid, into=c(&quot;peak&quot;, &quot;chr&quot;, &quot;start&quot;, &quot;end&quot;, &quot;strand&quot;, &quot;gene&quot;), sep=&quot;:&quot;) %&gt;% select(gene, X18486_T)%&gt;%  group_by(gene) %&gt;% summarize(GeneSum=sum(X18486_T))</code></pre>
<p>Pull in the kalisto counts.</p>
<p>TPM counts from Kalisto</p>
<pre class="r"><code>tx2gene=read.table(&quot;../data/RNAkalisto/ncbiRefSeq.txn2gene.txt&quot; ,header= F, sep=&quot;\t&quot;, stringsAsFactors = F)

txi.kallisto.tsv &lt;- tximport(&quot;../data/RNAkalisto/abundance.tsv&quot;, type = &quot;kallisto&quot;, tx2gene = tx2gene,countsFromAbundance=&quot;lengthScaledTPM&quot; )</code></pre>
<pre><code>Note: importing `abundance.h5` is typically faster than `abundance.tsv`</code></pre>
<pre><code>reading in files with read_tsv</code></pre>
<pre><code>1 
removing duplicated transcript rows from tx2gene
transcripts missing from tx2gene: 99
summarizing abundance
summarizing counts
summarizing length</code></pre>
<p>Join the data frames.</p>
<pre class="r"><code>TXN_abund=as.data.frame(txi.kallisto.tsv$abundance) %&gt;% rownames_to_column(var=&quot;gene&quot;)
colnames(TXN_abund)=c(&quot;gene&quot;, &quot;TPM&quot;)

Overlap=TXN_abund %&gt;% inner_join(total_Cov_18486_filt,by=&quot;gene&quot;)</code></pre>
<p>Remove rows with 0 counts and Plot:</p>
<pre class="r"><code>Overlap=Overlap %&gt;% filter(TPM&gt;0) %&gt;% filter(GeneSum&gt;0)
corr_18486Tot=ggplot(Overlap, aes(x=log10(TPM), y= log10(GeneSum))) + geom_point() + labs(title=&quot;Total 18486 with Annotated Peaks&quot;, x=&quot;log10 RNA seq TPM&quot;, y=&quot;log10 Peak count sum per gene&quot;)+ geom_smooth(aes(x=log10(TPM),y=log10(GeneSum)),method = &quot;lm&quot;) + annotate(&quot;text&quot;,x=-5, y=5,label=&quot;R2=.47&quot;) +geom_density2d(na.rm = TRUE, size = 1, colour = &#39;red&#39;)

#+ geom_text(aes(label=gene),hjust=0, vjust=0)
       
corr_18486Tot       </code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-33-1.png" width="672" style="display: block; margin: auto;" /></p>
<pre class="r"><code>summary(lm(log10(TPM)~log10(GeneSum),Overlap)) </code></pre>
<pre><code>
Call:
lm(formula = log10(TPM) ~ log10(GeneSum), data = Overlap)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.8184 -0.2344  0.0135  0.2620  2.5192 

Coefficients:
                Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)    -0.070619   0.015141  -4.664 3.14e-06 ***
log10(GeneSum)  0.594440   0.006294  94.449  &lt; 2e-16 ***
---
Signif. codes:  0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1

Residual standard error: 0.4692 on 9865 degrees of freedom
Multiple R-squared:  0.4749,    Adjusted R-squared:  0.4748 
F-statistic:  8921 on 1 and 9865 DF,  p-value: &lt; 2.2e-16</code></pre>
<pre class="r"><code>cor.test(log10(Overlap$TPM),log10(Overlap$GeneSum))</code></pre>
<pre><code>
    Pearson&#39;s product-moment correlation

data:  log10(Overlap$TPM) and log10(Overlap$GeneSum)
t = 94.449, df = 9865, p-value &lt; 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.6785988 0.6993264
sample estimates:
      cor 
0.6891035 </code></pre>
<p>This is looking at 9,867 genes.</p>
<p>Look at this sum overed all individuals.</p>
<pre class="r"><code>TotCounts_allind=total_Cov[keep.exprs_T,7:45]


SumCounts_Tot=rowSums(TotCounts_allind)

Alllib_Tot_Filt=total_Cov[keep.exprs_T,1:7] %&gt;% separate(Geneid, into=c(&quot;peak&quot;, &quot;chr&quot;, &quot;start&quot;, &quot;end&quot;, &quot;strand&quot;, &quot;gene&quot;), sep=&quot;:&quot;)


Alllib_Tot_Filt$SumCounts=SumCounts_Tot

Alllib_Tot_Filtbygene=Alllib_Tot_Filt %&gt;% select(gene, SumCounts) %&gt;%  group_by(gene)  %&gt;%  summarize(GeneSum=sum(SumCounts))


TXN_abund_combLibs_tot=TXN_abund %&gt;% inner_join(Alllib_Tot_Filtbygene,by=&quot;gene&quot;)


TXN_abund_combLibs_tot_n0=TXN_abund_combLibs_tot %&gt;% filter(TPM&gt;0) %&gt;% filter(GeneSum&gt;0)


corr_AllLibTot=ggplot(TXN_abund_combLibs_tot_n0, aes(x=log10(TPM), y= log10(GeneSum))) + geom_point() + labs(title=&quot;Total All ind Filtered Annotated Clusters&quot;, x=&quot;log10 RNA seq TPM&quot;, y=&quot;log10 Peak count sum per gene All Ind.&quot;)+ geom_smooth(aes(x=log10(TPM),y=log10(GeneSum)),method = &quot;lm&quot;) + annotate(&quot;text&quot;,x=-5, y=5,label=&quot;R2=.53&quot;) +geom_density2d(na.rm = TRUE, size = 1, colour = &#39;red&#39;) + geom_text(aes(label=gene),hjust=0, vjust=0)
       
corr_AllLibTot      </code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-34-1.png" width="672" style="display: block; margin: auto;" /></p>
<pre class="r"><code>summary(lm(log10(TPM)~log10(GeneSum),TXN_abund_combLibs_tot_n0)) </code></pre>
<pre><code>
Call:
lm(formula = log10(TPM) ~ log10(GeneSum), data = TXN_abund_combLibs_tot_n0)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.8186 -0.2245  0.0180  0.2594  2.4471 

Coefficients:
               Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)    -1.57143    0.02637  -59.58   &lt;2e-16 ***
log10(GeneSum)  0.70927    0.00654  108.45   &lt;2e-16 ***
---
Signif. codes:  0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1

Residual standard error: 0.4606 on 10322 degrees of freedom
Multiple R-squared:  0.5326,    Adjusted R-squared:  0.5326 
F-statistic: 1.176e+04 on 1 and 10322 DF,  p-value: &lt; 2.2e-16</code></pre>
<pre class="r"><code>cor.test(log10(TXN_abund_combLibs_tot_n0$TPM),log10(TXN_abund_combLibs_tot_n0$GeneSum),method=&quot;spearman&quot;)</code></pre>
<pre><code>Warning in cor.test.default(log10(TXN_abund_combLibs_tot_n0$TPM),
log10(TXN_abund_combLibs_tot_n0$GeneSum), : Cannot compute exact p-value
with ties</code></pre>
<pre><code>
    Spearman&#39;s rank correlation rho

data:  log10(TXN_abund_combLibs_tot_n0$TPM) and log10(TXN_abund_combLibs_tot_n0$GeneSum)
S = 4.5983e+10, p-value &lt; 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.7492704 </code></pre>
<p>The outlier is PYURF. Let me remove this gene.</p>
<pre class="r"><code>TXN_abund_combLibs_tot_n0_noPYRUF= TXN_abund_combLibs_tot_n0 %&gt;% filter(gene !=&quot;PYURF&quot;)

corr_AllLibTot_noPYRUF=ggplot(TXN_abund_combLibs_tot_n0_noPYRUF, aes(x=log10(TPM), y= log10(GeneSum))) + geom_point() + labs(title=&quot;Total All ind Filtered Annotated Clusters&quot;, x=&quot;log10 RNA seq TPM&quot;, y=&quot;log10 Peak count sum per gene All Ind.&quot;)+ geom_smooth(aes(x=log10(TPM),y=log10(GeneSum)),method = &quot;lm&quot;) + annotate(&quot;text&quot;,x=-5, y=5,label=&quot;R2=.54&quot;) +geom_density2d(na.rm = TRUE, size = 1, colour = &#39;red&#39;) 

#+ geom_text(aes(label=gene),hjust=0, vjust=0)
       
corr_AllLibTot_noPYRUF      </code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-35-1.png" width="672" style="display: block; margin: auto;" /></p>
<pre class="r"><code>summary(lm(log10(TPM)~log10(GeneSum),TXN_abund_combLibs_tot_n0_noPYRUF)) </code></pre>
<pre><code>
Call:
lm(formula = log10(TPM) ~ log10(GeneSum), data = TXN_abund_combLibs_tot_n0_noPYRUF)

Residuals:
    Min      1Q  Median      3Q     Max 
-3.5931 -0.2252  0.0172  0.2588  2.4468 

Coefficients:
                Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)    -1.572873   0.026004  -60.48   &lt;2e-16 ***
log10(GeneSum)  0.709829   0.006448  110.08   &lt;2e-16 ***
---
Signif. codes:  0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1

Residual standard error: 0.4542 on 10321 degrees of freedom
Multiple R-squared:   0.54, Adjusted R-squared:   0.54 
F-statistic: 1.212e+04 on 1 and 10321 DF,  p-value: &lt; 2.2e-16</code></pre>
<pre class="r"><code>cor.test(log10(TXN_abund_combLibs_tot_n0_noPYRUF$TPM),log10(TXN_abund_combLibs_tot_n0_noPYRUF$GeneSum),method=&quot;spearman&quot;)</code></pre>
<pre><code>Warning in cor.test.default(log10(TXN_abund_combLibs_tot_n0_noPYRUF$TPM), :
Cannot compute exact p-value with ties</code></pre>
<pre><code>
    Spearman&#39;s rank correlation rho

data:  log10(TXN_abund_combLibs_tot_n0_noPYRUF$TPM) and log10(TXN_abund_combLibs_tot_n0_noPYRUF$GeneSum)
S = 4.5925e+10, p-value &lt; 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.7495161 </code></pre>
</div>
</div>
<div id="create-mapping-pheno" class="section level3">
<h3>Create mapping pheno</h3>
<p>Now I can create the File ID file I will use to make the phenotype</p>
<p>create_fileid_AnnotatedCluster_total.py</p>
<pre class="bash"><code>fout = open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/file_id_mapping_total_AnnotatedCluster_head.txt&quot;,&#39;w&#39;)
infile= open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.fc&quot;, &quot;r&quot;)
for line, i in enumerate(infile):
    if line == 0:
        i_list=i.split()
        files= i_list[10:-2]
        for each in files:
            full = each.split(&quot;/&quot;)[7]
            samp= full.split(&quot;-&quot;)[2:4]
            lim=&quot;_&quot;
            samp_st=lim.join(samp)
            outLine= full[:-1] + &quot;\t&quot; + samp_st
            fout.write(outLine + &quot;\n&quot;)
fout.close()</code></pre>
<p>I need to remove the first lines of these files:</p>
<pre class="bash"><code>awk &#39;{if (NR!=1) {print}}&#39; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/file_id_mapping_total_AnnotatedCluster_head.txt &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/file_id_mapping_total_AnnotatedCluster.txt
</code></pre>
<p>I want to use the filtered peaks for the QTL analysis so I can write out the FC filtered file.</p>
<pre class="r"><code>total_Cov_filt=total_Cov[keep.exprs_T,]


#write.table(total_Cov_filt, file=&quot;../data/LianoglouLCL/AnnotatedClusters.Total.fixed.filtered.fc&quot;, quote=F, col.names = T, row.names = F)</code></pre>
<p>I need to manually remove the X that was added to the header. I then copy this file to the /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/ directory.</p>
<p>I dont have thier gene file. I can have the phenotpye stay the start and end of the peaks for the QTL analysis. This means I will be calling QTLs 1mb around the start of the peak.</p>
<p>makePheno_AnnotatedClusters_Total.py</p>
<pre class="bash"><code>#PYTHON 3

dic_IND = {}
dic_BAM = {}

for ln in open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/file_id_mapping_total_AnnotatedCluster.txt&quot;):
    bam, IND = ln.split()
    IND = IND.strip()
    dic_IND[bam] = IND
    if IND not in dic_BAM:
        dic_BAM[IND] = []
    dic_BAM[IND].append(bam)


#now I have ind dic with keys as the bam and ind as the values
#I also have a bam dic with ind as the keys and bam as the values  
    
inds=list(dic_BAM.keys()) #list of ind libraries  

#list of genes   

count_file=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered.fc&quot;, &quot;r&quot;)
genes=[]
for line , i in enumerate(count_file):
    if line &gt; 1:
        i_list=i.split()
        id=i_list[0]
        id_list=id.split(&quot;:&quot;)
        gene=id_list[5]
        if gene not in genes:
            genes.append(gene)
            
#make the ind and gene dic  
dic_dub={}
for g in genes:
    dic_dub[g]={}
    for i in inds:
        dic_dub[g][i]=0


#populate the dictionary  
count_file=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered.fc&quot;, &quot;r&quot;)
for line, i in enumerate(count_file):
    if line &gt; 1:
        i_list=i.split()
        id=i_list[0]
        id_list=id.split(&quot;:&quot;)
        g= id_list[5]
        values=list(i_list[6:])
        list_list=[]
        for ind,val in zip(inds, values):
            list_list.append([ind, val])
        for num, name in enumerate(list_list):
            dic_dub[g][list_list[num][0]] += int(list_list[num][1])
        

#write the file by acessing the dictionary and putting values in the table ver the value in the dic 
        

fout=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt&quot;,&quot;w&quot;)
peak=[&quot;chrom&quot;]
inds_noL=[]
for each in inds:
    indsNA= &quot;NA&quot; + each[:-2]
    inds_noL.append(indsNA)  
fout.write(&quot; &quot;.join(peak + inds_noL) + &#39;\n&#39; )
count_file=open(&quot;/project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered.fc&quot;, &quot;r&quot;)
for line , i in enumerate(count_file):
    if line &gt; 1:
        i_list=i.split()
        id=i_list[0]
        id_list=id.split(&quot;:&quot;)
        gene=id_list[5]
        buff=[id]
        start=int(id_list[2])
        end=int(id_list[3])
        buff=[]
        buff.append(&quot;chr%s:%d:%d:%s_%s_%s&quot;%(id_list[1], start, end, id_list[5], id_list[4], id_list[0]))
        for x,y in zip(i_list[6:], inds):
            b=int(dic_dub[gene][y])
            t=int(x)
            buff.append(&quot;%d/%d&quot;%(t,b))
        fout.write(&quot; &quot;.join(buff)+ &#39;\n&#39;)
        
fout.close()</code></pre>
<p>Make a script to run this:</p>
<p>run_makePhen_AnnotatedCluster.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=run_makePhen_AnnotatedCluster
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=run_makePhen_AnnotatedCluster.out
#SBATCH --error=run_makePhen_AnnotatedCluster.err
#SBATCH --partition=broadwl
#SBATCH --mem=12G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

python makePheno_AnnotatedClusters_Total.py 
</code></pre>
<p>Use leafcutter to prepare this for fastQTL</p>
<pre class="bash"><code>module load samtools
#zip file 
gzip /project2/gilad/briana/threeprimeseq/data/c/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt 

module load python
#leafcutter script
python /project2/gilad/briana/threeprimeseq/code/prepare_phenotype_table.py /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz

#source activate three-prime-env
sh /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz_prepare.sh


#keep only 2 PCs
head -n 3 AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.PCs &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.2PCs
</code></pre>
<p>Sample list for Fastqtl is /project2/gilad/briana/threeprimeseq/data/phenotypes_filtPeakTranscript/SAMPLE.txt</p>
</div>
<div id="run-fastqtl" class="section level3">
<h3>Run FastQTL</h3>
<p>APAqtl_nominal_annotatedClusters.sh</p>
<pre class="bash"><code>#!/bin/bash


#SBATCH --job-name=APAqtl_nominal_transcript
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=APAqtl_nominal_transcript.out
#SBATCH --error=APAqtl_nominal_transcript.err
#SBATCH --partition=broadwl
#SBATCH --mem=12G
#SBATCH --mail-type=END


for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
do
/home/brimittleman/software/bin/FastQTL/bin/fastQTL.static --vcf /project2/gilad/briana/YRI_geno_hg19/chr$i.dose.filt.vcf.gz --cov /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.2PCs --bed /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.qqnorm_chr$i.gz --out /project2/gilad/briana/threeprimeseq/data/nominal_APAqtl_Annotated/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.qqnorm_chr$i.nominal.out --chunk 1 1  --window 5e5 --include-samples /project2/gilad/briana/threeprimeseq/data/phenotypes_filtPeakTranscript/SAMPLE.txt
done
</code></pre>
<p>APAqtl_permuted_annotatedClusters.sh</p>
<pre class="bash"><code>#!/bin/bash


#SBATCH --job-name=APAqtl_permuted_annotatedClusters
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=APAqtl_permuted_annotatedClusters.out
#SBATCH --error=APAqtl_permuted_annotatedClusters.err
#SBATCH --partition=broadwl
#SBATCH --mem=12G
#SBATCH --mail-type=END

for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
do
/home/brimittleman/software/bin/FastQTL/bin/fastQTL.static --permute 1000 --vcf /project2/gilad/briana/YRI_geno_hg19/chr$i.dose.filt.vcf.gz --cov /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.2PCs --bed /project2/gilad/briana/threeprimeseq/data/LianoglouLCL_quant/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.qqnorm_chr$i.gz --out /project2/gilad/briana/threeprimeseq/data/perm_APAqtl_Annotated/AnnotatedClusters.Total.fixed.filtered_pheno_Total.txt.gz.qqnorm_chr$i.perm.out --chunk 1 1  --window 5e5 --include-samples /project2/gilad/briana/threeprimeseq/data/phenotypes_filtPeakTranscript/SAMPLE.txt
done</code></pre>
<p>APAqtlpermCorrectQQplot_Annotated.R</p>
<pre class="r"><code>library(dplyr)


##total results
tot.perm= read.table(&quot;/project2/gilad/briana/threeprimeseq/data/perm_APAqtl_Annotated/AnnotatedClusters.Total.fixed.filtered_pheno_Total_permRes.txt&quot;,head=F, stringsAsFactors=F, col.names = c(&quot;pid&quot;, &quot;nvar&quot;, &quot;shape1&quot;, &quot;shape2&quot;, &quot;dummy&quot;, &quot;sid&quot;, &quot;dist&quot;, &quot;npval&quot;, &quot;slope&quot;, &quot;ppval&quot;, &quot;bpval&quot;))

#BH correction
tot.perm$bh=p.adjust(tot.perm$bpval, method=&quot;fdr&quot;)

#plot qqplot
png(&quot;/project2/gilad/briana/threeprimeseq/output/plots/qqplot_total_APAperm_AnnotatedClusters.png&quot;) 
qqplot_total= qqplot(-log10(runif(nrow(tot.perm))), -log10(tot.perm$bpval),ylab=&quot;-log10 Total permuted pvalue&quot;, xlab=&quot;Uniform expectation&quot;, main=&quot;Total permuted pvalues for all snps with Annotated Clusters&quot;)
abline(0,1)
dev.off()

#write df with BH  

write.table(tot.perm, file = &quot;/project2/gilad/briana/threeprimeseq/data/perm_APAqtl_Annotated/AnnotatedClusters.Total.fixed.filtered_pheno_Total_permRes.BH.txt&quot;, col.names = T, row.names = F, quote = F)</code></pre>
<p>run_APAqtlpermCorrectQQplot_Annotated.sh</p>
<pre class="bash"><code>#!/bin/bash


#SBATCH --job-name=run_APAqtlpermCorrectQQplot_Annotated
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=run_APAqtlpermCorrectQQplot_Annotated.out
#SBATCH --error=run_APAqtlpermCorrectQQplot_Annotated.err
#SBATCH --partition=broadwl
#SBATCH --mem=12G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


Rscript APAqtlpermCorrectQQplot_Annotated.R</code></pre>
<pre class="r"><code>tot.perm= read.table(&quot;../data/LianoglouLCL/AnnotatedClusters.Total.fixed.filtered_pheno_Total_permRes.BH.txt&quot;,head=T, stringsAsFactors=F)

plot(tot.perm$ppval, tot.perm$bpval, xlab=&quot;Direct method&quot;, ylab=&quot;Beta approximation&quot;, main=&quot;Total Check plot&quot;)
abline(0, 1, col=&quot;red&quot;)</code></pre>
<p><img src="figure/CompareLianoglouData.Rmd/unnamed-chunk-46-1.png" width="672" style="display: block; margin: auto;" /></p>
<pre class="r"><code>tot_qtl_10= tot.perm %&gt;% filter(-log10(bh) &gt; 1) %&gt;% nrow()
tot_qtl_10</code></pre>
<pre><code>[1] 149</code></pre>
</div>
<div id="use-deeptools-to-look-at-enrichment-at-these-peaks" class="section level3">
<h3>Use deeptools to look at enrichment at these peaks</h3>
<p><a href="https://brimittleman.github.io/Net-seq/use_deeptools.html" class="uri">https://brimittleman.github.io/Net-seq/use_deeptools.html</a></p>
<p>I can reuse code from the analysis above.</p>
<p>I want to merge the total and nuclear bam files then convert them to bw.</p>
<p>mergebamfiles.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=mergebamfiles
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=mergebamfiles.out
#SBATCH --error=mergebamfiles.err
#SBATCH --partition=broadwl
#SBATCH --mem=36G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

#total  

samtools merge /project2/gilad/briana/threeprimeseq/data/mergedBams/Total_MergedBams.bam  /project2/gilad/briana/threeprimeseq/data/sort/*T-combined-sort.bam 

#nuclear  
samtools merge /project2/gilad/briana/threeprimeseq/data/mergedBams/Nuclear_MergedBams.bam  /project2/gilad/briana/threeprimeseq/data/sort/*N-combined-sort.bam   </code></pre>
<p>sort and index the bams</p>
<p>SortIndexMergedBams.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=SortIndexMergedBams
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=SortIndexMergedBams.out
#SBATCH --error=SortIndexMergedBams.err
#SBATCH --partition=broadwl
#SBATCH --mem=36G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


samtools sort /project2/gilad/briana/threeprimeseq/data/mergedBams/Total_MergedBams.bam &gt; /project2/gilad/briana/threeprimeseq/data/mergedBams/Total_MergedBams.sort.bam

samtools index /project2/gilad/briana/threeprimeseq/data/mergedBams/Total_MergedBams.sort.bam

samtools sort /project2/gilad/briana/threeprimeseq/data/mergedBams/Nuclear_MergedBams.bam &gt; /project2/gilad/briana/threeprimeseq/data/mergedBams/Nuclear_MergedBams.sort.bam

samtools index /project2/gilad/briana/threeprimeseq/data/mergedBams/Nuclear_MergedBams.sort.bam
</code></pre>
<p>Create bw from each</p>
<p>mergeBam2BW.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=mergeBam2BW
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=mergeBam2BW.out
#SBATCH --error=mergeBam2BW.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

#total  
bamCoverage -b /project2/gilad/briana/threeprimeseq/data/mergedBams/Total_MergedBams.sort.bam -o /project2/gilad/briana/threeprimeseq/data/mergedBW/Total_MergedBamCoverage.bw  

#nuclear  
bamCoverage -b /project2/gilad/briana/threeprimeseq/data/mergedBams/Nuclear_MergedBams.sort.bam -o /project2/gilad/briana/threeprimeseq/data/mergedBW/Nuclear_MergedBamCoverage.bw    
</code></pre>
<p>Make a deep tools plot by computing the matrix then making the plot:</p>
<p>totalDTPlotLianoglouData.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=totalDTPlotLianoglouData.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=totalDTPlotLianoglouData.sh.out
#SBATCH --error=totalDTPlotLianoglouData.sh.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Total_MergedBamCoverage.bw -R /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_tabsep.bed -b 1000 -a 1000 -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Total_LianoglouOKPeaks.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Total_LianoglouOKPeaks.gz -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Total_LianoglouOKPeaks.png</code></pre>
<p>not recongiizing /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR.bed</p>
<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;)  }&#39; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort.bed &gt; /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_tabsep.bed
</code></pre>
<p>Do this with the nuclear as well.</p>
<p>nucelarDTPlotLianoglouData.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=nuclearDTPlotLianoglouData.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=nuclearDTPlotLianoglouData.sh.out
#SBATCH --error=nuclearDTPlotLianoglouData.sh.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Nuclear_MergedBamCoverage.bw -R /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_tabsep.bed -b 1000 -a 1000 --outFileName /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Nuclear_LianoglouOKPeaks.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Nuclear_LianoglouOKPeaks.gz --outFileName /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Nuclear_LianoglouOKPeaks.png
</code></pre>
<p>I can do this in the same plot by making the matrix with both:</p>
<p>BothFracDTPlotLianoglouData.sh</p>
<pre class="bash"><code>
#!/bin/bash

#SBATCH --job-name=BothFracDTPlotLianoglouData.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=BothFracDTPlotLianoglouData.out
#SBATCH --error=BothFracDTPlotLianoglouData.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Total_MergedBamCoverage.bw /project2/gilad/briana/threeprimeseq/data/mergedBW/Nuclear_MergedBamCoverage.bw -R /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_tabsep.bed -b 1000 -a 1000  -~out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_LianoglouOKPeaks.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_LianoglouOKPeaks.gz --refPointLabel &quot;Annotated PAS&quot; --plotTitle &quot;Combined Reads at annotated PAS&quot;  --heatmapHeight 7 --colorMap YlGnBu  -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_LianoglouOKPeaks.png
</code></pre>
<p>–regionsLabel</p>
<p>As a control, I will make a plot using the TSS of genes. I will do this at a transcript level with the file ncbiRefSeq.mRNA.named_noCHR.bed. If the transcript is on the positive strand the TSS is the start and the start +1. If the transcript is on the negative strand the TSS is the end-1 and the end. I can make a bed file in python.</p>
<p>refseqTSS.py</p>
<pre class="bash"><code>inFile=open(&quot;/project2/gilad/briana/genome_anotation_data/ncbiRefSeq.mRNA.named_noCHR.bed&quot;,&quot;r&quot;)
outFile=open(&quot;/project2/gilad/briana/genome_anotation_data/ncbiRefSeq.mRNA.transcriptTSS.bed&quot;, &quot;w&quot;)

for ln in inFile:
  chrom, start, end, transcript, gene, strand = ln.split()
  if strand ==&quot;+&quot;:
    start_i=int(start)
    end_i=int(start)+1
    outFile.write(&quot;%s\t%d\t%d\t%s\t%s\t%s\n&quot;%(chrom,start_i,end_i, transcript, gene, strand))
  else:
    start_i=int(end)-1
    end_i=int(end)
    outFile.write(&quot;%s\t%d\t%d\t%s\t%s\t%s\n&quot;%(chrom,start_i,end_i, transcript, gene, strand))
outFile.close</code></pre>
<p>Use this in deeptools command.</p>
<p>totalDTPlotTSS.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=totalDTPlotTSS.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=totalDTPlotTSS.out
#SBATCH --error=totalDTPlotTSS.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Total_MergedBamCoverage.bw -R /project2/gilad/briana/genome_anotation_data/ncbiRefSeq.mRNA.transcriptTSS.bed -b 1000 -a 1000 -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Total_RefSeqTSS.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Total_RefSeqTSS.gz -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Total_RefSeqTSS.png</code></pre>
<p>Do this with the nuclear as well.</p>
<p>nuclearDTPlotTSS.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=nuclearDTPlotTSS.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=nuclearDTPlotTSS.out
#SBATCH --error=nuclearDTPlotTSS.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env

computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Nuclear_MergedBamCoverage.bw -R /project2/gilad/briana/genome_anotation_data/ncbiRefSeq.mRNA.transcriptTSS.bed -b 1000 -a 1000 -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Nuclear_RefSeqTSS.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Nuclear_RefSeqTSS.gz -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/Nuclear_RefSeqTSS.png
</code></pre>
<p>Make both of these on the same plot like I did for the annotated clusters.</p>
<p>BothFracDTPlotTSS.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=BothFracDTPlotTSS.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=BothFracDTPlotTSS.out
#SBATCH --error=BothFracDTPlotTSS.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Total_MergedBamCoverage.bw /project2/gilad/briana/threeprimeseq/data/mergedBW/Nuclear_MergedBamCoverage.bw -R /project2/gilad/briana/genome_anotation_data/ncbiRefSeq.mRNA.transcriptTSS.bed -b 1000 -a 1000  -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_RefSeqTSS.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_RefSeqTSS.gz --refPointLabel &quot;TSS&quot; --plotTitle &quot;Combined Reads at TSS&quot; --regionsLabel &quot;RefSeq Transcript&quot; --heatmapHeight 7 --colorMap YlGnBu  -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_RefseqTSS.png
</code></pre>
<p>I should also do this with our peaks. Then we will have all of them to compare:</p>
<p>BothFracDTPlotmyPeaks.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=BothFracDTPlotmyPeaks.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=BothFracDTPlotmyPeaks.out
#SBATCH --error=BothFracDTPlotmyPeaks.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/mergedBW/Total_MergedBamCoverage.bw /project2/gilad/briana/threeprimeseq/data/mergedBW/Nuclear_MergedBamCoverage.bw -R /project2/gilad/briana/threeprimeseq/data/mergedPeaks_comb/filtered_APApeaks_merged_allchrom_refseqTrans.noties_sm.fixed.bed -b 1000 -a 1000  --out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_myPeaks.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_myPeaks.gz --refPointLabel &quot;Called Peaks&quot; --plotTitle &quot;Combined Reads at All Called Peaks&quot; --heatmapHeight 7 --colorMap YlGnBu  -out /project2/gilad/briana/threeprimeseq/data/LianoglouDeepTools/BothFrac_myPeaks.png
</code></pre>
</div>
<div id="use-deeptools-to-make-the-same-plots-but-with-rna-seq" class="section level3">
<h3>Use Deeptools to make the same plots but with RNA seq</h3>
<p>First I need to merge the bam files.</p>
<p>mergeRNAseqbamfiles.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=mergeRNAseqbamfiles
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=mergeRNAseqbamfiles.out
#SBATCH --error=mergeRNAseqbamfiles.err
#SBATCH --partition=broadwl
#SBATCH --mem=36G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


samtools merge /project2/gilad/briana/threeprimeseq/data/rnaseq_bam/RNAseqGeuvadis_STAR_6samp_MergedBams.bam /project2/yangili1/LCL/RNAseqGeuvadisBams/RNAseqGeuvadis_STAR_184*.final.bam
</code></pre>
<p>Sort and index the bam file:</p>
<p>SortIndexRNAseqMergedBams.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=SortIndexRNAseqMergedBams
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=SortIndexRNAseqMergedBams.out
#SBATCH --error=SortIndexRNAseqMergedBams.err
#SBATCH --partition=broadwl
#SBATCH --mem=36G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


samtools sort /project2/gilad/briana/threeprimeseq/data/rnaseq_bam/RNAseqGeuvadis_STAR_6samp_MergedBams.bam &gt; /project2/gilad/briana/threeprimeseq/data/rnaseq_bam/RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bam

samtools index /project2/gilad/briana/threeprimeseq/data/rnaseq_bam/RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bam
</code></pre>
<p>Make BW file from the bam</p>
<p>mergeRNAseqBam2BW.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=mergeRNAseqBam2BW
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=mergeRNAseqBam2BW.out
#SBATCH --error=mergeRNAseqBam2BW.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


bamCoverage -b /project2/gilad/briana/threeprimeseq/data/rnaseq_bam/RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bam -o /project2/gilad/briana/threeprimeseq/data/rnaseq_bw//RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bw  
</code></pre>
<p>Run the 3 deeptools plots</p>
<p>RNAseqDTPlotLianoglouData.sh</p>
<pre class="bash"><code>
#!/bin/bash

#SBATCH --job-name=RNAseqDTPlotLianoglouData.sh.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=RNAseqDTPlotLianoglouData.out
#SBATCH --error=RNAseqDTPlotLianoglouData.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/rnaseq_bw//RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bw   -R /project2/gilad/briana/threeprimeseq/data/LianoglouLCL/SRR1005684.3pSites.highconfidence.ip.OK_noCHR_sort_tabsep.bed -b 1000 -a 1000  -out /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_LianoglouOKPeaks.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_LianoglouOKPeaks.gz --refPointLabel &quot;Annotated PAS&quot; --plotTitle &quot;Combined RNAseq Reads at annotated PAS&quot;  --heatmapHeight 7 --colorMap YlGnBu  -out /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_LianoglouOKPeaks.png
</code></pre>
<p>RNAseqDTPlotTSS.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=RNAseqDTPlotTSS.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=RNAseqDTPlotTSS.out
#SBATCH --error=RNAseqDTPlotTSS.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/rnaseq_bw//RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bw -R /project2/gilad/briana/genome_anotation_data/ncbiRefSeq.mRNA.transcriptTSS.bed -b 1000 -a 1000  -out /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_RefSeqTSS.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_RefSeqTSS.gz --refPointLabel &quot;TSS&quot; --plotTitle &quot;Combined RNAseq Reads at TSS&quot; --regionsLabel &quot;RefSeq Transcript&quot; --heatmapHeight 7 --colorMap YlGnBu  -out /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_RefSeqTSS.png  
</code></pre>
<p>RNAseqDTPlotmyPeaks.sh</p>
<pre class="bash"><code>#!/bin/bash

#SBATCH --job-name=RNAseqDTPlotmyPeaks.sh
#SBATCH --account=pi-yangili1
#SBATCH --time=24:00:00
#SBATCH --output=RNAseqDTPlotmyPeaks.out
#SBATCH --error=RNAseqDTPlotmyPeaks.err
#SBATCH --partition=bigmem2
#SBATCH --mem=100G
#SBATCH --mail-type=END

module load Anaconda3
source activate three-prime-env


computeMatrix reference-point -S /project2/gilad/briana/threeprimeseq/data/rnaseq_bw//RNAseqGeuvadis_STAR_6samp_MergedBams.sort.bw -R /project2/gilad/briana/threeprimeseq/data/mergedPeaks_comb/filtered_APApeaks_merged_allchrom_refseqTrans.noties_sm.fixed.bed -b 1000 -a 1000  -out /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_myPeaks.gz

plotHeatmap --sortRegions descend -m /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_myPeaks.gz --refPointLabel &quot;Called Peaks&quot; --plotTitle &quot;Combined RNAseq Reads at All Called Peaks&quot; --heatmapHeight 7 --colorMap YlGnBu  -out /project2/gilad/briana/threeprimeseq/data/rnaseq_deeptools/RNAseq_myPeaks.png
</code></pre>
</div>
</div>
<div id="session-information" class="section level2">
<h2>Session information</h2>
<pre class="r"><code>sessionInfo()</code></pre>
<pre><code>R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.1

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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] ggpubr_0.1.8    magrittr_1.5    bindrcpp_0.2.2  tximport_1.8.0 
 [5] edgeR_3.22.5    limma_3.36.5    forcats_0.3.0   stringr_1.3.1  
 [9] dplyr_0.7.6     purrr_0.2.5     readr_1.1.1     tidyr_0.8.1    
[13] tibble_1.4.2    ggplot2_3.0.0   tidyverse_1.2.1 workflowr_1.1.1

loaded via a namespace (and not attached):
 [1] locfit_1.5-9.1    tidyselect_0.2.4  haven_1.1.2      
 [4] lattice_0.20-35   colorspace_1.3-2  htmltools_0.3.6  
 [7] yaml_2.2.0        utf8_1.1.4        rlang_0.2.2      
[10] R.oo_1.22.0       pillar_1.3.0      glue_1.3.0       
[13] withr_2.1.2       R.utils_2.7.0     modelr_0.1.2     
[16] readxl_1.1.0      bindr_0.1.1       plyr_1.8.4       
[19] munsell_0.5.0     gtable_0.2.0      cellranger_1.1.0 
[22] rvest_0.3.2       R.methodsS3_1.7.1 evaluate_0.11    
[25] labeling_0.3      knitr_1.20        fansi_0.4.0      
[28] broom_0.5.0       Rcpp_0.12.19      scales_1.0.0     
[31] backports_1.1.2   jsonlite_1.5      hms_0.4.2        
[34] digest_0.6.17     stringi_1.2.4     grid_3.5.1       
[37] rprojroot_1.3-2   cli_1.0.1         tools_3.5.1      
[40] lazyeval_0.2.1    crayon_1.3.4      whisker_0.3-2    
[43] pkgconfig_2.0.2   MASS_7.3-50       xml2_1.2.0       
[46] lubridate_1.7.4   assertthat_0.2.0  rmarkdown_1.10   
[49] httr_1.3.1        rstudioapi_0.8    R6_2.3.0         
[52] nlme_3.1-137      git2r_0.23.0      compiler_3.5.1   </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.1.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>