Skip to content
Snippets Groups Projects
Crossover-identification-with-sscocaller-and-comapr.html 121 KiB
Newer Older
Ruqian Lyu's avatar
Ruqian Lyu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
<!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-25
Ruqian Lyu's avatar
Ruqian Lyu committed
</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
Ruqian Lyu's avatar
Ruqian Lyu committed
    Untracked:  analysis/test.Rmd
Ruqian Lyu's avatar
Ruqian Lyu committed
    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:  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/
Ruqian Lyu's avatar
Ruqian Lyu committed
    Untracked:  tt.pdf
Ruqian Lyu's avatar
Ruqian Lyu committed

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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p>The preprocessing steps include read filtering and mapping, subsample reads and append cell barcodes to reads, merge bams, and find informative SNP markers.</p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<div id="find-informative-snp-markers" class="section level3">
<h3>4 Find informative SNP markers</h3>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p><em>Note</em>, the columns in these sparse matrices correspond to cells in the input <code>bcFile</code>.</p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p>The columns in the <code>*_viSegInfo.txt</code> are:</p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p><strong>log likelihood ratio</strong></p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p>We can locate the files and list the files to have a look:</p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p>Running <code>perCellChrQC</code> function to find the cell-level statistics:</p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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>
Ruqian Lyu's avatar
Ruqian Lyu committed
<p>The generated scatter plots for selected chromosomes:</p>
Ruqian Lyu's avatar
Ruqian Lyu committed
<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          .          .          .