From d41d783967a0720c0b38fed3c036bc8379687731 Mon Sep 17 00:00:00 2001 From: pswain <peter.swain@ed.ac.uk> Date: Tue, 25 Jun 2024 17:49:25 +0100 Subject: [PATCH] change(dataloader): added find_full_omid --- src/wela/dataloader.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/wela/dataloader.py b/src/wela/dataloader.py index 1e2a464..2dee342 100644 --- a/src/wela/dataloader.py +++ b/src/wela/dataloader.py @@ -1,3 +1,4 @@ +import os import pprint from pathlib import Path @@ -8,6 +9,7 @@ from wela.correct_buds import correct_buds try: from postprocessor.grouper import Grouper + from wela.add_bud_fluorescence import add_bud_fluorescence except ModuleNotFoundError: print("Can only load tsv files - cannot find aliby's postprocessor.") @@ -777,3 +779,17 @@ def sort_df(df, signal, functionstr="sum"): rdf = rdf.sort_values(by="id") # return sorted dataframe return rdf + + +def find_full_omid(omid: str or int, outdir: str): + """ + Find full name of experiment from an OMERO ID. + + Search outdir directory for name. + """ + full_omid = [ + f + for f in os.listdir(outdir) + if os.path.isdir(os.path.join(outdir, f)) and str(omid) in f + ].pop() + return full_omid -- GitLab