Skip to content

Commit fd6a365

Browse files
committed
fixes to work with coderdata>=2.0.0
1 parent 32a17e9 commit fd6a365

2 files changed

Lines changed: 344 additions & 335 deletions

File tree

coderdata/utils/stats.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88

99
import numpy as np
1010

11-
from coderdata import DatasetLoader
1211
import pandas as pd
1312

1413
import matplotlib.pyplot as plt
1514
from matplotlib.axes import Axes
1615
import seaborn as sns
1716

17+
import coderdata as cd
1818

1919
def plot_2d_respones_metric(
20-
data: DatasetLoader,
20+
data: cd.Dataset,
2121
metric1: str,
2222
metric2: str,
2323
**kwargs: dict
@@ -42,7 +42,7 @@ def plot_2d_respones_metric(
4242
)
4343

4444
def plot_response_metric(
45-
data: DatasetLoader,
45+
data: cd.Dataset,
4646
metric: str='auc',
4747
ax: Axes=None,
4848
**kwargs: dict
@@ -136,17 +136,17 @@ def plot_response_metric(
136136
p.set_title(title_)
137137

138138

139-
def split_experiments_by_study(data: DatasetLoader) -> dict:
139+
def split_experiments_by_study(data: cd.Dataset) -> dict:
140140
"""
141141
Splits the CoderData object into multiple smaller CoderData objects
142142
according to the `study` recorded in the ``.experiments`` table in
143143
the CoderData object.
144144
145145
Parameters
146146
----------
147-
data : DatasetLoader
147+
data : cd.Dataset
148148
The CoderData object containing the data set loaded into memory
149-
via ``coderdata.DatasetLoader()``.
149+
via ``coderdata.cd.Dataset()``.
150150
151151
Returns
152152
-------
@@ -178,7 +178,7 @@ def split_experiments_by_study(data: DatasetLoader) -> dict:
178178
return df_ret
179179

180180

181-
def summarize_response_metric(data: DatasetLoader) -> pd.DataFrame:
181+
def summarize_response_metric(data: cd.Dataset) -> pd.DataFrame:
182182
"""
183183
Helper function to extract basic statistics for the `experiments`
184184
object in a CoderData object. Uses `pandas.DataFrame.describe()`
@@ -189,7 +189,7 @@ def summarize_response_metric(data: DatasetLoader) -> pd.DataFrame:
189189
190190
Parameters
191191
----------
192-
data : coderdata.DatasetLoader
192+
data : coderdata.cd.Dataset
193193
A full CoderData object of a dataset
194194
195195
Returns
@@ -226,11 +226,11 @@ def summarize_response_metric(data: DatasetLoader) -> pd.DataFrame:
226226

227227

228228
def _filter(
229-
data: DatasetLoader,
229+
data: cd.Dataset,
230230
sample_ids: list,
231231
drug_ids: list,
232232
study: str=None,
233-
) -> DatasetLoader:
233+
) -> cd.Dataset:
234234
"""
235235
Helper function to filter down the CoderData object(s) to create
236236
independent more concise CoderData objects for further processing.
@@ -241,7 +241,7 @@ def _filter(
241241
242242
Parameters
243243
----------
244-
data : DatasetLoader
244+
data : cd.Dataset
245245
Contains a full CoderData object imported/loaded via
246246
``cd.DataLoader``
247247
sample_ids : list
@@ -258,7 +258,7 @@ def _filter(
258258
259259
Returns
260260
-------
261-
DatasetLoader
261+
cd.Dataset
262262
The filtered CoderData object
263263
264264
Notes

0 commit comments

Comments
 (0)