Skip to content

Commit 32fca8e

Browse files
authored
Merge pull request #76 from AlexsLemonade/davidsmejia/sample-kwargs
Sample API response + kwargs
2 parents fb71c13 + 38bf2c4 commit 32fca8e

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

docs/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ Here's an example of searching for a refine.bio Sample:
316316
.. code-block:: python
317317
318318
samples = pyrefinebio.Sample.search(
319-
organism="HOMO_SAPIENS",
319+
organism__name="HOMO_SAPIENS",
320320
is_processed=True
321321
)
322322

pyrefinebio/sample.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
experiment as prb_experiment,
66
organism as prb_organism,
77
original_file as prb_original_file,
8+
job as prb_job,
89
)
910
from pyrefinebio.api_interface import get_by_endpoint
1011
from pyrefinebio.base import Base
@@ -56,12 +57,17 @@ def __init__(
5657
compound=None,
5758
time=None,
5859
is_processed=None,
60+
is_unable_to_be_processed=None,
5961
created_at=None,
6062
last_modified=None,
6163
contributed_metadata=None,
6264
contributed_keywords=None,
6365
original_files=[],
6466
computed_files=[],
67+
last_processor_job=None,
68+
last_downloader_job=None,
69+
most_recent_smashable_file=None,
70+
most_recent_quant_file=None,
6571
experiment_accession_codes=None,
6672
experiments=None,
6773
):
@@ -103,6 +109,7 @@ def __init__(
103109
self.compound = compound
104110
self.time = time
105111
self.is_processed = is_processed
112+
self.is_unable_to_be_processed = is_unable_to_be_processed
106113
self.created_at = parse_date(created_at)
107114
self.last_modified = parse_date(last_modified)
108115
self.contributed_metadata = contributed_metadata
@@ -118,6 +125,15 @@ def __init__(
118125
else []
119126
)
120127

128+
# this isn't populated yet but the api does include these keys in the response
129+
# so for now let's just try to apply them
130+
if last_processor_job:
131+
self.last_processor_job = prb_job.ProcessorJob(**last_processor_job)
132+
if last_downloader_job:
133+
self.last_downloader_job = prb_job.DownloaderJob(**last_downloader_job)
134+
135+
self.most_recent_smashable_file = most_recent_smashable_file
136+
self.most_recent_quant_file = most_recent_quant_file
121137
self.experiment_accession_codes = experiment_accession_codes
122138
self.experiments = experiments
123139

@@ -163,7 +179,9 @@ def search(cls, **kwargs):
163179
164180
title (str): filter based on the Sample's title
165181
166-
organism (str): filter based on the Organism that the Sample was taken from
182+
organism__name (str): filter based on the Organism that the Sample was taken from
183+
184+
organism__taxonomy_id (int): filter based on the Organism that the Sample was taken from
167185
168186
source_database (str): filter based on the publically available repository
169187
that the Sample was taken from
@@ -204,8 +222,6 @@ def search(cls, **kwargs):
204222
205223
is_processed (bool): filter based on if the Sample has been processed
206224
207-
is_public (bool): filter based on if the Sample is public
208-
209225
limit (int): number of results to return per page.
210226
211227
offset (int): the initial index from which to return the results.

0 commit comments

Comments
 (0)