Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.40.1 #472

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.40.1] -- 2024-01-11
### Fixed
- Initializing Project with `NaN` value instead of `None` in `from_pandas` method


## [0.40.0] -- 2023-12-18

**This version introduced backwards-incompatible changes.**
Expand Down
2 changes: 1 addition & 1 deletion peppy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
from .sample import Sample

__classes__ = ["Project", "Sample"]
__all__ = __classes__ + ["PeppyError"]
__all__ = __classes__ + ["PeppyError", "__version__"]

LOGGING_LEVEL = "INFO"
2 changes: 1 addition & 1 deletion peppy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.40.0"
__version__ = "0.40.1"
13 changes: 8 additions & 5 deletions peppy/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections.abc import Mapping, MutableMapping
from contextlib import suppress
from logging import getLogger
from typing import Iterable, List, Tuple, Union, Literal, NoReturn
from typing import Iterable, List, Tuple, Union, Literal

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -223,13 +223,15 @@ def _from_dict(self, pep_dictionary) -> "Project":
_samples: list | dict,
_subsamples: list[list | dict]}
"""
self[SAMPLE_DF_KEY] = pd.DataFrame(pep_dictionary[SAMPLE_RAW_DICT_KEY])
self[SAMPLE_DF_KEY] = pd.DataFrame(pep_dictionary[SAMPLE_RAW_DICT_KEY]).replace(
np.nan, ""
)
self[CONFIG_KEY] = pep_dictionary[CONFIG_KEY]

if SUBSAMPLE_RAW_LIST_KEY in pep_dictionary:
if pep_dictionary[SUBSAMPLE_RAW_LIST_KEY]:
self[SUBSAMPLE_DF_KEY] = [
pd.DataFrame(sub_a)
pd.DataFrame(sub_a).replace(np.nan, "")
for sub_a in pep_dictionary[SUBSAMPLE_RAW_LIST_KEY]
]
if NAME_KEY in self[CONFIG_KEY]:
Expand Down Expand Up @@ -467,7 +469,7 @@ def parse_config_file(
relative_vars = [CFG_SAMPLE_TABLE_KEY, CFG_SUBSAMPLE_TABLE_KEY]
_make_sections_absolute(self[CONFIG_KEY], relative_vars, cfg_path)

def _set_indexes(self, config: Mapping) -> NoReturn:
def _set_indexes(self, config: Mapping) -> None:
"""
Set sample and subsample indexes if they are different then Default

Expand All @@ -483,6 +485,7 @@ def _set_indexes(self, config: Mapping) -> NoReturn:
if SUBSAMPLE_TABLE_INDEX_KEY in config
else SUBSAMPLE_NAME_ATTR
)
return None

def load_samples(self):
"""
Expand Down Expand Up @@ -1333,7 +1336,7 @@ def _read_sample_data(self):

if st is not None:
parser_class = select_parser(path=st)
self[SAMPLE_DF_KEY] = parser_class(path=st).table
self[SAMPLE_DF_KEY] = parser_class(path=st).table.replace(np.nan, "")
self[SAMPLE_DF_LARGE] = self[SAMPLE_DF_KEY].shape[0] > 1000
else:
_LOGGER.warning(no_metadata_msg.format(CFG_SAMPLE_TABLE_KEY))
Expand Down
7 changes: 1 addition & 6 deletions tests/test_Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from yaml import dump, safe_load
import pickle

import peppy
from peppy import Project
from peppy.const import SAMPLE_NAME_ATTR, SAMPLE_TABLE_FILE_KEY
from peppy.exceptions import (
Expand Down Expand Up @@ -350,10 +349,6 @@ def test_from_dict_instatiation(self, example_pep_cfg_path):
representation.
"""
p1 = Project(cfg=example_pep_cfg_path)
ff = p1.to_dict(extended=True)
import pprint

pprint.pprint(ff)
p2 = Project.from_dict(p1.to_dict(extended=True))
assert p1 == p2

Expand Down Expand Up @@ -694,7 +689,7 @@ def test_sample_getattr(self, example_pep_cfg_path):
assert s2.organism == s2["organism"]

@pytest.mark.parametrize("example_pep_cfg_path", ["append"], indirect=True)
def test_sample_getattr(self, example_pep_cfg_path):
def test_sample_settatr(self, example_pep_cfg_path):
"""
Verify that the setattr works
"""
Expand Down
Loading