Skip to content

Commit

Permalink
Adjust CONTRIBUTING.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
breimanntools committed Sep 25, 2023
1 parent f3cfb6f commit 2f588c8
Show file tree
Hide file tree
Showing 62 changed files with 65 additions and 60 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ To enhance the public interface or signature of your functions and classes, empl
Testing
-------
For generating efficient tests with extensive coverage and considering edge cases, utilize the prompt template below:
Generate efficient tests with extensive coverage and considering edge cases using the prompt template below,
utilizing `our <https://github.com/breimanntools/aaanalysis/blob/master/tests/unit/data_loader_tests/test_load_dataset.py>`_
or a custom testing template:

.. code-block:: none
Expand Down
23 changes: 11 additions & 12 deletions aaanalysis/aaclust/aaclust_plot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This is a script for ...
This is a script for the plotting class of AAclust.
"""
import time
import pandas as pd
Expand All @@ -14,17 +14,16 @@


# II Main Functions
class AAclustPlot:
""""""
def __int__(self):
pass

# III Test/Caller Functions
@staticmethod
def eval():
"""Plot eval output of dPULearn (n per component)"""

@staticmethod
def eval_cat(df_seq=None):
"""Plot donut plot for proportion of categories"""

# IV Main
def main():
t0 = time.time()

t1 = time.time()
print("Time:", t1 - t0)


if __name__ == "__main__":
main()
Binary file modified aaanalysis/cpp/__pycache__/cpp.cpython-39.pyc
Binary file not shown.
Binary file modified aaanalysis/cpp/__pycache__/cpp_plot.cpython-39.pyc
Binary file not shown.
10 changes: 8 additions & 2 deletions aaanalysis/cpp/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ def run(self, labels=None, parametric=False, n_filter=100,
print(f"4. CPP returns df with {len(df_feat)} unique features including general information and statistics")
return df_feat

# TODO get evaluation for any dataset for compelete
"""
@staticmethod
def eval(df_feat=None, features=None):
"""Get evaluation for provided dataset"""
# TODO get evaluation for any dataset for compelete
"""
# TODO filter based on correlation of features
"""
@staticmethod
def filter_corr(df_parts=None, df_feat=None, max_corr=None):
"""
2 changes: 1 addition & 1 deletion aaanalysis/cpp/cpp_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO simplify checks & interface (end-to-end check with tests & docu)
# TODO plot_functions test & refactor (end-to-end)

# TODO use decorator for redudant signatures (https://github.com/scverse/scanpy/blob/master/scanpy/preprocessing/_qc.py)

# I Helper Functions
def check_value_type(val_type=None, count_in=True):
Expand Down
Binary file modified aaanalysis/data_loader/__pycache__/data_loader.cpython-39.pyc
Binary file not shown.
16 changes: 8 additions & 8 deletions aaanalysis/data_loader/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def post_check_df_seq(df_seq=None, n=None, name=None, n_match=True):


# Helper functions for load_scales
def _filter_scales(df_cat=None, unclassified_in=False, just_aaindex=False):
def _filter_scales(df_cat=None, unclassified_out=False, just_aaindex=False):
"""Filter scales for unclassified and aaindex scales"""
list_ids_not_in_aaindex = [x for x in df_cat[ut.COL_SCALE_ID] if "LINS" in x or "KOEH" in x]
list_ids_unclassified = [x for x, cat, sub_cat in zip(df_cat[ut.COL_SCALE_ID], df_cat[ut.COL_CAT], df_cat[ut.COL_SUBCAT])
if "Unclassified" in sub_cat or cat == "Others"]
list_ids_to_exclude = []
if not unclassified_in:
if unclassified_out:
list_ids_to_exclude.extend(list_ids_unclassified)
if just_aaindex:
list_ids_to_exclude.extend(list_ids_not_in_aaindex)
Expand Down Expand Up @@ -269,7 +269,7 @@ def load_dataset(name: str = "INFO",
# Load scales
def load_scales(name: str = "scales",
just_aaindex: bool = False,
unclassified_in: bool = True,
unclassified_out: bool = False,
top60_n: Optional[int] = None
) -> DataFrame:
"""
Expand All @@ -289,8 +289,8 @@ def load_scales(name: str = "scales",
Name of the loaded dataset: 'scales', 'scales_raw', 'scales_cat', 'scales_pc', 'top60', 'top60_eval'.
just_aaindex
If True, returns only scales from AAindex. Relevant only for 'scales', 'scales_raw', or 'scales_cat'.
unclassified_in
Determines inclusion of unclassified scales. Relevant only for 'scales', 'scales_raw', or 'scales_cat'.
unclassified_out
Determines exclusion of unclassified scales. Relevant only for 'scales', 'scales_raw', or 'scales_cat'.
top60_n
Select the n-th scale set from top60 sets and return it for 'scales', 'scales_raw', or 'scales_cat'.
Expand Down Expand Up @@ -326,7 +326,7 @@ def load_scales(name: str = "scales",
"""
check_name_of_scale(name=name)
ut.check_bool(name="just_aaindex", val=just_aaindex)
ut.check_bool(name="unclassified_in", val=unclassified_in)
ut.check_bool(name="unclassified_in", val=unclassified_out)
check_top60_n(name=name, top60_n=top60_n)

# Load and filter top60 scales
Expand All @@ -344,7 +344,7 @@ def load_scales(name: str = "scales",
raise ValueError(f"Wrong 'name' ('{name}') for 'top60_n")

# Load unfiltered data
if unclassified_in and not just_aaindex:
if not unclassified_out and not just_aaindex:
if name == ut.STR_SCALE_CAT:
df_cat = ut.read_excel_cached(ut.FOLDER_DATA + f"{ut.STR_SCALE_CAT}.xlsx")
return df_cat
Expand All @@ -353,7 +353,7 @@ def load_scales(name: str = "scales",

# Load and filter scale categories
df_cat = ut.read_excel_cached(ut.FOLDER_DATA + f"{ut.STR_SCALE_CAT}.xlsx")
df_cat = _filter_scales(df_cat=df_cat, unclassified_in=unclassified_in, just_aaindex=just_aaindex)
df_cat = _filter_scales(df_cat=df_cat, unclassified_out=unclassified_out, just_aaindex=just_aaindex)
if name == ut.STR_SCALE_CAT:
return df_cat.reset_index(drop=True)

Expand Down
22 changes: 11 additions & 11 deletions aaanalysis/dpulearn/dpulearn_plot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
This is a script for ...
This is a script for the plotting class of dPULearn.
"""
import time
import pandas as pd
Expand All @@ -14,18 +14,18 @@


# II Main Functions
class dPULearnPlot:
""""""
def __int__(self):
pass

@staticmethod
def eval():
"""Plot eval output of dPULearn (n per component)"""

# III Test/Caller Functions
@staticmethod
def components(df_seq=None, x="PC1", y="PC2", show_mean_x=False, show_mean_y=False):
"""Plot PC map for PC analysis """


# IV Main
def main():
t0 = time.time()

t1 = time.time()
print("Time:", t1 - t0)


if __name__ == "__main__":
main()
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/generated/aaanalysis.CPP.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/generated/aaanalysis.load_scales.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/index/CONTRIBUTING_COPY.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion docs/build/html/_sources/index/CONTRIBUTING_COPY.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ To enhance the public interface or signature of your functions and classes, empl
Testing
-------
For generating efficient tests with extensive coverage and considering edge cases, utilize the prompt template below:
Generate efficient tests with extensive coverage and considering edge cases using the prompt template below,
utilizing `our <https://github.com/breimanntools/aaanalysis/blob/master/tests/unit/data_loader_tests/test_load_dataset.py>`_
or a custom testing template:

.. code-block:: none
Expand Down
12 changes: 3 additions & 9 deletions docs/build/html/generated/aaanalysis.CPP.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<h1>aaanalysis.CPP<a class="headerlink" href="#aaanalysis-cpp" title="Permalink to this heading"></a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="aaanalysis.CPP">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">aaanalysis.</span></span><span class="sig-name descname"><span class="pre">CPP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">df_scales</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">df_cat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">df_parts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">split_kws</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">accept_gaps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbose</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/breimanntools/aaanalysis/tree/master/aaanalysis/cpp/cpp.py#L32-L321"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#aaanalysis.CPP" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">aaanalysis.</span></span><span class="sig-name descname"><span class="pre">CPP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">df_scales</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">df_cat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">df_parts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">split_kws</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">accept_gaps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbose</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/breimanntools/aaanalysis/tree/master/aaanalysis/cpp/cpp.py#L32-L327"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#aaanalysis.CPP" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Tool</span></code></p>
<p>Create and filter features that are most discriminant between two sets of sequences.</p>
<dl class="field-list simple">
Expand Down Expand Up @@ -158,8 +158,8 @@ <h1>aaanalysis.CPP<a class="headerlink" href="#aaanalysis-cpp" title="Permalink
<tr class="row-odd"><td><p><a class="reference internal" href="#aaanalysis.CPP.__init__" title="aaanalysis.CPP.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>([df_scales, df_cat, df_parts, ...])</p></td>
<td><p></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#aaanalysis.CPP.eval" title="aaanalysis.CPP.eval"><code class="xref py py-obj docutils literal notranslate"><span class="pre">eval</span></code></a>([df_feat, features])</p></td>
<td><p>Get evaluation for provided dataset</p></td>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">eval</span></code>()</p></td>
<td><p>Evaluate the output generated by the tool.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#aaanalysis.CPP.run" title="aaanalysis.CPP.run"><code class="xref py py-obj docutils literal notranslate"><span class="pre">run</span></code></a>([labels, parametric, n_filter, tmd_len, ...])</p></td>
<td><p>Perform CPP pipeline by creation and two-step filtering of features.</p></td>
Expand Down Expand Up @@ -221,12 +221,6 @@ <h1>aaanalysis.CPP<a class="headerlink" href="#aaanalysis-cpp" title="Permalink
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="aaanalysis.CPP.eval">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">eval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">df_feat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">features</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/breimanntools/aaanalysis/tree/master/aaanalysis/cpp/cpp.py#L318-L321"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#aaanalysis.CPP.eval" title="Permalink to this definition"></a></dt>
<dd><p>Get evaluation for provided dataset</p>
</dd></dl>

</dd></dl>

</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/generated/aaanalysis.load_scales.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<h1>aaanalysis.load_scales<a class="headerlink" href="#aaanalysis-load-scales" title="Permalink to this heading"></a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="aaanalysis.load_scales">
<span class="sig-prename descclassname"><span class="pre">aaanalysis.</span></span><span class="sig-name descname"><span class="pre">load_scales</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'scales'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">just_aaindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unclassified_in</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">top60_n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/breimanntools/aaanalysis/tree/master/aaanalysis/data_loader/data_loader.py#L270-L365"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#aaanalysis.load_scales" title="Permalink to this definition"></a></dt>
<span class="sig-prename descclassname"><span class="pre">aaanalysis.</span></span><span class="sig-name descname"><span class="pre">load_scales</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'scales'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">just_aaindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unclassified_out</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">top60_n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/breimanntools/aaanalysis/tree/master/aaanalysis/data_loader/data_loader.py#L270-L365"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#aaanalysis.load_scales" title="Permalink to this definition"></a></dt>
<dd><p>Load amino acid scales, scale classifications (AAontology), or scale evaluations.</p>
<p>The amino acid scales (<code class="docutils literal notranslate"><span class="pre">name='scales_raw'</span></code>) encompass all scales from AAindex (<a class="reference internal" href="../index/references.html#kawashima08" id="id1"><span>[Kawashima08]</span></a>) along with two
additional data sources. These scales were min-max normalized (<code class="docutils literal notranslate"><span class="pre">name='scales'</span></code>) and organized in a two-level
Expand All @@ -140,7 +140,7 @@ <h1>aaanalysis.load_scales<a class="headerlink" href="#aaanalysis-load-scales" t
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>) – Name of the loaded dataset: ‘scales’, ‘scales_raw’, ‘scales_cat’, ‘scales_pc’, ‘top60’, ‘top60_eval’.</p></li>
<li><p><strong>just_aaindex</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – If True, returns only scales from AAindex. Relevant only for ‘scales’, ‘scales_raw’, or ‘scales_cat’.</p></li>
<li><p><strong>unclassified_in</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Determines inclusion of unclassified scales. Relevant only for ‘scales’, ‘scales_raw’, or ‘scales_cat’.</p></li>
<li><p><strong>unclassified_out</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>) – Determines exclusion of unclassified scales. Relevant only for ‘scales’, ‘scales_raw’, or ‘scales_cat’.</p></li>
<li><p><strong>top60_n</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Optional" title="(in Python v3.11)"><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code></a>[<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.11)"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a>]) – Select the n-th scale set from top60 sets and return it for ‘scales’, ‘scales_raw’, or ‘scales_cat’.</p></li>
</ul>
</dd>
Expand Down
2 changes: 0 additions & 2 deletions docs/build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ <h2 id="E">E</h2>
<li><a href="generated/aaanalysis.AAclust.html#aaanalysis.AAclust.eval">eval() (aaanalysis.AAclust method)</a>

<ul>
<li><a href="generated/aaanalysis.CPP.html#aaanalysis.CPP.eval">(aaanalysis.CPP static method)</a>
</li>
<li><a href="generated/aaanalysis.dPULearn.html#aaanalysis.dPULearn.eval">(aaanalysis.dPULearn method)</a>
</li>
</ul></li>
Expand Down
4 changes: 3 additions & 1 deletion docs/build/html/index/CONTRIBUTING_COPY.html
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ <h3>Interface optimization<a class="headerlink" href="#interface-optimization" t
</section>
<section id="testing">
<h3>Testing<a class="headerlink" href="#testing" title="Permalink to this heading"></a></h3>
<p>For generating efficient tests with extensive coverage and considering edge cases, utilize the prompt template below:</p>
<p>Generate efficient tests with extensive coverage and considering edge cases using the prompt template below,
utilizing <a class="reference external" href="https://github.com/breimanntools/aaanalysis/blob/master/tests/unit/data_loader_tests/test_load_dataset.py">our</a>
or a custom testing template:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&quot;
Generate test functions for a given TARGET FUNCTION using the style of the provided TESTING TEMPLATE.

Expand Down
Binary file modified docs/build/html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/searchindex.js

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 2f588c8

Please sign in to comment.