Skip to content
Snippets Groups Projects
Crossover-identification-with-sscocaller-and-comapr.html 97.8 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 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
<!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>