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

fix: [#256] support for multiple studies and multiple assays in sodar_common.py #259

Merged
merged 2 commits into from
Feb 13, 2025
Merged
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
14 changes: 9 additions & 5 deletions src/cubi_tk/sodar_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ def get_assay_irods_path(self, assay_uuid=None):
sodar_api_token=self.sodar_api_token,
project_uuid=self.project_uuid,
)

for study in investigation.studies.values():
if assay_uuid:
logger.info(f"Using provided Assay UUID: {assay_uuid}")
try:
#bug fix for rare case that multiple studies and multiple assays exist
if assay_uuid in study.assays.keys():
logger.info(f"Using provided Assay UUID: {assay_uuid}")
assay = study.assays[assay_uuid]
return assay.irods_path
except KeyError:
logger.error("Provided Assay UUID is not present in the Study.")
raise

else:
# Assumption: there is only one assay per study for `snappy` projects.
# If multi-assay project it will only consider the first one and throw a warning.
Expand All @@ -94,6 +94,10 @@ def get_assay_irods_path(self, assay_uuid=None):
for _assay_uuid in assays_:
assay = study.assays[_assay_uuid]
return assay.irods_path

if assay_uuid:
logger.error("Provided Assay UUID is not present in the Ivestifation.")
raise Exception("Cannot find assay with UUID %s" % assay_uuid)
return None

@staticmethod
Expand Down
Loading