Skip to content

Commit

Permalink
made calc_taxonomy_dict private
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuyi Xue committed Jan 26, 2022
1 parent c6b5398 commit c620322
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ncbitax2lin/ncbitax2lin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ROOT_TAX_ID = 1


def calc_taxonomy_dict(df_tax: pd.DataFrame) -> Dict[int, TaxUnit]:
def _calc_taxonomy_dict(df_tax: pd.DataFrame) -> Dict[int, TaxUnit]:
"""Converts dataframe of df_tax into a dictionary with tax_id as the keys"""
return dict(zip(df_tax.tax_id.values, df_tax.to_dict("records")))

Expand Down Expand Up @@ -81,7 +81,7 @@ def taxonomy_to_lineages(

_LOGGER.info("Generating TAXONOMY_DICT ...")
global TAXONOMY_DICT # pylint: disable=global-statement
TAXONOMY_DICT = calc_taxonomy_dict(df_data)
TAXONOMY_DICT = _calc_taxonomy_dict(df_data)

lineages = find_all_lineages(df_data.tax_id)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_ncbitax2lin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""tests for data_reader.py"""
"""tests for ncbitax2lin.py"""
# pylint: disable=protected-access, missing-function-docstring


Expand All @@ -7,7 +7,7 @@
from ncbitax2lin import ncbitax2lin


def test_calc_taxonomy_dict() -> None:
def test__calc_taxonomy_dict() -> None:
df_data = pd.DataFrame(
{
"tax_id": [1, 2, 6],
Expand All @@ -17,7 +17,7 @@ def test_calc_taxonomy_dict() -> None:
}
)

actual = ncbitax2lin.calc_taxonomy_dict(df_data)
actual = ncbitax2lin._calc_taxonomy_dict(df_data)
expected = {
1: {"tax_id": 1, "parent_tax_id": 1, "rank": "no rank", "rank_name": "root"},
2: {
Expand Down

0 comments on commit c620322

Please sign in to comment.