<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />


<meta name="author" content="Ruqian Lyu" />


<title>Crossover-identification-with-sscocaller-and-comapr</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>
<script src="site_libs/navigation-1.1/codefolding.js"></script>
<script src="site_libs/accessible-code-block-0.0.1/empty-anchor.js"></script>
<link href="site_libs/anchor-sections-1.0/anchor-sections.css" rel="stylesheet" />
<script src="site_libs/anchor-sections-1.0/anchor-sections.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />

<link rel="icon" href="https://github.com/workflowr/workflowr-assets/raw/master/img/reproducible.png">
<!-- Add a small amount of space between sections. -->
<style type="text/css">
div.section {
  padding-top: 12px;
}
</style>

<style type="text/css">
  code{white-space: pre-wrap;}
  span.smallcaps{font-variant: small-caps;}
  span.underline{text-decoration: underline;}
  div.column{display: inline-block; vertical-align: top; width: 50%;}
  div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
  ul.task-list{list-style: none;}
    </style>


<style type="text/css">code{white-space: pre;}</style>
<style type="text/css" data-origin="pandoc">
code.sourceCode > span { display: inline-block; line-height: 1.25; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */

.sourceCode .row {
  width: 100%;
}
.sourceCode {
  overflow-x: auto;
}
.code-folding-btn {
  margin-right: -30px;
}
</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
  var sheets = document.styleSheets;
  for (var i = 0; i < sheets.length; i++) {
    if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
    try { var rules = sheets[i].cssRules; } catch (e) { continue; }
    for (var j = 0; j < rules.length; j++) {
      var rule = rules[j];
      // check if there is a div.sourceCode rule
      if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
      var style = rule.style.cssText;
      // check if color or background-color is set
      if (rule.style.color === '' && rule.style.backgroundColor === '') continue;
      // replace div.sourceCode by a pre.sourceCode rule
      sheets[i].deleteRule(j);
      sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
    }
  }
})();
</script>
<style type="text/css">
  pre:not([class]) {
    background-color: white;
  }
</style>


<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>




<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%;
}
.tabbed-pane {
  padding-top: 12px;
}
.html-widget {
  margin-bottom: 20px;
}
button.code-folding-btn:focus {
  outline: none;
}
summary {
  display: list-item;
}
</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;
}
.dropdown-submenu {
  position: relative;
}
.dropdown-submenu>.dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -6px;
  margin-left: -1px;
  border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
  display: block;
}
.dropdown-submenu>a:after {
  display: block;
  content: " ";
  float: right;
  width: 0;
  height: 0;
  border-color: transparent;
  border-style: solid;
  border-width: 5px 0 5px 5px;
  border-left-color: #cccccc;
  margin-top: 5px;
  margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
  border-left-color: #ffffff;
}
.dropdown-submenu.pull-left {
  float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
  left: -100%;
  margin-left: 10px;
  border-radius: 6px 0 6px 6px;
}
</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>

<!-- tabsets -->

<style type="text/css">
.tabset-dropdown > .nav-tabs {
  display: inline-table;
  max-height: 500px;
  min-height: 44px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.tabset-dropdown > .nav-tabs > li.active:before {
  content: "";
  font-family: 'Glyphicons Halflings';
  display: inline-block;
  padding: 10px;
  border-right: 1px solid #ddd;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
  content: "&#xe258;";
  border: none;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
  content: "";
  font-family: 'Glyphicons Halflings';
  display: inline-block;
  padding: 10px;
  border-right: 1px solid #ddd;
}

.tabset-dropdown > .nav-tabs > li.active {
  display: block;
}

.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
  border: none;
  display: inline-block;
  border-radius: 4px;
  background-color: transparent;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
  display: block;
  float: none;
}

.tabset-dropdown > .nav-tabs > li {
  display: none;
}
</style>

<!-- code folding -->
<style type="text/css">
.code-folding-btn { margin-bottom: 4px; }
</style>



<style type="text/css">

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

@media print {
.toc-content {
  /* see https://github.com/w3c/csswg-drafts/issues/4434 */
  float: right;
}
}

.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;
}

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


</style>



</head>

<body>


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


<!-- 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">REJY_2020_Spermtyping</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://gitlab.svi.edu.au/rlyu/rejy_2020_single-sperm-co-calling">
    <span class="fa fa-github"></span>
     
  </a>
</li>
      </ul>
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

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

<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button>
<ul class="dropdown-menu" style="min-width: 50px;">
<li><a id="rmd-show-all-code" href="#">Show All Code</a></li>
<li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li>
</ul>
</div>



<h1 class="title toc-ignore">Crossover-identification-with-sscocaller-and-comapr</h1>
<h4 class="author">Ruqian Lyu</h4>

</div>


<p>
<button type="button" class="btn btn-default btn-workflowr btn-workflowr-report" data-toggle="collapse" data-target="#workflowr-report">
<span class="glyphicon glyphicon-list" aria-hidden="true"></span> workflowr <span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span>
</button>
</p>
<div id="workflowr-report" class="collapse">
<ul class="nav nav-tabs">
<li class="active">
<a data-toggle="tab" href="#summary">Summary</a>
</li>
<li>
<a data-toggle="tab" href="#checks"> Checks <span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span> </a>
</li>
<li>
<a data-toggle="tab" href="#versions">Past versions</a>
</li>
</ul>
<div class="tab-content">
<div id="summary" class="tab-pane fade in active">
<p>
<strong>Last updated:</strong> 2021-05-14
</p>
<p>
<strong>Checks:</strong> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> 6 <span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span> 1
</p>
<p>
<strong>Knit directory:</strong> <code>~/Projects/rejy_2020_single-sperm-co-calling/</code> <span class="glyphicon glyphicon-question-sign" aria-hidden="true" title="This is the local directory in which the code in this file was executed."> </span>
</p>
<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> (version 1.6.2). The <em>Checks</em> tab describes the reproducibility checks that were applied when the results were created. The <em>Past versions</em> tab lists the development history.
</p>
<hr>
</div>
<div id="checks" class="tab-pane fade">
<div id="workflowr-checks" class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongRMarkdownfilestronguncommittedchanges"> <span class="glyphicon glyphicon-exclamation-sign text-danger" aria-hidden="true"></span> <strong>R Markdown file:</strong> uncommitted changes </a>
</p>
</div>
<div id="strongRMarkdownfilestronguncommittedchanges" class="panel-collapse collapse">
<div class="panel-body">
<p>The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run <code>wflow_publish</code> to commit the R Markdown file and build the HTML.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongEnvironmentstrongempty"> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> <strong>Environment:</strong> empty </a>
</p>
</div>
<div id="strongEnvironmentstrongempty" class="panel-collapse collapse">
<div class="panel-body">
<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>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongSeedstrongcodesetseed20190102code"> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> <strong>Seed:</strong> <code>set.seed(20190102)</code> </a>
</p>
</div>
<div id="strongSeedstrongcodesetseed20190102code" class="panel-collapse collapse">
<div class="panel-body">
<p>The command <code>set.seed(20190102)</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>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongSessioninformationstrongrecorded"> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> <strong>Session information:</strong> recorded </a>
</p>
</div>
<div id="strongSessioninformationstrongrecorded" class="panel-collapse collapse">
<div class="panel-body">
<p>Great job! Recording the operating system, R version, and package versions is critical for reproducibility.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongCachestrongnone"> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> <strong>Cache:</strong> none </a>
</p>
</div>
<div id="strongCachestrongnone" class="panel-collapse collapse">
<div class="panel-body">
<p>Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongFilepathsstrongrelative"> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> <strong>File paths:</strong> relative </a>
</p>
</div>
<div id="strongFilepathsstrongrelative" class="panel-collapse collapse">
<div class="panel-body">
<p>Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<p class="panel-title">
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongRepositoryversionstrongahrefhttpsgitlabsvieduaurlyurejy2020singlespermcocallingtree264a63473afba209c49e430667cb16d008a22998targetblank264a634a"> <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span> <strong>Repository version:</strong> <a href="https://gitlab.svi.edu.au/rlyu/rejy_2020_single-sperm-co-calling/tree/264a63473afba209c49e430667cb16d008a22998" target="_blank">264a634</a> </a>
</p>
</div>
<div id="strongRepositoryversionstrongahrefhttpsgitlabsvieduaurlyurejy2020singlespermcocallingtree264a63473afba209c49e430667cb16d008a22998targetblank264a634a" class="panel-collapse collapse">
<div class="panel-body">
<p>
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
</p>
<p>
The results in this page were generated with repository version <a href="https://gitlab.svi.edu.au/rlyu/rejy_2020_single-sperm-co-calling/tree/264a63473afba209c49e430667cb16d008a22998" target="_blank">264a634</a>. See the <em>Past versions</em> tab to see a history of the changes made to the R Markdown and HTML files.
</p>
<p>
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:
</p>
<pre><code>
Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  .DS_Store
    Untracked:  .Renviron
    Untracked:  .gitignore
    Untracked:  .snakemake/
    Untracked:  CTAGAGTCACCCAAAT-1/
    Untracked:  _workflowr.yml
    Untracked:  analysis/2020-11-17_REJY_forming-RangedSummarizedExperiment.Rmd
    Untracked:  analysis/2021-03-03_diagnostic-functions-comapr.Rmd
    Untracked:  analysis/BatchComparison-scCNV-2021-04-30.Rmd
    Untracked:  analysis/Crossover-identification-with-sscocaller-and-comapr.Rmd
    Untracked:  analysis/_site.yml
    Untracked:  analysis/figure/
    Untracked:  analysis/rejy.bib
    Untracked:  analysis/subsampled-wc522-crossovers_2021-05-04.Rmd
    Untracked:  code/checkChr15results.R
    Untracked:  code/compareCO.R
    Untracked:  code/knownCrossovers.R
    Untracked:  code/openBam
    Untracked:  code/openBam.nim
    Untracked:  code/plot_count.R
    Untracked:  code/possorted_bam.bam
    Untracked:  code/sscocaller
    Untracked:  code/sscocallerMulti
    Untracked:  code/testFileStream
    Untracked:  code/testFileStream.nim
    Untracked:  code/testLocalTp
    Untracked:  code/testLocalTp.nim
    Untracked:  code/testOpenVCF
    Untracked:  code/testOpenVCF.nim
    Untracked:  data/
    Untracked:  multi.log
    Untracked:  output/19_altCount.mtx
    Untracked:  output/19_header.mtx
    Untracked:  output/19_snpAnnot.txt
    Untracked:  output/19_totalCount.mtx
    Untracked:  output/19_vi.mtx
    Untracked:  output/19_viSegInO.txt
    Untracked:  output/AA-6_altCount.mtx
    Untracked:  output/AA-6_header.mtx
    Untracked:  output/AA-6_snpAnnot.txt
    Untracked:  output/AA-6_totalCount.mtx
    Untracked:  output/AA-6_vi.mtx
    Untracked:  output/AA-6_viSegInO.txt
    Untracked:  output/WC_522/
    Untracked:  output/WC_526/
    Untracked:  output/analysisRDS/
    Untracked:  output/chr15_altCount.mtx
    Untracked:  output/chr15_header.mtx
    Untracked:  output/chr15_snpAnnot.txt
    Untracked:  output/chr15_totalCount.mtx
    Untracked:  output/chr15_vi.mtx.gz
    Untracked:  output/chr15_viSegInO.txt
    Untracked:  output/chr19_altCount.mtx
    Untracked:  output/chr19_header.mtx
    Untracked:  output/chr19_snpAnnot.txt
    Untracked:  output/chr19_totalCount.mtx
    Untracked:  output/chr19_vi.mtx
    Untracked:  output/chr19_viSegInO.txt
    Untracked:  output/figures/
    Untracked:  output/firstBatch/
    Untracked:  output/new-chr15_altCount.mtx
    Untracked:  output/new-chr15_header.mtx
    Untracked:  output/new-chr15_snpAnnot.txt
    Untracked:  output/new-chr15_totalCount.mtx
    Untracked:  output/new-chr15_vi.mtx
    Untracked:  output/new-chr15_viSegInO.txt
    Untracked:  output/nohup.out
    Untracked:  output/outputR/
    Untracked:  output/secondBatch/
    Untracked:  output/test-chr15_altCount.mtx
    Untracked:  output/test-chr15_header.mtx
    Untracked:  output/test-chr15_snpAnnot.txt
    Untracked:  output/test-chr15_totalCount.mtx
    Untracked:  output/test-chr15_vi.mtx
    Untracked:  output/test-chr15_viSegInO.txt
    Untracked:  percell.wc522.af.corange.chr1.pdf
    Untracked:  percell.wc522.af.corange.chr10.pdf
    Untracked:  percell.wc522.af.corange.chr11.pdf
    Untracked:  percell.wc522.af.corange.chr12.pdf
    Untracked:  percell.wc522.af.corange.chr13.pdf
    Untracked:  percell.wc522.af.corange.chr14.pdf
    Untracked:  percell.wc522.af.corange.chr15.pdf
    Untracked:  percell.wc522.af.corange.chr16.pdf
    Untracked:  percell.wc522.af.corange.chr17.pdf
    Untracked:  percell.wc522.af.corange.chr18.pdf
    Untracked:  percell.wc522.af.corange.chr19.pdf
    Untracked:  percell.wc522.af.corange.chr2.pdf
    Untracked:  percell.wc522.af.corange.chr3.pdf
    Untracked:  percell.wc522.af.corange.chr4.pdf
    Untracked:  percell.wc522.af.corange.chr5.pdf
    Untracked:  percell.wc522.af.corange.chr6.pdf
    Untracked:  percell.wc522.af.corange.chr7.pdf
    Untracked:  percell.wc522.af.corange.chr8.pdf
    Untracked:  percell.wc522.af.corange.chr9.pdf
    Untracked:  percell.wc522.af.corange.pdf
    Untracked:  percell/
    Untracked:  references/
    Untracked:  rejy_2020_single-sperm-co-calling.Rproj
    Untracked:  runCompareCO.out
    Untracked:  runScaNBC.out
    Untracked:  runSscal.out
    Untracked:  run_compareCO.snk
    Untracked:  run_scalBc.snk
    Untracked:  run_scalability.snk
    Untracked:  run_sscocaller.snk
    Untracked:  run_sscocallerSec.snk
    Untracked:  runsSclog.out
    Untracked:  runsscocaller.log.out
    Untracked:  runssscocallerSec.out
    Untracked:  runssscocallersub.out
    Untracked:  runsubedWC522.out
    Untracked:  single.log
    Untracked:  slurm-86395.out
    Untracked:  slurm-86396.out
    Untracked:  slurm-86397.out
    Untracked:  slurm-86398.out
    Untracked:  slurm-86399.out
    Untracked:  slurm-86400.out
    Untracked:  slurm-86401.out
    Untracked:  slurm-86402.out
    Untracked:  slurm-86403.out
    Untracked:  slurm-86404.out
    Untracked:  slurm-86405.out
    Untracked:  slurm-86406.out
    Untracked:  slurm-86407.out
    Untracked:  slurm-86408.out
    Untracked:  slurm-86409.out
    Untracked:  slurm-86410.out
    Untracked:  slurm-86411.out
    Untracked:  slurm-86412.out
    Untracked:  slurm-86413.out
    Untracked:  slurm-86414.out
    Untracked:  slurm-86415.out
    Untracked:  slurm-86416.out
    Untracked:  slurm-86418.out
    Untracked:  slurm-86419.out
    Untracked:  slurm-86420.out
    Untracked:  slurm-86421.out
    Untracked:  slurm-86422.out
    Untracked:  slurm-86423.out
    Untracked:  slurm-86424.out
    Untracked:  slurm-86425.out
    Untracked:  slurm-86426.out
    Untracked:  slurm-86427.out
    Untracked:  slurm-86428.out
    Untracked:  slurm-86429.out
    Untracked:  slurm-86430.out
    Untracked:  slurm-86431.out
    Untracked:  slurm-86432.out
    Untracked:  slurm-86433.out
    Untracked:  slurm-86434.out
    Untracked:  slurm-86435.out
    Untracked:  slurm-86436.out
    Untracked:  slurm-86437.out
    Untracked:  slurm-86438.out
    Untracked:  slurm-86439.out
    Untracked:  slurm-86440.out
    Untracked:  slurm-86441.out
    Untracked:  slurm-86442.out
    Untracked:  slurm-86443.out
    Untracked:  slurm-86444.out
    Untracked:  slurm-86445.out
    Untracked:  slurm-86446.out
    Untracked:  slurm-86447.out
    Untracked:  slurm-86448.out
    Untracked:  slurm-86449.out
    Untracked:  slurm-86450.out
    Untracked:  slurm-86451.out
    Untracked:  slurm-86452.out
    Untracked:  slurm-86453.out
    Untracked:  slurm-86454.out
    Untracked:  slurm-86455.out
    Untracked:  slurm-86456.out
    Untracked:  slurm-86457.out
    Untracked:  slurm-86458.out
    Untracked:  slurm-86459.out
    Untracked:  slurm-86460.out
    Untracked:  slurm-86461.out
    Untracked:  slurm-86462.out
    Untracked:  slurm-86463.out
    Untracked:  slurm-86464.out
    Untracked:  slurm-86465.out
    Untracked:  slurm-86466.out
    Untracked:  slurm-86467.out
    Untracked:  slurm-86468.out
    Untracked:  slurm-86470.out
    Untracked:  slurm-86471.out
    Untracked:  slurm-86472.out
    Untracked:  slurm-86473.out
    Untracked:  slurm-86474.out
    Untracked:  slurm-86475.out
    Untracked:  slurm-86476.out
    Untracked:  slurm-86477.out
    Untracked:  slurm-86478.out
    Untracked:  slurm-86479.out
    Untracked:  slurm-86480.out
    Untracked:  slurm-86482.out
    Untracked:  slurm-86483.out
    Untracked:  slurm-86484.out
    Untracked:  slurm-86485.out
    Untracked:  slurm-86486.out
    Untracked:  slurm-86487.out
    Untracked:  slurm-86488.out
    Untracked:  slurm-86489.out
    Untracked:  slurm-86490.out
    Untracked:  slurm-86491.out
    Untracked:  slurm-86492.out
    Untracked:  slurm-86493.out
    Untracked:  slurm-86494.out
    Untracked:  slurm-86495.out
    Untracked:  slurm-86496.out
    Untracked:  slurm-86497.out
    Untracked:  slurm-86498.out
    Untracked:  slurm-86499.out
    Untracked:  slurm-86500.out
    Untracked:  slurm-86501.out
    Untracked:  slurm-86502.out
    Untracked:  slurm-86503.out
    Untracked:  slurm-86504.out
    Untracked:  slurm-86505.out
    Untracked:  slurm-86506.out
    Untracked:  slurm-86507.out
    Untracked:  slurm-86508.out
    Untracked:  slurm-86509.out
    Untracked:  slurm-86510.out
    Untracked:  slurm-86511.out
    Untracked:  slurm-86512.out
    Untracked:  slurm-86513.out
    Untracked:  somefile.txt
    Untracked:  submit-runMulti.sh
    Untracked:  submit-runSNK-hmm-CNV.sh
    Untracked:  submit-runScal.sh
    Untracked:  submit-runScalnbc.sh
    Untracked:  submit-runSingle.sh
    Untracked:  submit-runcompareco.sh
    Untracked:  submit-runsscocaller.sh
    Untracked:  submit-runsscocallerSec.sh
    Untracked:  submit-subsample-wc522.sh
    Untracked:  test/

Unstaged changes:
    Modified:   analysis/2020-11-17_REJY_CLT-method-and-output-explanation.Rmd
    Modified:   analysis/2020-11-17_REJY_CLT-method-and-output-explanation.html
    Deleted:    analysis/Crossover-identification-example-dataset.Rmd
    Modified:   analysis/Individualized-genetic-map-using-sscocaller-comapr_2021-02-15.Rmd
    Modified:   analysis/Individualized-genetic-map-using-sscocaller-comapr_2021-04-28.Rmd
    Modified:   code/sscocaller.nim
    Modified:   code/sscocallerMulti.nim

Staged changes:
    New:        analysis/Crossover-identification-example-dataset.Rmd

</code></pre>
<p>
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.
</p>
</div>
</div>
</div>
</div>
<hr>
</div>
<div id="versions" class="tab-pane fade">
<p>
There are no past versions. Publish this analysis with <code>wflow_publish()</code> to start tracking its development.
</p>
<hr>
</div>
</div>
</div>
<div id="introduction" class="section level2">
<h2>Introduction</h2>
<p>We will demonstrate the usage of <a href="https://gitlab.svi.edu.au/biocellgen-public/sscocaller"><code>sscocaller</code></a> and <a href="https://github.com/ruqianl/comapr"><code>comapr</code></a> for identifying and visualising crossovers regions from single-sperm DNA sequencing dataset.</p>
<p><code>sscocaller</code>(<a href="https://gitlab.svi.edu.au/biocellgen-public/sscocaller" class="uri">https://gitlab.svi.edu.au/biocellgen-public/sscocaller</a>) applies a binomial Hidden Markov Model for inferring haplotypes of single sperm genomes from the aligned DNA reads in a BAM file. The inferred haplotype sequence can then be used for calling crossovers by identifying haplotype shifts (see <a href="https://github.com/ruqianl/comapr"><code>comapr</code></a> ).</p>
</div>
<div id="downloading-example-dataset" class="section level2">
<h2>Downloading example dataset</h2>
<p>An individual mouse genetic map was constructed by DNA sequencing of 217 sperm cells from a F1 hybrid mouse (B6 X CAST) <span class="citation">(Hinch et al. 2019)</span>. We will apply <code>sscocaller</code> on this dataset and it can be downloaded from GEO (Gene Expression Omnibus) with accession <a href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE125326">GSE125326</a></p>
<p>The slurm submission script <code>submit-wgetSRAFastqdump.sh</code> at <a href="https://gitlab.svi.edu.au/biocellgen-public/hinch-single-sperm-DNA-seq-processing.git">repo</a> can be used for downloading the <code>.sra</code> files and dumping them into paired fastq files for each sperm (including two bulk sperm samples).</p>
</div>
<div id="dataset-preprocessing" class="section level2">
<h2>Dataset preprocessing</h2>
<div id="alignment" class="section level3">
<h3>1 Alignment</h3>
<p>The downloaded fastq files for each sperm cells (and the bulk sperm samples) were aligned to mouse reference genome mm10. The workflow <a href="https://gitlab.svi.edu.au/biocellgen-public/hinch-single-sperm-DNA-seq-processing.git"><code>run_alignment.snk</code></a> which is a <a href="https://snakemake.readthedocs.io/en/stable/">Snakemake</a> file that defined steps/rules including</p>
<ul>
<li>running <a href="https://github.com/OpenGene/fastp"><code>fastp</code></a> for filtering reads and adapter trimming</li>
<li>running <a href="https://github.com/lh3/minimap2"><code>minimap2</code></a> for mapping reads to reference genome mm10</li>
<li>running GATK MarkDuplicates</li>
<li>running GATK AddOrReplaceReadGroup</li>
<li>running sorting and indexing bam files using <code>samtools</code></li>
</ul>
</div>
<div id="subsample-reads-and-append-cb-tag" class="section level3">
<h3>2 Subsample reads and append CB tag</h3>
<p><code>sscocaller</code> is designed to process DNA reads with CB (cell barcode) tags from all single sperm cells stored in one BAM file. And to reduce some processing burdens, the mapped reads for each sperm were de-duplicated and subsamples to a fraction of 0.5.</p>
<p>In addition, before merging reads from each sperm, the CB (cell barcode, the SRR ID) tag was appended to each DNA read using <a href="https://github.com/ruqianl/appendCB">appendCB</a>. Refer to steps defined in <code>run_subsample.snk</code>.</p>
</div>
<div id="merge-single-sperm-bam-files-into-one-bam" class="section level3">
<h3>3 Merge single-sperm bam files into one Bam</h3>
<p><code>samtools</code> was used for merge CB-taged reads from all single sperm to one BAM file. See <code>submit-mergeBams.sh</code>.</p>
</div>
<div id="finding-informative-snp-markers" class="section level3">
<h3>4 Finding informative SNP markers</h3>
<p>The informative SNP markers are those SNPs which differ between the two mouse stains that were used to generate the F1 hybrid mouse (CAST and BL6). The following steps were applied which largely align with what has been described in the original paper <span class="citation">(Hinch et al. 2019)</span>.</p>
<p>The bulk sperm sample <code>SRR8454653</code> was used for calling de no vo variants for this mouse individual using GATK HaplotypeCaller. Only the HET SNPs with <code>MQ&gt;50</code> AND <code>DP&gt;10</code> AND <code>DP&lt;80</code> were kept. The SNPs were further filtered to only keep the positions which have been called as Homo_alternative <code>CAST_EiJ.mgp.v5.snps.dbSNP142.vcf.gz</code> downloaded from the dbsnp database from Mouse Genome Project<span class="citation">(Keane et al. 2011)</span>.</p>
</div>
</div>
<div id="running-sscocaller" class="section level2">
<h2>Running sscocaller</h2>
<p>With the DNA reads from each sperm were tagged and merged into one BAM file, we can run <code>sscocaller</code> for inferring the haplotype states against the list of informative SNP markers for each chromosome in each sperm.</p>
<p>The required input files are:</p>
<pre><code>mergedBam = &quot;output/alignment/mergedBam/mergedAll.bam&quot;,
vcfRef=&quot;output/variants/denovoVar/SRR8454653.mkdup.sort.rg.filter.snps.castVar.vcf.gz&quot;,
bcFile=&quot;output/alignment/mergedBam/mergedAll.bam.barcodes.txt&quot;</code></pre>
<p><code>run_sscocaller.snk</code> defines the rule for running <code>sscocaller</code> on each chromosome for sperm cells. The command line was:</p>
<pre><code>sscocaller --threads 4 --chrom &quot;chr1&quot; --chrName chr {input.mergedBam} \
           {input.vcfRef} {input.bcFile} --maxTotalReads 150 --maxDP 10 \
           sscocaller/hinch/hinch_
</code></pre>
</div>
<div id="output-files" class="section level2">
<h2>Output files</h2>
<p>The generated output files (for each chromosome, here showing chr1):</p>
<ul>
<li>hinch_chr1_altCount.mtx, sparse matrix file, containing the alternative allele counts (the CAST alleles)</li>
<li>hinch_chr1_totalCount.mtx, sparse matrix file, containing the total allele counts (the CAST + BL6 alleles)</li>
<li>hinch_chr1_vi.mtx, sparse matrix file, containing the inferred Viterbi state (haplotype state) for each chromosome against the list of SNP markers in "_snpAnnot.txt".</li>
<li>hinch_chr1_viSegInfo.txt, txt file, containing the inferred Viterbi state segments information. Details below</li>
<li>hinch_chr1_snpAnnot.txt, txt file, containing the row annotations (SNPs) for the above sparse matrices.</li>
</ul>
<p>**Note, the columns in these sparse matrices correspond to cells in the input <code>bcFile</code>.</p>
<p>**_viSegInfo.txt** contains summary statistics of inferred Viterbi state segments.</p>
<p>A Viterbi segment is defined by a list of consecutive SNPs having the same Viterbi state.</p>
<p>The columns in the _viSegInfo.txt are:</p>
<ul>
<li>ithSperm,</li>
<li>Starting SNP position,</li>
<li>Ending SNP position,</li>
<li>the number of SNPs supporting the segment</li>
<li>the log likelihood ratio of the Viterbi segment</li>
<li>the inferred hidden state</li>
</ul>
<p><strong>log likelihood ratio </strong></p>
<p>The loglikelihood ratio is calculated by taking the inferred log likelihood and subtract the reversed log likelihood.</p>
<p>For example, the segment with two SNPs in the figure below: <img src="../public/meta_images/ratio_ll.png" /> The numbers in brackets indicating the (alternative allele counts, total allele counts) aligned to the two SNP positions.</p>
<p>The inferred log likelihood can be expressed as:</p>
<p><span class="math display">\[
inferredLogll = log(Trans_L)+log(dbinom(3,4,0.9))+log(dbinom(4,4,0.9))+log(Trans_R)
\]</span> The reversed log likelihood is then:</p>
<p><span class="math display">\[
reversedLogll = log(noTrans_L)+log(dbinom(3,4,0.1))+log(dbinom(4,4,0.1))+log(noTrans_R)
\]</span> Hence the logllRatio:</p>
<p><span class="math display">\[
logllRatio = inferredLogll - reversedLogll
\]</span></p>
<p>A larger <code>logllRatio</code> indicating we are more confident with the inferred Viterbi states for markers in the segment.</p>
</div>
<div id="diagnosic-plots" class="section level2">
<h2>Diagnosic plots</h2>
<p>The output files from <code>sscocaller</code> can be directly parsed through <code>readHapState</code> function. However, we have a look at some cell-level metrics and segment-level metrics before we parse the <code>sscocaller</code> output files.</p>
<div id="per-cell-qc" class="section level3">
<h3>Per cell QC</h3>
<p>The function <code>perCellQC</code> generates cell-level metrics in a data.frame and the plots in a list.</p>
<p>We first identify the relevant file paths:</p>
<p><code>dataset_dir</code> is the ouput directory from running <code>sscocaller</code> and <code>barcodeFile_path</code> points to the file containing the list of cell barcodes.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a><span class="kw">suppressPackageStartupMessages</span>({</span>
<span id="cb3-2"><a href="#cb3-2"></a>  <span class="kw">library</span>(comapr)</span>
<span id="cb3-3"><a href="#cb3-3"></a>  <span class="kw">library</span>(ggplot2)</span>
<span id="cb3-4"><a href="#cb3-4"></a>  <span class="kw">library</span>(dplyr)</span>
<span id="cb3-5"><a href="#cb3-5"></a>  <span class="kw">library</span>(Gviz)</span>
<span id="cb3-6"><a href="#cb3-6"></a>  <span class="kw">library</span>(SummarizedExperiment)</span>
<span id="cb3-7"><a href="#cb3-7"></a>})</span></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a>path_dir &lt;-<span class="st"> &quot;/mnt/beegfs/mccarthy/scratch/general/Datasets/Hinch2019/&quot;</span></span>
<span id="cb4-2"><a href="#cb4-2"></a>dataset_dir &lt;-<span class="st"> </span><span class="kw">paste0</span>(path_dir,<span class="st">&quot;output/alignment/sscocaller/hinch/&quot;</span>)</span>
<span id="cb4-3"><a href="#cb4-3"></a>barcodeFile_path &lt;-<span class="kw">paste0</span>(path_dir,<span class="st">&quot;output/alignment/mergedBam/mergedAll.bam.barcodes.txt&quot;</span>)</span></code></pre></div>
<p>We can list the files to have a look:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a><span class="kw">list.files</span>(<span class="dt">path=</span>dataset_dir)[<span class="dv">1</span><span class="op">:</span><span class="dv">5</span>]</span></code></pre></div>
<pre><code>[1] &quot;hinch_chr1_altCount.mtx&quot;   &quot;hinch_chr1_snpAnnot.txt&quot;  
[3] &quot;hinch_chr1_totalCount.mtx&quot; &quot;hinch_chr1_vi.mtx&quot;        
[5] &quot;hinch_chr1_viSegInfo.txt&quot; </code></pre>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a>BiocParallel<span class="op">::</span><span class="kw">register</span>(BiocParallel<span class="op">::</span><span class="kw">MulticoreParam</span>(<span class="dt">workers =</span> <span class="dv">2</span>))</span>
<span id="cb7-2"><a href="#cb7-2"></a><span class="co">#BiocParallel::register(BiocParallel::SerialParam())</span></span></code></pre></div>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1"></a>pcqc &lt;-<span class="st"> </span><span class="kw">perCellChrQC</span>(<span class="st">&quot;hinch&quot;</span>,</span>
<span id="cb8-2"><a href="#cb8-2"></a>                     <span class="dt">chroms=</span><span class="kw">paste0</span>(<span class="st">&quot;chr&quot;</span>,<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>),</span>
<span id="cb8-3"><a href="#cb8-3"></a>                     <span class="dt">path=</span>dataset_dir,</span>
<span id="cb8-4"><a href="#cb8-4"></a>                     <span class="dt">barcodeFile=</span>barcodeFile_path)</span></code></pre></div>
<p>The generated plot:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1"></a>pcqc<span class="op">$</span>plot</span></code></pre></div>
<pre><code>Warning: Transformation introduced infinite values in continuous x-axis</code></pre>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-6-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>X-axis plots the number of haplotype transitions (<code>nCORaw</code>) for each cell and Y-axis plots the number of total SNPs detected in a cell. A large <code>nCORaw</code> might indicate the cell being a diploid cell included by accident or doublets. Cells with a lower <code>totalSNPs</code> might indicate poor cell quality.</p>
<p>A data.frame with cell-level metric is also returned:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1"></a>pcqc<span class="op">$</span>cellQC</span></code></pre></div>
<pre><code># A tibble: 776 x 4
   Chrom totalSNP nCORaw barcode   
   &lt;fct&gt;    &lt;int&gt;  &lt;dbl&gt; &lt;chr&gt;     
 1 chr1    293471     30 SRR8454655
 2 chr2    263514     21 SRR8454655
 3 chr3    241774     21 SRR8454655
 4 chr4    223045     32 SRR8454655
 5 chr1    363924     31 SRR8454656
 6 chr2    301028     29 SRR8454656
 7 chr3    260600     36 SRR8454656
 8 chr4    250873     18 SRR8454656
 9 chr1    349103     26 SRR8454665
10 chr2    302099      9 SRR8454665
# … with 766 more rows</code></pre>
</div>
<div id="persegchrqc" class="section level3">
<h3>perSegChrQC</h3>
<p><code>PerSegQC</code> function visualises statistics of inferred haplotype state segments, which helps decide filtering thresholds for removing crossovers that do not have enough evidence by the data and the very close double crossovers which are biologically unlikely.</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1"></a>psqc &lt;-<span class="st"> </span><span class="kw">perSegChrQC</span>(<span class="st">&quot;hinch&quot;</span>,<span class="dt">chroms=</span><span class="kw">paste0</span>(<span class="st">&quot;chr&quot;</span>,<span class="dv">1</span>),</span>
<span id="cb13-2"><a href="#cb13-2"></a>                    <span class="dt">path=</span>dataset_dir,</span>
<span id="cb13-3"><a href="#cb13-3"></a>                    <span class="dt">barcodeFile=</span>barcodeFile_path,</span>
<span id="cb13-4"><a href="#cb13-4"></a>                    <span class="dt">maxRawCO =</span> <span class="dv">30</span>)</span>
<span id="cb13-5"><a href="#cb13-5"></a>psqc<span class="op">+</span><span class="kw">theme_classic</span>()</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-8-1.png" width="672" style="display: block; margin: auto;" /></p>
</div>
</div>
<div id="parsing-files-using-comapr" class="section level2">
<h2>Parsing files using <code>comapr</code></h2>
<p>Now we have some idea about the features of this dataset, we can read in the files from <code>sscocaller</code> which can be directly parsed through <code>readHapState</code> function. This function returns a <code>RangedSummarizedExperiment</code> object with <code>rowRanges</code> containing SNP positions that have ever contributed to crossovers in a cell, while <code>colData</code> contains the cell annotations such as barcodes.</p>
<p>The following filters have been applied:</p>
<ul>
<li>Segment level filters:
<ul>
<li>minSNP=30, the segment that results in one/two crossovers has to have more than 30 SNPs of support</li>
<li>minlogllRatio=150, the segment that results in one/two crossovers has to have logllRatio larger than 150.</li>
<li>bpDist=1e5, the segment that results in one/two crossovers has to have base pair distances larger than 1e5</li>
</ul></li>
<li>Cell level filters:
<ul>
<li>maxRawCO, the maximum number of raw crossovers (the number of state transitions from the _vi.mtx file) for a cell</li>
<li>minCellSNP=200, there have to be more than 200 SNPs detected within a cell, otherwise this cell is removed.</li>
</ul></li>
</ul>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1"></a>hinch_rse &lt;-<span class="st"> </span><span class="kw">readHapState</span>(<span class="dt">sampleName =</span> <span class="st">&quot;hinch&quot;</span>,</span>
<span id="cb14-2"><a href="#cb14-2"></a>                          <span class="dt">path =</span> dataset_dir,</span>
<span id="cb14-3"><a href="#cb14-3"></a>                          <span class="dt">chrom=</span><span class="kw">paste0</span>(<span class="st">&quot;chr&quot;</span>,<span class="dv">1</span><span class="op">:</span><span class="dv">19</span>),</span>
<span id="cb14-4"><a href="#cb14-4"></a>                          <span class="dt">barcodeFile =</span> barcodeFile_path,</span>
<span id="cb14-5"><a href="#cb14-5"></a>                          <span class="dt">minSNP =</span> <span class="dv">30</span>, <span class="dt">minCellSNP =</span> <span class="dv">200</span>,</span>
<span id="cb14-6"><a href="#cb14-6"></a>                          <span class="dt">maxRawCO =</span> <span class="dv">55</span>,</span>
<span id="cb14-7"><a href="#cb14-7"></a>                          <span class="dt">minlogllRatio =</span> <span class="dv">150</span>,</span>
<span id="cb14-8"><a href="#cb14-8"></a>                          <span class="dt">bpDist =</span> <span class="fl">1e5</span>)</span>
<span id="cb14-9"><a href="#cb14-9"></a><span class="kw">saveRDS</span>(hinch_rse,<span class="dt">file =</span> <span class="st">&quot;output/outputR/analysisRDS/hinch_rse.rds&quot;</span>)</span></code></pre></div>
<p>The <code>hinch_rse</code> object:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1"></a>hinch_rse</span></code></pre></div>
<pre><code>class: RangedSummarizedExperiment 
dim: 48542 160 
metadata(10): ithSperm Seg_start ... bp_dist barcode
assays(1): vi_state
rownames: NULL
rowData names(0):
colnames(160): SRR8454655 SRR8454656 ... SRR8454869 SRR8454870
colData names(1): barcodes</code></pre>
<p>The <code>rowRanges</code> of <code>hinch_rse</code></p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1"></a>SummarizedExperiment<span class="op">::</span><span class="kw">rowRanges</span>(hinch_rse)</span></code></pre></div>
<pre><code>GRanges object with 48542 ranges and 0 metadata columns:
          seqnames    ranges strand
             &lt;Rle&gt; &lt;IRanges&gt;  &lt;Rle&gt;
      [1]     chr1   3000258      *
      [2]     chr1   3001490      *
      [3]     chr1   3001712      *
      [4]     chr1   3001745      *
      [5]     chr1   3003414      *
      ...      ...       ...    ...
  [48538]    chr19  61324579      *
  [48539]    chr19  61325233      *
  [48540]    chr19  61325919      *
  [48541]    chr19  61327767      *
  [48542]    chr19  61330760      *
  -------
  seqinfo: 19 sequences from an unspecified genome; no seqlengths</code></pre>
<p>The <code>assay</code> slot contains the Viterbi state matrix (SNP by Cell):</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1"></a>SummarizedExperiment<span class="op">::</span><span class="kw">assay</span>(hinch_rse)[<span class="dv">1</span><span class="op">:</span><span class="dv">5</span>,<span class="dv">1</span><span class="op">:</span><span class="dv">5</span>]</span></code></pre></div>
<pre><code>5 x 5 sparse Matrix of class &quot;dgCMatrix&quot;
     SRR8454655 SRR8454656 SRR8454657 SRR8454658 SRR8454660
[1,]          .          .          .          .          .
[2,]          .          2          .          .          .
[3,]          .          .          .          .          .
[4,]          2          .          .          .          .
[5,]          .          .          .          .          .</code></pre>
<p><strong>Note</strong> this matrix is more <code>sparse</code> which only contains the SNPs that contribute to crossovers in cells.</p>
</div>
<div id="samples-group-factor" class="section level2">
<h2>Samples group factor</h2>
<p>We have sperm cells from only one individual in this dataset. However, to demonstrate the functions in <code>comapr</code> we split the cells into two groups.</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1"></a><span class="co">## set the first 80 cells as group1 and rest as group2</span></span>
<span id="cb21-2"><a href="#cb21-2"></a></span>
<span id="cb21-3"><a href="#cb21-3"></a></span>
<span id="cb21-4"><a href="#cb21-4"></a></span>
<span id="cb21-5"><a href="#cb21-5"></a><span class="kw">colData</span>(hinch_rse)<span class="op">$</span>sampleGroup &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="kw">rep</span>(<span class="st">&quot;Group1&quot;</span>,<span class="dv">80</span>),<span class="kw">rep</span>(<span class="st">&quot;Group2&quot;</span>,<span class="dv">80</span>))</span>
<span id="cb21-6"><a href="#cb21-6"></a></span>
<span id="cb21-7"><a href="#cb21-7"></a><span class="kw">colData</span>(hinch_rse)</span></code></pre></div>
<pre><code>DataFrame with 160 rows and 2 columns
              barcodes sampleGroup
           &lt;character&gt; &lt;character&gt;
SRR8454655  SRR8454655      Group1
SRR8454656  SRR8454656      Group1
SRR8454657  SRR8454657      Group1
SRR8454658  SRR8454658      Group1
SRR8454660  SRR8454660      Group1
...                ...         ...
SRR8454863  SRR8454863      Group2
SRR8454864  SRR8454864      Group2
SRR8454867  SRR8454867      Group2
SRR8454869  SRR8454869      Group2
SRR8454870  SRR8454870      Group2</code></pre>
<p><em>Note</em> <code>combineHapState</code> can be applied of there are multiple sets of outputs from <code>sscocaller</code>.</p>
</div>
<div id="count-crossovers-in-cells" class="section level2">
<h2>Count crossovers in cells</h2>
<p>The function <code>countCOs</code> can then be executed to find the crossover intervals and the number of crossovers for each cell within each crossover interval.</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1"></a>hinch_co_counts &lt;-<span class="st"> </span><span class="kw">countCOs</span>(hinch_rse)</span></code></pre></div>
<p>The SNP intervals list in the rowRanges slot:</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1"></a><span class="kw">rowRanges</span>(hinch_co_counts)</span></code></pre></div>
<pre><code>GRanges object with 2463 ranges and 0 metadata columns:
         seqnames            ranges strand
            &lt;Rle&gt;         &lt;IRanges&gt;  &lt;Rle&gt;
     [1]     chr1   7142337-7144676      *
     [2]     chr1 13416240-13419022      *
     [3]     chr1 20068925-20069169      *
     [4]     chr1 25464178-25472637      *
     [5]     chr1 28213896-28218311      *
     ...      ...               ...    ...
  [2459]    chr19 60044638-60047624      *
  [2460]    chr19 60069152-60070536      *
  [2461]    chr19 60070538-60070663      *
  [2462]    chr19 60070665-60073595      *
  [2463]    chr19 60374852-60375859      *
  -------
  seqinfo: 19 sequences from an unspecified genome; no seqlengths</code></pre>
<p>The <code>assay</code> slot of <code>hinch_co_counts</code> contains the number of crossovers per cell per SNP interval:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1"></a><span class="kw">assay</span>(hinch_co_counts)[<span class="dv">1</span><span class="op">:</span><span class="dv">5</span>,<span class="dv">1</span><span class="op">:</span><span class="dv">5</span>]</span></code></pre></div>
<pre><code>DataFrame with 5 rows and 5 columns
  SRR8454655 SRR8454656 SRR8454657 SRR8454658 SRR8454660
   &lt;numeric&gt;  &lt;numeric&gt;  &lt;numeric&gt;  &lt;numeric&gt;  &lt;numeric&gt;
1          0          0          0          0          0
2          0          0          0          0          0
3          0          0          0          0          1
4          0          0          0          0          0
5          0          0          0          0          0</code></pre>
</div>
<div id="plot-crossover-counts" class="section level2">
<h2>Plot crossover counts</h2>
<p>To get the number of crossovers per sperm cell, we just need to sum each column of the matrix in the <code>assay</code> slot. And the <code>plotCount</code> function plots the number of crossovers for each sperm.</p>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1"></a><span class="kw">plotCount</span>(hinch_co_counts)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-18-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>Or we can plotCount for each sample group:</p>
<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb29-1"><a href="#cb29-1"></a><span class="kw">plotCount</span>(hinch_co_counts, <span class="dt">group_by =</span> <span class="st">&quot;sampleGroup&quot;</span>)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-19-1.png" width="672" style="display: block; margin: auto;" /></p>
<p>In addition, we can also plot the number of crossovers per chromosome (with mean number of crossovers and standard error bar):</p>
<p>&lt;&lt;<Update to cumulative distribution plot>&gt;&gt;</p>
<div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1"></a><span class="kw">plotCount</span>(hinch_co_counts, <span class="dt">group_by =</span> <span class="st">&quot;sampleGroup&quot;</span>,<span class="dt">by_chr =</span> <span class="ot">TRUE</span>)<span class="op">+</span></span>
<span id="cb30-2"><a href="#cb30-2"></a><span class="st">  </span><span class="kw">theme</span>(<span class="dt">axis.text.x =</span> <span class="kw">element_text</span>(<span class="dt">angle=</span><span class="dv">90</span>))</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-20-1.png" width="1344" style="display: block; margin: auto;" /></p>
<div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb31-1"><a href="#cb31-1"></a><span class="kw">source</span>(<span class="st">&quot;code/plot_count.R&quot;</span>)</span>
<span id="cb31-2"><a href="#cb31-2"></a><span class="kw">plot_count</span>(hinch_co_counts, <span class="dt">by_chr =</span> <span class="ot">TRUE</span>,<span class="dt">plot_type =</span> <span class="st">&quot;hist&quot;</span>)<span class="op">+</span><span class="kw">theme_classic</span>()<span class="op">+</span><span class="kw">scale_y_log10</span>()</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-21-1.png" width="672" style="display: block; margin: auto;" /></p>
</div>
<div id="plot-snp-density-track" class="section level2">
<h2>Plot SNP density track</h2>
<p>The informative SNP markers’ distributions along the chromosome affects the crossover resolutions, therefore it is helpful to visulise the SNP density distribution.</p>
<p>We can generate the SNP density DataTrack with function <code>getSNPDensityTrack</code> which returns a <code>DataTrack</code> object from <code>Gviz</code> package.</p>
<div class="sourceCode" id="cb32"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb32-1"><a href="#cb32-1"></a><span class="co">## log=TRUE, the result after aggregation is returned on a log10 scale</span></span>
<span id="cb32-2"><a href="#cb32-2"></a></span>
<span id="cb32-3"><a href="#cb32-3"></a>snp_track_chr10 &lt;-<span class="st"> </span><span class="kw">getSNPDensityTrack</span>(<span class="dt">chrom =</span> <span class="st">&quot;chr10&quot;</span>,</span>
<span id="cb32-4"><a href="#cb32-4"></a>                                      <span class="dt">path_loc =</span> dataset_dir,</span>
<span id="cb32-5"><a href="#cb32-5"></a>                                      <span class="dt">sampleName =</span> <span class="st">&quot;hinch&quot;</span>,</span>
<span id="cb32-6"><a href="#cb32-6"></a>                                      <span class="dt">nwindow =</span> <span class="dv">80</span>,</span>
<span id="cb32-7"><a href="#cb32-7"></a>                                      <span class="dt">log =</span> <span class="ot">TRUE</span>,</span>
<span id="cb32-8"><a href="#cb32-8"></a>                                      <span class="dt">plot_type =</span> <span class="st">&quot;hist&quot;</span>)</span></code></pre></div>
<div class="sourceCode" id="cb33"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb33-1"><a href="#cb33-1"></a><span class="kw">plotTracks</span>(snp_track_chr10)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-23-1.png" width="672" style="display: block; margin: auto;" /> To change visualisation parameters we can use setPar:</p>
<div class="sourceCode" id="cb34"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb34-1"><a href="#cb34-1"></a>snp_track_chr10 &lt;-<span class="st"> </span><span class="kw">setPar</span>(snp_track_chr10,<span class="st">&quot;background.title&quot;</span>,<span class="st">&quot;firebrick&quot;</span>)</span></code></pre></div>
<pre><code>Note that the behaviour of the &#39;setPar&#39; method has changed. You need to reassign the result to an object for the side effects to happen. Pass-by-reference semantic is no longer supported.</code></pre>
<div class="sourceCode" id="cb36"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb36-1"><a href="#cb36-1"></a><span class="kw">plotTracks</span>(snp_track_chr10)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-24-1.png" width="672" style="display: block; margin: auto;" /> Change aggregation function to “sum”</p>
<div class="sourceCode" id="cb37"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb37-1"><a href="#cb37-1"></a>snp_track_chr10 &lt;-<span class="st"> </span><span class="kw">setPar</span>(snp_track_chr10,<span class="st">&quot;aggregation&quot;</span>,<span class="st">&quot;sum&quot;</span>)</span></code></pre></div>
<pre><code>Note that the behaviour of the &#39;setPar&#39; method has changed. You need to reassign the result to an object for the side effects to happen. Pass-by-reference semantic is no longer supported.</code></pre>
<div class="sourceCode" id="cb39"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb39-1"><a href="#cb39-1"></a><span class="kw">plotTracks</span>(snp_track_chr10)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-25-1.png" width="672" style="display: block; margin: auto;" /></p>
</div>
<div id="plot-mean-dp-read-depth-across-cells-for-each-chromosome" class="section level2">
<h2>Plot Mean DP (read depth) across cells for each chromosome</h2>
<div class="sourceCode" id="cb40"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb40-1"><a href="#cb40-1"></a>meanDP_track_chr10 &lt;-<span class="st"> </span><span class="kw">getMeanDPTrack</span>(<span class="dt">chrom =</span> <span class="st">&quot;chr10&quot;</span>,</span>
<span id="cb40-2"><a href="#cb40-2"></a>                            <span class="dt">path_loc =</span> dataset_dir,</span>
<span id="cb40-3"><a href="#cb40-3"></a>                            <span class="dt">nwindow =</span> <span class="dv">80</span>,</span>
<span id="cb40-4"><a href="#cb40-4"></a>                            <span class="dt">sampleName =</span><span class="st">&quot;hinch&quot;</span>,</span>
<span id="cb40-5"><a href="#cb40-5"></a>                            <span class="dt">barcodeFile=</span>barcodeFile_path,</span>
<span id="cb40-6"><a href="#cb40-6"></a>                            <span class="dt">plot_type =</span> <span class="st">&quot;hist&quot;</span>,</span>
<span id="cb40-7"><a href="#cb40-7"></a>                            <span class="dt">selectedBarcodes =</span> <span class="kw">colnames</span>(hinch_co_counts),</span>
<span id="cb40-8"><a href="#cb40-8"></a>                            <span class="dt">snp_track =</span> snp_track_chr10,</span>
<span id="cb40-9"><a href="#cb40-9"></a>                            <span class="dt">log =</span><span class="ot">TRUE</span>)</span></code></pre></div>
<div class="sourceCode" id="cb41"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb41-1"><a href="#cb41-1"></a><span class="kw">plotTracks</span>(meanDP_track_chr10)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-27-1.png" width="576" style="display: block; margin: auto;" /></p>
</div>
<div id="visulise-the-raw-alternative-frequency-af-plot-with-crossover-region-highlighted" class="section level2">
<h2>Visulise the raw Alternative Frequency (AF) plot with crossover region highlighted</h2>
<p>for the selected cell</p>
<p>We can select a cell and visulise the raw Alternative Frequency (AF) plot with the called crossover region highlighted.</p>
<div class="sourceCode" id="cb42"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1"></a>cell_af &lt;-<span class="st"> </span><span class="kw">getCellAFTrack</span>(<span class="dt">chrom =</span> <span class="st">&quot;chr10&quot;</span>,</span>
<span id="cb42-2"><a href="#cb42-2"></a>               <span class="dt">path_loc =</span> dataset_dir,</span>
<span id="cb42-3"><a href="#cb42-3"></a>               <span class="dt">sampleName =</span> <span class="st">&quot;hinch&quot;</span>,</span>
<span id="cb42-4"><a href="#cb42-4"></a>               <span class="dt">barcodeFile =</span> barcodeFile_path,</span>
<span id="cb42-5"><a href="#cb42-5"></a>               <span class="dt">nwindow =</span> <span class="dv">80</span>,</span>
<span id="cb42-6"><a href="#cb42-6"></a>               <span class="dt">snp_track =</span> snp_track_chr10,</span>
<span id="cb42-7"><a href="#cb42-7"></a>               <span class="dt">cellBarcode =</span> <span class="kw">colnames</span>(hinch_co_counts)[<span class="dv">1</span>],</span>
<span id="cb42-8"><a href="#cb42-8"></a>               <span class="dt">co_count =</span> hinch_co_counts,</span>
<span id="cb42-9"><a href="#cb42-9"></a>               <span class="dt">chunk =</span> 8000L)</span></code></pre></div>
<p>Generate a Highlight track with the returned list object <code>cell_af</code></p>
<div class="sourceCode" id="cb43"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb43-1"><a href="#cb43-1"></a>ht &lt;-<span class="st"> </span><span class="kw">HighlightTrack</span>(cell_af<span class="op">$</span>af_track,</span>
<span id="cb43-2"><a href="#cb43-2"></a>                     <span class="dt">range =</span> cell_af<span class="op">$</span>co_range[<span class="kw">seqnames</span>(cell_af<span class="op">$</span>co_range)<span class="op">==</span><span class="st">&quot;chr10&quot;</span>],</span>
<span id="cb43-3"><a href="#cb43-3"></a>                     <span class="dt">chromosome =</span> <span class="st">&quot;chr10&quot;</span>)</span>
<span id="cb43-4"><a href="#cb43-4"></a></span>
<span id="cb43-5"><a href="#cb43-5"></a><span class="kw">plotTracks</span>(ht)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-29-1.png" width="768" style="display: block; margin: auto;" /></p>
<p>Easily combined with <code>GenomeAxisTrack</code> and <code>IdeogramTrack</code></p>
<div class="sourceCode" id="cb44"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb44-1"><a href="#cb44-1"></a>gtrack &lt;-<span class="st"> </span><span class="kw">GenomeAxisTrack</span>()</span>
<span id="cb44-2"><a href="#cb44-2"></a>chr10_ideo &lt;-<span class="st"> </span><span class="kw">IdeogramTrack</span>(<span class="dt">genome =</span> <span class="st">&quot;mm10&quot;</span>, <span class="dt">chromosome =</span> <span class="st">&quot;chr10&quot;</span>)</span>
<span id="cb44-3"><a href="#cb44-3"></a><span class="kw">plotTracks</span>(<span class="kw">list</span>(chr10_ideo,gtrack, ht))</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-30-1.png" width="768" style="display: block; margin: auto;" /></p>
</div>
<div id="plot-snp-density-along-with-crossover-counts" class="section level2">
<h2>Plot SNP density along with crossover counts</h2>
<p>While one can get the DataTracks for the AF and the called crossover regions of a set of cells with <code>getAFTracks</code>, comapr also offers the function for plotting crossover counts for each cell or averaged crossover counts across sample groups.</p>
<div class="sourceCode" id="cb45"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb45-1"><a href="#cb45-1"></a>crossover_count_track &lt;-<span class="st"> </span><span class="kw">DataTrack</span>(<span class="dt">range =</span> <span class="kw">rowRanges</span>(hinch_co_counts),</span>
<span id="cb45-2"><a href="#cb45-2"></a>                       <span class="dt">genome =</span> <span class="st">&quot;mm10&quot;</span>,</span>
<span id="cb45-3"><a href="#cb45-3"></a>                       <span class="dt">data =</span> <span class="kw">data.frame</span>(<span class="kw">assay</span>(hinch_co_counts)),</span>
<span id="cb45-4"><a href="#cb45-4"></a>                       <span class="dt">name =</span> <span class="st">&quot;expected crossover counts across SNP intervals&quot;</span>,</span>
<span id="cb45-5"><a href="#cb45-5"></a>                       <span class="dt">type =</span> <span class="st">&quot;heatmap&quot;</span>,</span>
<span id="cb45-6"><a href="#cb45-6"></a>                       <span class="dt">groups =</span> hinch_co_counts<span class="op">$</span>sampleGroup,</span>
<span id="cb45-7"><a href="#cb45-7"></a>                       <span class="dt">col =</span> <span class="kw">c</span>(<span class="st">&quot;red&quot;</span>,<span class="st">&quot;blue&quot;</span>),</span>
<span id="cb45-8"><a href="#cb45-8"></a>                       <span class="co">#aggregateGroups = TRUE,</span></span>
<span id="cb45-9"><a href="#cb45-9"></a>                       <span class="dt">aggregation =</span> mean,</span>
<span id="cb45-10"><a href="#cb45-10"></a>                       <span class="dt">window =</span><span class="dv">80</span>)</span>
<span id="cb45-11"><a href="#cb45-11"></a></span>
<span id="cb45-12"><a href="#cb45-12"></a><span class="kw">plotTracks</span>(<span class="kw">list</span>(gtrack,snp_track_chr10,crossover_count_track),</span>
<span id="cb45-13"><a href="#cb45-13"></a>           <span class="dt">chromosome =</span> <span class="st">&quot;chr10&quot;</span>)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-31-1.png" width="768" style="display: block; margin: auto;" /></p>
<p><strong>Chromosome 10</strong></p>
<div class="sourceCode" id="cb46"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb46-1"><a href="#cb46-1"></a>crossover_count_track &lt;-<span class="st"> </span><span class="kw">DataTrack</span>(<span class="dt">range =</span> <span class="kw">rowRanges</span>(hinch_co_counts),</span>
<span id="cb46-2"><a href="#cb46-2"></a>                       <span class="dt">genome =</span> <span class="st">&quot;mm10&quot;</span>,</span>
<span id="cb46-3"><a href="#cb46-3"></a>                       <span class="dt">data =</span> <span class="kw">data.frame</span>(<span class="kw">assay</span>(hinch_co_counts)),</span>
<span id="cb46-4"><a href="#cb46-4"></a>                       <span class="dt">name =</span> <span class="st">&quot;Averaged crossover counts across windows&quot;</span>,</span>
<span id="cb46-5"><a href="#cb46-5"></a>                       <span class="dt">type =</span> <span class="st">&quot;heatmap&quot;</span>,</span>
<span id="cb46-6"><a href="#cb46-6"></a>                       <span class="dt">groups =</span> hinch_co_counts<span class="op">$</span>sampleGroup,</span>
<span id="cb46-7"><a href="#cb46-7"></a>                       <span class="dt">col =</span> <span class="kw">c</span>(<span class="st">&quot;red&quot;</span>,<span class="st">&quot;blue&quot;</span>),</span>
<span id="cb46-8"><a href="#cb46-8"></a>                       <span class="dt">aggregateGroups =</span> <span class="ot">TRUE</span>,</span>
<span id="cb46-9"><a href="#cb46-9"></a>                       <span class="dt">aggregation =</span> mean,</span>
<span id="cb46-10"><a href="#cb46-10"></a>                       <span class="dt">window =</span><span class="dv">80</span>)</span>
<span id="cb46-11"><a href="#cb46-11"></a></span>
<span id="cb46-12"><a href="#cb46-12"></a><span class="kw">plotTracks</span>(<span class="kw">list</span>(gtrack,snp_track_chr10,crossover_count_track),</span>
<span id="cb46-13"><a href="#cb46-13"></a>           <span class="dt">chromosome =</span> <span class="st">&quot;chr10&quot;</span>)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-32-1.png" width="768" style="display: block; margin: auto;" /></p>
<p><strong>Chromosome 1</strong></p>
<div class="sourceCode" id="cb47"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb47-1"><a href="#cb47-1"></a>snp_track_chr1 &lt;-<span class="st"> </span><span class="kw">getSNPDensityTrack</span>(<span class="dt">chrom =</span> <span class="st">&quot;chr1&quot;</span>,</span>
<span id="cb47-2"><a href="#cb47-2"></a>                                      <span class="dt">path_loc =</span> dataset_dir,</span>
<span id="cb47-3"><a href="#cb47-3"></a>                                      <span class="dt">sampleName =</span> <span class="st">&quot;hinch&quot;</span>,</span>
<span id="cb47-4"><a href="#cb47-4"></a>                                      <span class="dt">nwindow =</span> <span class="dv">80</span>,</span>
<span id="cb47-5"><a href="#cb47-5"></a>                                      <span class="dt">log =</span> <span class="ot">FALSE</span>,</span>
<span id="cb47-6"><a href="#cb47-6"></a>                                      <span class="dt">plot_type =</span> <span class="st">&quot;hist&quot;</span>)</span>
<span id="cb47-7"><a href="#cb47-7"></a></span>
<span id="cb47-8"><a href="#cb47-8"></a>snp_track_chr1 &lt;-<span class="st"> </span><span class="kw">setPar</span>(snp_track_chr1,<span class="st">&quot;background.title&quot;</span>,<span class="st">&quot;firebrick&quot;</span>)</span></code></pre></div>
<pre><code>Note that the behaviour of the &#39;setPar&#39; method has changed. You need to reassign the result to an object for the side effects to happen. Pass-by-reference semantic is no longer supported.</code></pre>
<div class="sourceCode" id="cb49"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb49-1"><a href="#cb49-1"></a><span class="kw">plotTracks</span>(<span class="kw">list</span>(gtrack,snp_track_chr1,crossover_count_track),</span>
<span id="cb49-2"><a href="#cb49-2"></a>           <span class="dt">chromosome =</span> <span class="st">&quot;chr1&quot;</span>)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-33-1.png" width="672" style="display: block; margin: auto;" /> ## Calculate Genetic distances from crossover rates</p>
<p>The raw crossover rates estimated from observed crossovers across SNP intervals for a group of samples are commonly converted into genetic distances in units of centiMorgans via mapping functions such as the Kosambi or the Haldane function.</p>
<ul>
<li><p>Haldane, cM =−0.5×ln(1−2r)×100</p></li>
<li><p>Kosambi, cM=0.25×ln ((1+2r)/(1−2r))×100</p></li>
<li><p>r is the recombination fraction.</p></li>
</ul>
<p>The Haldane mapping function adds mathematical adjustments to the recombination fraction. It assumes that crossover events are random and independent along the chromosome, and the number of crossover events between two loci follows a Poisson distribution. Haldane’s mapping function adjusts underestimated crossover rate in larger intervals that are likely to have unobserved even number of crossovers. Kosambi’s mapping function was derived based on Haldane’s and takes consideration of crossover interference.</p>
<p>We can calculate the genetic distances with the sperm dataset using <code>calGeneticDist</code> function:</p>
<div class="sourceCode" id="cb50"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb50-1"><a href="#cb50-1"></a><span class="co"># mapping_fun = &quot;k&quot; for applying the kosambi function</span></span>
<span id="cb50-2"><a href="#cb50-2"></a></span>
<span id="cb50-3"><a href="#cb50-3"></a>hinch_dist &lt;-<span class="st"> </span><span class="kw">calGeneticDist</span>(hinch_co_counts,</span>
<span id="cb50-4"><a href="#cb50-4"></a>                             <span class="dt">mapping_fun =</span> <span class="st">&quot;k&quot;</span>)</span></code></pre></div>
<p>The total genetic distances across the autosomes are then:</p>
<div class="sourceCode" id="cb51"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb51-1"><a href="#cb51-1"></a><span class="kw">sum</span>(<span class="kw">rowData</span>(hinch_dist)<span class="op">$</span>kosambi)</span></code></pre></div>
<pre><code>[1] 1198.204</code></pre>
<p>The genetic distances can also be calculated per sample group. It is useful for doing comparative analysis. We can also supply a <code>bin_size</code> parameter to get the genetic distances calcuated on binned chromosome intervals.</p>
<div class="sourceCode" id="cb53"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb53-1"><a href="#cb53-1"></a>hinch_dist_groups &lt;-<span class="st"> </span><span class="kw">calGeneticDist</span>(hinch_co_counts, <span class="dt">group_by =</span> <span class="st">&quot;sampleGroup&quot;</span>,</span>
<span id="cb53-2"><a href="#cb53-2"></a>                                    <span class="dt">bin_size =</span> <span class="fl">1e7</span>)</span></code></pre></div>
<p>The genetic distances per group can be derived as:</p>
<div class="sourceCode" id="cb54"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb54-1"><a href="#cb54-1"></a>Matrix<span class="op">::</span><span class="kw">colSums</span>(<span class="kw">as.matrix</span>(<span class="kw">mcols</span>(hinch_dist_groups)))</span></code></pre></div>
<pre><code>  Group1   Group2 
1225.251 1171.500 </code></pre>
<div id="plot-genetic-distances" class="section level3">
<h3>Plot genetic distances</h3>
<p>The genetic distances across chromosome bins can be visulised by <code>plotGeneticDist</code> function:</p>
<div class="sourceCode" id="cb56"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb56-1"><a href="#cb56-1"></a><span class="kw">plotGeneticDist</span>(hinch_dist_groups,<span class="dt">chr =</span> <span class="st">&quot;chr10&quot;</span>)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-38-1.png" width="672" style="display: block; margin: auto;" /></p>
<div class="sourceCode" id="cb57"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb57-1"><a href="#cb57-1"></a><span class="kw">plotGeneticDist</span>(hinch_dist_groups,<span class="dt">chr =</span> <span class="kw">c</span>(<span class="st">&quot;chr1&quot;</span>,<span class="st">&quot;chr2&quot;</span>))</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-39-1.png" width="672" style="display: block; margin: auto;" /></p>
<div class="sourceCode" id="cb58"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb58-1"><a href="#cb58-1"></a><span class="kw">plotGeneticDist</span>(hinch_dist_groups,<span class="dt">chr =</span> <span class="kw">c</span>(<span class="st">&quot;chr15&quot;</span>,<span class="st">&quot;chr16&quot;</span>))</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-39-2.png" width="672" style="display: block; margin: auto;" /></p>
<p>We can also do cumulative centiMorgans plots and the whole genome plot:</p>
<div class="sourceCode" id="cb59"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb59-1"><a href="#cb59-1"></a><span class="kw">plotGeneticDist</span>(hinch_dist_groups,<span class="dt">chr =</span> <span class="kw">c</span>(<span class="st">&quot;chr15&quot;</span>,<span class="st">&quot;chr16&quot;</span>),<span class="dt">cumulative =</span> <span class="ot">TRUE</span>)</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-40-1.png" width="672" style="display: block; margin: auto;" /></p>
<div class="sourceCode" id="cb60"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb60-1"><a href="#cb60-1"></a><span class="kw">plotWholeGenome</span>(hinch_dist_groups)<span class="op">+</span><span class="kw">theme</span>(<span class="dt">axis.text.x =</span> <span class="kw">element_text</span>(<span class="dt">angle =</span> <span class="dv">90</span>))</span></code></pre></div>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-41-1.png" width="1152" style="display: block; margin: auto;" /></p>
<p>The two sample groups are similar by looking at the cumulative centiMorgan growth curves of the two.</p>
</div>
</div>
<div id="group-comparison" class="section level2">
<h2>Group comparison</h2>
<p>The calculated total genetic distances for the two groups show that Group1 has slightly larger total genetic distances resulted from more meiotic crossovers observed.</p>
<p>To test whether the observed difference is statistically significant, we can apply Bootstrapping test to get confidence intervals of group differences and permutation testing for calculating a significance level.</p>
<p><strong>Bootstrapping</strong></p>
<div class="sourceCode" id="cb61"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb61-1"><a href="#cb61-1"></a><span class="kw">set.seed</span>(<span class="dv">100</span>)</span>
<span id="cb61-2"><a href="#cb61-2"></a>bootsResult &lt;-<span class="st"> </span><span class="kw">bootstrapDist</span>(hinch_co_counts,<span class="dt">group_by =</span> <span class="st">&quot;sampleGroup&quot;</span>,</span>
<span id="cb61-3"><a href="#cb61-3"></a>                             <span class="dt">B =</span><span class="dv">1000</span>)</span></code></pre></div>
<p>The 95% confidence intervals for the group differences by bootstrapping is then:</p>
<div class="sourceCode" id="cb62"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb62-1"><a href="#cb62-1"></a><span class="kw">quantile</span>(bootsResult,<span class="kw">c</span>(<span class="fl">0.025</span>,<span class="fl">0.975</span>))</span></code></pre></div>
<pre><code>     2.5%     97.5% 
-13.97571 126.09462 </code></pre>
<p>which includes zero thus the observed difference is not signifcant at level of 0.05.</p>
<p>The histogram of the bootstrapping results:</p>
<div class="sourceCode" id="cb64"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb64-1"><a href="#cb64-1"></a><span class="kw">ggplot</span>()<span class="op">+</span><span class="kw">geom_histogram</span>(<span class="dt">mapping =</span> <span class="kw">aes</span>(<span class="dt">x =</span> bootsResult))<span class="op">+</span><span class="kw">theme_classic</span>()</span></code></pre></div>
<pre><code>`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.</code></pre>
<p><img src="figure/Crossover-identification-with-sscocaller-and-comapr.Rmd/unnamed-chunk-44-1.png" width="672" style="display: block; margin: auto;" /></p>
<p><strong>Permutation</strong></p>
<p>We next apply permutation testing using the <code>permuteDist</code> function.</p>
<div class="sourceCode" id="cb66"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb66-1"><a href="#cb66-1"></a>perms &lt;-<span class="st"> </span><span class="kw">permuteDist</span>(hinch_co_counts,<span class="dt">group_by =</span> <span class="st">&quot;sampleGroup&quot;</span>,</span>
<span id="cb66-2"><a href="#cb66-2"></a>                     <span class="dt">B=</span><span class="dv">1000</span>)</span>
<span id="cb66-3"><a href="#cb66-3"></a>perms<span class="op">$</span>observed_diff</span></code></pre></div>
<pre><code>[1] 53.7508</code></pre>
<div class="sourceCode" id="cb68"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb68-1"><a href="#cb68-1"></a>perms<span class="op">$</span>nSample</span></code></pre></div>
<pre><code>[1] 80 80</code></pre>
<p>We can then use the <code>statmod::permp()</code> function <span class="citation">(Phipson and Smyth 2010)</span> to calculate an exact p-value for this set of permutation results:</p>
<div class="sourceCode" id="cb70"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb70-1"><a href="#cb70-1"></a>statmod<span class="op">::</span><span class="kw">permp</span>(<span class="dt">x =</span> <span class="kw">sum</span>(perms<span class="op">$</span>permutes<span class="op">&gt;</span><span class="st"> </span>perms<span class="op">$</span>observed_diff),</span>
<span id="cb70-2"><a href="#cb70-2"></a>               <span class="dt">nperm =</span> <span class="dv">1000</span>,</span>
<span id="cb70-3"><a href="#cb70-3"></a>               <span class="dt">n1 =</span> perms<span class="op">$</span>nSample[<span class="dv">1</span>],</span>
<span id="cb70-4"><a href="#cb70-4"></a>               <span class="dt">n2 =</span> perms<span class="op">$</span>nSample[<span class="dv">2</span>],</span>
<span id="cb70-5"><a href="#cb70-5"></a>               <span class="dt">twosided =</span> F)</span></code></pre></div>
<pre><code>[1] 0.1028971</code></pre>
</div>
<div id="conclusion" class="section level2">
<h2>Conclusion</h2>
<div id="refs">
<div id="ref-Hinch2019-dt">
<p>Hinch, Anjali G, Gang Zhang, Philipp W Becker, Daniela Moralli, Robert Hinch, Benjamin Davies, Rory Bowden, and Peter Donnelly. 2019. “Factors Influencing Meiotic Recombination Revealed by Whole-Genome Sequencing of Single Sperm.” <em>Science</em> 363 (6433).</p>
</div>
<div id="ref-Keane2011-be">
<p>Keane, Thomas M, Leo Goodstadt, Petr Danecek, Michael A White, Kim Wong, Binnaz Yalcin, Andreas Heger, et al. 2011. “Mouse Genomic Variation and Its Effect on Phenotypes and Gene Regulation.” <em>Nature</em> 477 (7364): 289–94.</p>
</div>
<div id="ref-Phipson2010-xi">
<p>Phipson, Belinda, and Gordon K Smyth. 2010. “Permutation P-Values Should Never Be Zero: Calculating Exact P-Values When Permutations Are Randomly Drawn.” <em>Stat. Appl. Genet. Mol. Biol.</em> 9 (October): Article39.</p>
</div>
</div>
<br>
<p>
<button type="button" class="btn btn-default btn-workflowr btn-workflowr-sessioninfo" data-toggle="collapse" data-target="#workflowr-sessioninfo" style="display: block;">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> Session information
</button>
</p>
<div id="workflowr-sessioninfo" class="collapse">
<div class="sourceCode" id="cb72"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb72-1"><a href="#cb72-1"></a>devtools<span class="op">::</span><span class="kw">session_info</span>()</span></code></pre></div>
<pre><code>─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.3 (2020-10-10)
 os       Red Hat Enterprise Linux    
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_AU.UTF-8                 
 ctype    en_AU.UTF-8                 
 tz       Australia/Melbourne         
 date     2021-05-14                  

─ Packages ───────────────────────────────────────────────────────────────────
 package              * version  date       lib source                         
 AnnotationDbi          1.52.0   2020-10-27 [1] Bioconductor                   
 AnnotationFilter       1.14.0   2020-10-27 [1] Bioconductor                   
 askpass                1.1      2019-01-13 [1] CRAN (R 4.0.2)                 
 assertthat             0.2.1    2019-03-21 [1] CRAN (R 4.0.2)                 
 backports              1.2.0    2020-11-02 [1] CRAN (R 4.0.2)                 
 base64enc              0.1-3    2015-07-28 [1] CRAN (R 4.0.2)                 
 Biobase              * 2.50.0   2020-10-27 [1] Bioconductor                   
 BiocFileCache          1.14.0   2020-10-27 [1] Bioconductor                   
 BiocGenerics         * 0.36.0   2020-10-27 [1] Bioconductor                   
 BiocParallel           1.24.0   2020-10-27 [1] Bioconductor                   
 biomaRt                2.46.0   2020-10-27 [1] Bioconductor                   
 Biostrings             2.58.0   2020-10-27 [1] Bioconductor                   
 biovizBase             1.38.0   2020-10-27 [1] Bioconductor                   
 bit                    4.0.4    2020-08-04 [1] CRAN (R 4.0.2)                 
 bit64                  4.0.5    2020-08-30 [1] CRAN (R 4.0.2)                 
 bitops                 1.0-6    2013-08-17 [1] CRAN (R 4.0.2)                 
 blob                   1.2.1    2020-01-20 [1] CRAN (R 4.0.2)                 
 BSgenome               1.58.0   2020-10-27 [1] Bioconductor                   
 callr                  3.5.1    2020-10-13 [1] CRAN (R 4.0.2)                 
 checkmate              2.0.0    2020-02-06 [1] CRAN (R 4.0.2)                 
 circlize               0.4.11   2020-10-31 [1] CRAN (R 4.0.3)                 
 cli                    2.1.0    2020-10-12 [1] CRAN (R 4.0.2)                 
 cluster                2.1.0    2019-06-19 [2] CRAN (R 4.0.3)                 
 codetools              0.2-16   2018-12-24 [2] CRAN (R 4.0.3)                 
 colorspace             1.4-1    2019-03-18 [1] CRAN (R 4.0.2)                 
 comapr               * 0.99.18  2021-05-12 [1] Github (ruqianl/comapr@6c39038)
 crayon                 1.3.4    2017-09-16 [1] CRAN (R 4.0.2)                 
 curl                   4.3      2019-12-02 [1] CRAN (R 4.0.2)                 
 data.table             1.13.2   2020-10-19 [1] CRAN (R 4.0.2)                 
 DBI                    1.1.0    2019-12-15 [1] CRAN (R 4.0.2)                 
 dbplyr                 2.0.0    2020-11-03 [1] CRAN (R 4.0.2)                 
 DelayedArray           0.16.0   2020-10-27 [1] Bioconductor                   
 desc                   1.2.0    2018-05-01 [1] CRAN (R 4.0.2)                 
 devtools               2.3.2    2020-09-18 [1] CRAN (R 4.0.2)                 
 dichromat              2.0-0    2013-01-24 [1] CRAN (R 4.0.3)                 
 digest                 0.6.27   2020-10-24 [1] CRAN (R 4.0.2)                 
 dplyr                * 1.0.2    2020-08-18 [1] CRAN (R 4.0.2)                 
 ellipsis               0.3.1    2020-05-15 [1] CRAN (R 4.0.2)                 
 ensembldb              2.14.0   2020-10-27 [1] Bioconductor                   
 evaluate               0.14     2019-05-28 [1] CRAN (R 4.0.2)                 
 fansi                  0.4.1    2020-01-08 [1] CRAN (R 4.0.2)                 
 farver                 2.0.3    2020-01-16 [1] CRAN (R 4.0.2)                 
 foreach                1.5.1    2020-10-15 [1] CRAN (R 4.0.3)                 
 foreign                0.8-80   2020-05-24 [2] CRAN (R 4.0.3)                 
 Formula                1.2-4    2020-10-16 [1] CRAN (R 4.0.3)                 
 fs                     1.5.0    2020-07-31 [1] CRAN (R 4.0.2)                 
 generics               0.1.0    2020-10-31 [1] CRAN (R 4.0.2)                 
 GenomeInfoDb         * 1.26.0   2020-10-27 [1] Bioconductor                   
 GenomeInfoDbData       1.2.4    2020-11-04 [1] Bioconductor                   
 GenomicAlignments      1.26.0   2020-10-27 [1] Bioconductor                   
 GenomicFeatures        1.42.0   2020-10-27 [1] Bioconductor                   
 GenomicRanges        * 1.42.0   2020-10-27 [1] Bioconductor                   
 ggplot2              * 3.3.2    2020-06-19 [1] CRAN (R 4.0.2)                 
 git2r                  0.27.1   2020-05-03 [1] CRAN (R 4.0.2)                 
 GlobalOptions          0.1.2    2020-06-10 [1] CRAN (R 4.0.3)                 
 glue                   1.4.2    2020-08-27 [1] CRAN (R 4.0.2)                 
 gridExtra              2.3      2017-09-09 [1] CRAN (R 4.0.2)                 
 gtable                 0.3.0    2019-03-25 [1] CRAN (R 4.0.2)                 
 Gviz                 * 1.34.1   2021-03-15 [1] Bioconductor                   
 Hmisc                  4.5-0    2021-02-28 [1] CRAN (R 4.0.3)                 
 hms                    0.5.3    2020-01-08 [1] CRAN (R 4.0.2)                 
 htmlTable              2.1.0    2020-09-16 [1] CRAN (R 4.0.3)                 
 htmltools              0.5.1.1  2021-01-22 [1] CRAN (R 4.0.3)                 
 htmlwidgets            1.5.2    2020-10-03 [1] CRAN (R 4.0.2)                 
 httpuv                 1.5.4    2020-06-06 [1] CRAN (R 4.0.2)                 
 httr                   1.4.2    2020-07-20 [1] CRAN (R 4.0.2)                 
 IRanges              * 2.24.0   2020-10-27 [1] Bioconductor                   
 iterators              1.0.13   2020-10-15 [1] CRAN (R 4.0.3)                 
 jpeg                   0.1-8.1  2019-10-24 [1] CRAN (R 4.0.3)                 
 jsonlite               1.7.1    2020-09-07 [1] CRAN (R 4.0.2)                 
 knitr                  1.30     2020-09-22 [1] CRAN (R 4.0.2)                 
 labeling               0.4.2    2020-10-20 [1] CRAN (R 4.0.2)                 
 later                  1.1.0.1  2020-06-05 [1] CRAN (R 4.0.2)                 
 lattice                0.20-41  2020-04-02 [2] CRAN (R 4.0.3)                 
 latticeExtra           0.6-29   2019-12-19 [1] CRAN (R 4.0.3)                 
 lazyeval               0.2.2    2019-03-15 [1] CRAN (R 4.0.2)                 
 lifecycle              0.2.0    2020-03-06 [1] CRAN (R 4.0.2)                 
 magrittr               1.5      2014-11-22 [1] CRAN (R 4.0.2)                 
 Matrix                 1.2-18   2019-11-27 [2] CRAN (R 4.0.3)                 
 MatrixGenerics       * 1.2.0    2020-10-27 [1] Bioconductor                   
 matrixStats          * 0.57.0   2020-09-25 [1] CRAN (R 4.0.2)                 
 memoise                1.1.0    2017-04-21 [1] CRAN (R 4.0.2)                 
 munsell                0.5.0    2018-06-12 [1] CRAN (R 4.0.2)                 
 nnet                   7.3-14   2020-04-26 [2] CRAN (R 4.0.3)                 
 openssl                1.4.3    2020-09-18 [1] CRAN (R 4.0.2)                 
 pillar                 1.4.6    2020-07-10 [1] CRAN (R 4.0.2)                 
 pkgbuild               1.1.0    2020-07-13 [1] CRAN (R 4.0.2)                 
 pkgconfig              2.0.3    2019-09-22 [1] CRAN (R 4.0.2)                 
 pkgload                1.1.0    2020-05-29 [1] CRAN (R 4.0.2)                 
 plotly                 4.9.2.1  2020-04-04 [1] CRAN (R 4.0.2)                 
 plyr                   1.8.6    2020-03-03 [1] CRAN (R 4.0.2)                 
 png                    0.1-7    2013-12-03 [1] CRAN (R 4.0.2)                 
 prettyunits            1.1.1    2020-01-24 [1] CRAN (R 4.0.2)                 
 processx               3.4.4    2020-09-03 [1] CRAN (R 4.0.2)                 
 progress               1.2.2    2019-05-16 [1] CRAN (R 4.0.2)                 
 promises               1.1.1    2020-06-09 [1] CRAN (R 4.0.2)                 
 ProtGenerics           1.22.0   2020-10-27 [1] Bioconductor                   
 ps                     1.4.0    2020-10-07 [1] CRAN (R 4.0.2)                 
 purrr                  0.3.4    2020-04-17 [1] CRAN (R 4.0.2)                 
 R6                     2.5.0    2020-10-28 [1] CRAN (R 4.0.2)                 
 rappdirs               0.3.1    2016-03-28 [1] CRAN (R 4.0.2)                 
 RColorBrewer           1.1-2    2014-12-07 [1] CRAN (R 4.0.2)                 
 Rcpp                   1.0.5    2020-07-06 [1] CRAN (R 4.0.2)                 
 RCurl                  1.98-1.2 2020-04-18 [1] CRAN (R 4.0.2)                 
 remotes                2.2.0    2020-07-21 [1] CRAN (R 4.0.2)                 
 reshape2               1.4.4    2020-04-09 [1] CRAN (R 4.0.2)                 
 rlang                  0.4.8    2020-10-08 [1] CRAN (R 4.0.2)                 
 rmarkdown              2.5      2020-10-21 [1] CRAN (R 4.0.2)                 
 rpart                  4.1-15   2019-04-12 [2] CRAN (R 4.0.3)                 
 rprojroot              1.3-2    2018-01-03 [1] CRAN (R 4.0.2)                 
 Rsamtools              2.6.0    2020-10-27 [1] Bioconductor                   
 RSQLite                2.2.1    2020-09-30 [1] CRAN (R 4.0.2)                 
 rstudioapi             0.11     2020-02-07 [1] CRAN (R 4.0.2)                 
 rtracklayer            1.50.0   2020-10-27 [1] Bioconductor                   
 S4Vectors            * 0.28.0   2020-10-27 [1] Bioconductor                   
 scales                 1.1.1    2020-05-11 [1] CRAN (R 4.0.2)                 
 sessioninfo            1.1.1    2018-11-05 [1] CRAN (R 4.0.2)                 
 shape                  1.4.5    2020-09-13 [1] CRAN (R 4.0.3)                 
 statmod                1.4.35   2020-10-19 [1] CRAN (R 4.0.2)                 
 stringi                1.5.3    2020-09-09 [1] CRAN (R 4.0.2)                 
 stringr                1.4.0    2019-02-10 [1] CRAN (R 4.0.2)                 
 SummarizedExperiment * 1.20.0   2020-10-27 [1] Bioconductor                   
 survival               3.2-7    2020-09-28 [2] CRAN (R 4.0.3)                 
 testthat               3.0.0    2020-10-31 [1] CRAN (R 4.0.2)                 
 tibble                 3.0.4    2020-10-12 [1] CRAN (R 4.0.2)                 
 tidyr                  1.1.2    2020-08-27 [1] CRAN (R 4.0.2)                 
 tidyselect             1.1.0    2020-05-11 [1] CRAN (R 4.0.2)                 
 usethis                1.6.3    2020-09-17 [1] CRAN (R 4.0.2)                 
 utf8                   1.1.4    2018-05-24 [1] CRAN (R 4.0.2)                 
 VariantAnnotation      1.36.0   2020-10-27 [1] Bioconductor                   
 vctrs                  0.3.4    2020-08-29 [1] CRAN (R 4.0.2)                 
 viridisLite            0.3.0    2018-02-01 [1] CRAN (R 4.0.2)                 
 withr                  2.3.0    2020-09-22 [1] CRAN (R 4.0.2)                 
 workflowr              1.6.2    2020-04-30 [1] CRAN (R 4.0.2)                 
 xfun                   0.19     2020-10-30 [1] CRAN (R 4.0.2)                 
 XML                    3.99-0.5 2020-07-23 [1] CRAN (R 4.0.2)                 
 xml2                   1.3.2    2020-04-23 [1] CRAN (R 4.0.2)                 
 XVector                0.30.0   2020-10-27 [1] Bioconductor                   
 yaml                   2.2.1    2020-02-01 [1] CRAN (R 4.0.2)                 
 zlibbioc               1.36.0   2020-10-27 [1] Bioconductor                   

[1] /mnt/beegfs/mccarthy/scratch/general/rlyu/Software/R/4.0/library
[2] /opt/R/4.0.3/lib/R/library</code></pre>
</div>
</div>


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


</div>
</div>

</div>

<script>

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


</script>

<!-- tabsets -->

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

$(document).ready(function () {
  $('.tabset-dropdown > .nav-tabs > li').click(function () {
    $(this).parent().toggleClass('nav-tabs-open')
  });
});
</script>

<!-- code folding -->
<script>
$(document).ready(function () {
  window.initializeCodeFolding("hide" === "show");
});
</script>

<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, '_');
      },
      ignoreSelector: ".toc-ignore",
      scrollTo: 0
    };
    options.showAndHide = true;
    options.smoothScroll = true;

    // tocify
    var toc = $("#TOC").tocify(options).data("toc-tocify");
});
</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>