Skip to content

Commit 9cb0343

Browse files
authored
add methods to filter by analysis ids
2 parents 7b3c3a1 + 3721713 commit 9cb0343

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

‎sample_annotator/clients/gold_client.py‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,39 @@ def fetch_study_by_project(self, id: str) -> List[SampleDict]:
272272
id = self._normalize_id(id)
273273
results = self._call("studies", {"projectGoldId": id})
274274
return results
275-
275+
276+
def fetch_study_by_analysis_id(self, id: str) -> List[SampleDict]:
277+
"""Fetch the study id for which the informatics processing
278+
of a sequencing project was performed.
279+
280+
:param id: GOLD Analysis id. Ex.: Ga0466468
281+
:return: List of SampleDict objects
282+
"""
283+
id = self._normalize_id(id)
284+
results = self._call("studies", {"analysisGoldId": id})
285+
return results
286+
287+
def fetch_biosample_by_analysis_id(self, id: str) -> List[SampleDict]:
288+
"""Fetch the biosample id for which the informatics processing
289+
of a sequencing project was performed.
290+
291+
:param id: GOLD Analysis id. Ex.: Ga0466468
292+
:return: List of SampleDict objects
293+
"""
294+
id = self._normalize_id(id)
295+
results = self._call("biosamples", {"analysisGoldId": id})
296+
return results
297+
298+
def fetch_project_by_analysis_id(self, id: str) -> List[SampleDict]:
299+
"""Fetch the project id for which the informatics processing
300+
of a sequencing project was performed.
301+
302+
:param id: GOLD Analysis id. Ex.: Ga0466468
303+
:return: List of SampleDict objects
304+
"""
305+
id = self._normalize_id(id)
306+
results = self._call("projects", {"analysisGoldId": id})
307+
return results
276308

277309
@click.group()
278310
@click.option("-v", "--verbose", count=True)

0 commit comments

Comments
 (0)