From d9fa11f15da7eb34c5732a5f72c86ccff183e7d5 Mon Sep 17 00:00:00 2001 From: Mikko Nieminen Date: Fri, 27 Sep 2024 14:22:21 +0200 Subject: [PATCH] refactor get_assay_path() (#2016) --- CHANGELOG.rst | 1 + samplesheets/plugins.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 27ed73c1..76d1dd3d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -46,6 +46,7 @@ Changed - Update REST API views for OpenAPI compatibility (#1951) - Send iRODS delete request emails to all addresses of user (#2000) - Disable ontology term select box while querying (#1974) + - Refactor ``SampleSheetAssayPluginPoint.get_assay_path()`` (#2016) - **Taskflowbackend** - Refactor task tests (#2002) - Unify user name parameter naming in flows (#1653) diff --git a/samplesheets/plugins.py b/samplesheets/plugins.py index 9179bc8c..96743142 100644 --- a/samplesheets/plugins.py +++ b/samplesheets/plugins.py @@ -937,20 +937,27 @@ class SampleSheetAssayPluginPoint(PluginPoint): #: Irodsbackend IrodsAPI object irods_backend = None + #: iRDOS path for the assay for which the plugin is initialized + assay_path = None + def __init__(self): super().__init__() self.irods_backend = get_backend_api('omics_irods') def get_assay_path(self, assay): """ - Helper for getting the assay path. + Return the iRODS path for the given assay. :param assay: Assay object :return: Full iRODS path for the assay """ - if not self.irods_backend: - return None - return self.irods_backend.get_path(assay) + if not self.assay_path: + self.assay_path = ( + self.irods_backend.get_path(assay) + if self.irods_backend and assay + else None + ) + return self.assay_path def get_row_path(self, row, table, assay, assay_path): """