Skip to content

Commit

Permalink
fix: [#256] support for multiple studies and multiple assays in sodar…
Browse files Browse the repository at this point in the history
…_common.py (#259)

Co-authored-by: Sarah Laemmle <[email protected]>
  • Loading branch information
slaemmle and Sarah Laemmle authored Feb 13, 2025
1 parent e3b3a8b commit d9def70
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit d9def70

Please sign in to comment.