Skip to content

Commit 6952faa

Browse files
committed
fix docstring; fix dataclass issue
1 parent 0b03e15 commit 6952faa

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pandora/dataset.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,10 @@ class NumpyDataset:
10351035
populations : pd.Series[str]
10361036
Pandas Series containing the populations of the sequences contained in ``input_data``.
10371037
Expects the number of ``populations`` to match the first dimension of ``input_data``.
1038+
This population annotation can be used to group sequences, for example according to population structure in
1039+
population genetics datasets or different cell types in gene expression data.
1040+
These populations are relevant e.g. for MDS analyses using a per-population distance metric or when plotting
1041+
the results of a PCA/MDS analysis using the `plotting.plot_populations` method.
10381042
missing_value : Union[float, int], default=np.nan
10391043
Value to treat as missing value. All missing values in ``input_data`` will be replaced with a special value
10401044
depending on the specified dtype:
@@ -1258,7 +1262,13 @@ def bootstrap(self, seed: Optional[int] = None) -> NumpyDataset:
12581262
bootstrap_data = self.input_data[
12591263
:, np.random.choice(range(num_snps), size=num_snps)
12601264
]
1261-
return NumpyDataset(bootstrap_data, self.sample_ids, self.populations, self._missing_value, bootstrap_data.dtype)
1265+
return NumpyDataset(
1266+
bootstrap_data,
1267+
self.sample_ids,
1268+
self.populations,
1269+
self._missing_value,
1270+
bootstrap_data.dtype,
1271+
)
12621272

12631273
def get_windows(self, n_windows: int = 100) -> List[NumpyDataset]:
12641274
"""Creates ``n_windows`` new ``NumpyDataset`` objects as overlapping sliding windows over self.

pandora/pandora.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import dataclasses
21
import datetime
32
import logging
43
import multiprocessing
@@ -18,7 +17,6 @@
1817
PositiveInt,
1918
ValidationError,
2019
)
21-
from pydantic.dataclasses import dataclass
2220

2321
from pandora import __version__
2422
from pandora.bootstrap import bootstrap_and_embed_multiple
@@ -42,7 +40,6 @@
4240
from pandora.sliding_window import sliding_window_embedding
4341

4442

45-
@dataclass
4643
class PandoraConfig(BaseModel):
4744
"""Pydantic dataclass encapsulating the settings required to run Pandora.
4845
@@ -317,7 +314,7 @@ def get_configuration(self) -> Dict[str, Any]:
317314
Dictionary representation of all settings in self. Filepaths are translated to absolute path strings,
318315
enums are represted by their value.
319316
"""
320-
config = dataclasses.asdict(self)
317+
config = dict(self)
321318

322319
# pathlib Paths cannot be dumped in yaml directly
323320
# so we have to manually replace them with their string representation

0 commit comments

Comments
 (0)