Skip to content

Commit

Permalink
NBDEV 8
Browse files Browse the repository at this point in the history
  • Loading branch information
straussmaximilian committed Nov 6, 2022
1 parent 556257b commit 80c3604
Show file tree
Hide file tree
Showing 22 changed files with 467 additions and 729 deletions.
20 changes: 4 additions & 16 deletions docs/additional_code.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,7 @@
<span class="navbar-title">alphapept</span>
</a>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav navbar-nav-scroll ms-auto">
<li class="nav-item compact">
<a class="nav-link" href="https://github.com/mannlabs/alphapept/tree/master/"><i class="bi bi-github" role="img">
</i>
</a>
</li>
</ul>
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /navcollapse -->
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /container-fluid -->
</nav>
<nav class="quarto-secondary-nav" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
Expand Down Expand Up @@ -220,17 +208,17 @@ <h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#gui" id="toc-gui" class="nav-link active" data-scroll-target="#gui">GUI</a>
<ul>
<ul class="collapse">
<li><a href="#adding-pages" id="toc-adding-pages" class="nav-link" data-scroll-target="#adding-pages">Adding pages</a></li>
</ul></li>
<li><a href="#ci-test" id="toc-ci-test" class="nav-link" data-scroll-target="#ci-test">CI test</a></li>
<li><a href="#sandbox" id="toc-sandbox" class="nav-link" data-scroll-target="#sandbox">Sandbox</a>
<ul>
<ul class="collapse">
<li><a href="#misc-notebooks" id="toc-misc-notebooks" class="nav-link" data-scroll-target="#misc-notebooks">Misc Notebooks</a></li>
</ul></li>
<li><a href="#installer" id="toc-installer" class="nav-link" data-scroll-target="#installer">Installer</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/mannlabs/alphapept/tree/master/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/mannlabs/alphapept/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">
Expand Down
42 changes: 15 additions & 27 deletions docs/chem.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,7 @@
<span class="navbar-title">alphapept</span>
</a>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav navbar-nav-scroll ms-auto">
<li class="nav-item compact">
<a class="nav-link" href="https://github.com/mannlabs/alphapept/tree/master/"><i class="bi bi-github" role="img">
</i>
</a>
</li>
</ul>
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /navcollapse -->
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /container-fluid -->
</nav>
<nav class="quarto-secondary-nav" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
Expand Down Expand Up @@ -285,23 +273,23 @@ <h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#isotopedistributions" id="toc-isotopedistributions" class="nav-link active" data-scroll-target="#isotopedistributions">IsotopeDistributions</a>
<ul>
<ul class="collapse">
<li><a href="#dict_to_dist" id="toc-dict_to_dist" class="nav-link" data-scroll-target="#dict_to_dist">dict_to_dist</a></li>
<li><a href="#numba_bin" id="toc-numba_bin" class="nav-link" data-scroll-target="#numba_bin">numba_bin</a></li>
<li><a href="#fast_add" id="toc-fast_add" class="nav-link" data-scroll-target="#fast_add">fast_add</a></li>
<li><a href="#isotopedistribution" id="toc-isotopedistribution" class="nav-link" data-scroll-target="#isotopedistribution">IsotopeDistribution</a></li>
</ul></li>
<li><a href="#averagine" id="toc-averagine" class="nav-link" data-scroll-target="#averagine">Averagine</a>
<ul>
<ul class="collapse">
<li><a href="#get_average_formula" id="toc-get_average_formula" class="nav-link" data-scroll-target="#get_average_formula">get_average_formula</a></li>
<li><a href="#mass_to_dist" id="toc-mass_to_dist" class="nav-link" data-scroll-target="#mass_to_dist">mass_to_dist</a></li>
</ul></li>
<li><a href="#mass-calculations" id="toc-mass-calculations" class="nav-link" data-scroll-target="#mass-calculations">Mass Calculations</a>
<ul>
<ul class="collapse">
<li><a href="#calculate_mass" id="toc-calculate_mass" class="nav-link" data-scroll-target="#calculate_mass">calculate_mass</a></li>
</ul></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/mannlabs/alphapept/tree/master/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/mannlabs/alphapept/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">
Expand All @@ -328,7 +316,7 @@ <h1 class="title d-none d-lg-block">Chem</h1>
</header>

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
<p>This notebook contains all chemistry-related functionality. Here, a major part is functionality to generate isotope patterns and the averagine model. This is required for feature finding, where an isotope pattern is validated by being compared to its averagine model. We use the data structure <code>Isotopes</code> from constants to handle Isotopes. Next, we define the class <a href="https://mannlabs.github.io/chem.html#isotopedistribution"><code>IsotopeDistribution</code></a> to calculate isotope distributions for a given Isotope. The core of the calculation is the function <a href="https://mannlabs.github.io/chem.html#fast_add"><code>fast_add</code></a>, which allows the fast estimation of isotope distributions. <br> To calculate the isotope distribution for the averagine model, we define the function <a href="https://mannlabs.github.io/chem.html#get_average_formula"><code>get_average_formula</code></a>, which calculates the amino acid composition of the averagine molecule for the given mass.</p>
<p>This notebook contains all chemistry-related functionality. Here, a major part is functionality to generate isotope patterns and the averagine model. This is required for feature finding, where an isotope pattern is validated by being compared to its averagine model. We use the data structure <code>Isotopes</code> from constants to handle Isotopes. Next, we define the class <a href="https://mannlabs.github.io/alphapept/chem.html#isotopedistribution"><code>IsotopeDistribution</code></a> to calculate isotope distributions for a given Isotope. The core of the calculation is the function <a href="https://mannlabs.github.io/alphapept/chem.html#fast_add"><code>fast_add</code></a>, which allows the fast estimation of isotope distributions. <br> To calculate the isotope distribution for the averagine model, we define the function <a href="https://mannlabs.github.io/alphapept/chem.html#get_average_formula"><code>get_average_formula</code></a>, which calculates the amino acid composition of the averagine molecule for the given mass.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
Expand All @@ -348,7 +336,7 @@ <h2 class="anchored" data-anchor-id="isotopedistributions">IsotopeDistributions<
<p>The implementation is a Python port of the Java version of the <a href="https://github.com/fickludd/proteomicore/blob/c5e311c21c3191fc007798391ce77066531f1932/Proteins/src/main/java/se/lth/immun/chem/IsotopeDistribution.java">proteomicore - implementation</a> from Johan Teleman</p>
<p>In brief, the approach avoids expanding polynomial expressions by combining precalculated patterns of hypothetical atom clusters and pruning low-intensity peaks. <br> To calculate the isotope distribution for a given isotope, we define the function <code>dict_to_dist,</code> which accepts a dictionary of amino acids and returns the isotope distribution.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/chem.py#L146" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/chem.py#L146" target="_blank" style="float:right; font-size:smaller">source</a></p>
<section id="dict_to_dist" class="level3">
<h3 class="anchored" data-anchor-id="dict_to_dist">dict_to_dist</h3>
<blockquote class="blockquote">
Expand All @@ -359,7 +347,7 @@ <h3 class="anchored" data-anchor-id="dict_to_dist">dict_to_dist</h3>
<p>Args: counted_AA (Dict): Numba-typed dict with counts of atoms. isotopes (Dict): Numba-typed lookup dict with isotopes.</p>
<p>Returns: IsotopeDistribution: The calculated isotope distribution for the chemical compound.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/chem.py#L126" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/chem.py#L126" target="_blank" style="float:right; font-size:smaller">source</a></p>
</section>
<section id="numba_bin" class="level3">
<h3 class="anchored" data-anchor-id="numba_bin">numba_bin</h3>
Expand All @@ -370,7 +358,7 @@ <h3 class="anchored" data-anchor-id="numba_bin">numba_bin</h3>
<p>Args: decimal (int): Decimal number.</p>
<p>Returns: list: Number in binary.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/chem.py#L90" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/chem.py#L90" target="_blank" style="float:right; font-size:smaller">source</a></p>
</section>
<section id="fast_add" class="level3">
<h3 class="anchored" data-anchor-id="fast_add">fast_add</h3>
Expand Down Expand Up @@ -428,9 +416,9 @@ <h3 class="anchored" data-anchor-id="isotopedistribution">IsotopeDistribution</h
</section>
<section id="averagine" class="level2">
<h2 class="anchored" data-anchor-id="averagine">Averagine</h2>
<p>The averagine model is based on <a href="https://www.sciencedirect.com/science/article/pii/1044030595000178">Senko et al.</a>. We define the function <a href="https://mannlabs.github.io/chem.html#get_average_formula"><code>get_average_formula</code></a> to calculate a dictionary with averagine masses.</p>
<p>The averagine model is based on <a href="https://www.sciencedirect.com/science/article/pii/1044030595000178">Senko et al.</a>. We define the function <a href="https://mannlabs.github.io/alphapept/chem.html#get_average_formula"><code>get_average_formula</code></a> to calculate a dictionary with averagine masses.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/chem.py#L178" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/chem.py#L178" target="_blank" style="float:right; font-size:smaller">source</a></p>
<section id="get_average_formula" class="level3">
<h3 class="anchored" data-anchor-id="get_average_formula">get_average_formula</h3>
<blockquote class="blockquote">
Expand All @@ -453,9 +441,9 @@ <h3 class="anchored" data-anchor-id="get_average_formula">get_average_formula</h
<pre><code>{C: 13, H: 24, N: 4, O: 4, S: 0}</code></pre>
</div>
</div>
<p>To directly calculate the isotope distribution of a molecule mass based on the averagine model, we define the wrapper function <a href="https://mannlabs.github.io/chem.html#mass_to_dist"><code>mass_to_dist</code></a>.</p>
<p>To directly calculate the isotope distribution of a molecule mass based on the averagine model, we define the wrapper function <a href="https://mannlabs.github.io/alphapept/chem.html#mass_to_dist"><code>mass_to_dist</code></a>.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/chem.py#L219" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/chem.py#L219" target="_blank" style="float:right; font-size:smaller">source</a></p>
</section>
<section id="mass_to_dist" class="level3">
<h3 class="anchored" data-anchor-id="mass_to_dist">mass_to_dist</h3>
Expand Down Expand Up @@ -499,9 +487,9 @@ <h3 class="anchored" data-anchor-id="mass_to_dist">mass_to_dist</h3>
</section>
<section id="mass-calculations" class="level2">
<h2 class="anchored" data-anchor-id="mass-calculations">Mass Calculations</h2>
<p><a href="https://mannlabs.github.io/chem.html#calculate_mass"><code>calculate_mass</code></a>: This function allows to calculate the precursor mass from the monoisotopic m/z and the charge.</p>
<p><a href="https://mannlabs.github.io/alphapept/chem.html#calculate_mass"><code>calculate_mass</code></a>: This function allows to calculate the precursor mass from the monoisotopic m/z and the charge.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/chem.py#L246" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/chem.py#L246" target="_blank" style="float:right; font-size:smaller">source</a></p>
<section id="calculate_mass" class="level3">
<h3 class="anchored" data-anchor-id="calculate_mass">calculate_mass</h3>
<blockquote class="blockquote">
Expand Down
22 changes: 5 additions & 17 deletions docs/constants.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,7 @@
<span class="navbar-title">alphapept</span>
</a>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav navbar-nav-scroll ms-auto">
<li class="nav-item compact">
<a class="nav-link" href="https://github.com/mannlabs/alphapept/tree/master/"><i class="bi bi-github" role="img">
</i>
</a>
</li>
</ul>
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /navcollapse -->
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /container-fluid -->
</nav>
<nav class="quarto-secondary-nav" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
Expand Down Expand Up @@ -285,19 +273,19 @@ <h2 id="toc-title">On this page</h2>
<ul>
<li><a href="#amino-acids" id="toc-amino-acids" class="nav-link active" data-scroll-target="#amino-acids">Amino Acids</a></li>
<li><a href="#mass-dict" id="toc-mass-dict" class="nav-link" data-scroll-target="#mass-dict">Mass dict</a>
<ul>
<ul class="collapse">
<li><a href="#get_mass_dict" id="toc-get_mass_dict" class="nav-link" data-scroll-target="#get_mass_dict">get_mass_dict</a></li>
</ul></li>
<li><a href="#isotopes" id="toc-isotopes" class="nav-link" data-scroll-target="#isotopes">Isotopes</a>
<ul>
<ul class="collapse">
<li><a href="#isotope" id="toc-isotope" class="nav-link" data-scroll-target="#isotope">Isotope</a></li>
</ul></li>
<li><a href="#averagine-model" id="toc-averagine-model" class="nav-link" data-scroll-target="#averagine-model">Averagine Model</a></li>
<li><a href="#protease-dict" id="toc-protease-dict" class="nav-link" data-scroll-target="#protease-dict">Protease dict</a></li>
<li><a href="#losses" id="toc-losses" class="nav-link" data-scroll-target="#losses">Losses</a></li>
<li><a href="#labels" id="toc-labels" class="nav-link" data-scroll-target="#labels">Labels</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/mannlabs/alphapept/tree/master/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/mannlabs/alphapept/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">
Expand Down Expand Up @@ -339,7 +327,7 @@ <h2 class="anchored" data-anchor-id="amino-acids">Amino Acids</h2>
<h2 class="anchored" data-anchor-id="mass-dict">Mass dict</h2>
<p>A numba compatible mass dict dictionary. This is created from the <code>modifications.tsv</code>. Change to allow custom modifications.</p>
<hr>
<p><a href="https://github.com/mannlabs/alphapept/tree/master/blob/master/alphapept/constants.py#L16" target="_blank" style="float:right; font-size:smaller">source</a></p>
<p><a href="https://github.com/mannlabs/alphapept/blob/master/alphapept/constants.py#L16" target="_blank" style="float:right; font-size:smaller">source</a></p>
<section id="get_mass_dict" class="level3">
<h3 class="anchored" data-anchor-id="get_mass_dict">get_mass_dict</h3>
<blockquote class="blockquote">
Expand Down
Loading

0 comments on commit 80c3604

Please sign in to comment.