diff --git a/drop-boxes/register-omero-metadata/backendinterface.py b/drop-boxes/register-omero-metadata/backendinterface.py index 0e2b0b1..a313a29 100644 --- a/drop-boxes/register-omero-metadata/backendinterface.py +++ b/drop-boxes/register-omero-metadata/backendinterface.py @@ -407,7 +407,6 @@ def get_args(): key_value = pair.split("::") key_value_data.append(key_value) - add_annotations_to_image(conn, str(args.image_id), key_value_data) print "0" diff --git a/drop-boxes/register-omero-metadata/image_registration_process.py b/drop-boxes/register-omero-metadata/image_registration_process.py index a2ab062..2a800d4 100644 --- a/drop-boxes/register-omero-metadata/image_registration_process.py +++ b/drop-boxes/register-omero-metadata/image_registration_process.py @@ -24,6 +24,7 @@ def __init__(self, transaction, env_name="omero_env_0", project_code="", sample_ self._sample_code = sample_code ### set exec. env + self._conda_path = conda_home_path if not conda_path is None: self._conda_path = conda_path @@ -47,6 +48,7 @@ def __init__(self, transaction, env_name="omero_env_0", project_code="", sample_ self._init_cmd_list.append('export PATH=$PATH:' + self._conda_path + 'envs/' + env_name + '/bin') # move to the dir where backendinterface.py lives for exec. + self._init_cmd_list.append('cd ' + self._etl_path) def fetchOpenBisSampleCode(self): @@ -63,6 +65,7 @@ def fetchOpenBisSampleCode(self): def searchOpenBisSample(self, sample_code): # find specific sample + sc = SearchCriteria() sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, sample_code)) foundSamples = self._search_service.searchForSamples(sc) @@ -100,7 +103,7 @@ def requestOmeroDatasetId(self, project_code=None, sample_code=None): return ds_id def registerImageFileInOmero(self, file_path, dataset_id): - + cmd_list = list(self._init_cmd_list) cmd_list.append( "python backendinterface.py -f " + file_path + " -d " + str(dataset_id) ) @@ -123,6 +126,7 @@ def triggerOMETiffConversion(self): pass #ToDo Check if Metadata file is provided as defined + def extractMetadataFromTSV(self, tsv_file_path): tsvFileMap = {} try: @@ -147,6 +151,7 @@ def registerOmeroKeyValuePairs(self, image_id, property_map): cmd_list = list(self._init_cmd_list) # string format: key1::value1//key2::value2//key3::value3//... + key_value_str = "" for key in property_map.keys(): key_value_str = key_value_str + str(key) + "::" + str(property_map[key]) + "//" @@ -161,7 +166,6 @@ def registerOmeroKeyValuePairs(self, image_id, property_map): process = Popen( "/bin/bash", shell=False, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE ) out, err = process.communicate( commands ) - return 0 diff --git a/drop-boxes/register-omero-metadata/register-omero.py b/drop-boxes/register-omero-metadata/register-omero.py index b5fbaaf..6872776 100755 --- a/drop-boxes/register-omero-metadata/register-omero.py +++ b/drop-boxes/register-omero-metadata/register-omero.py @@ -55,13 +55,11 @@ # and delete the data! ##### - INCOMING_DATE_FORMAT = '%d.%m.%Y' OPENBIS_DATE_FORMAT = '%Y-%m-%d' PROPPERTY_FILTER_LIST = ["IMAGE_FILE_NAME", "INSTRUMENT_USER", "IMAGING_DATE"] - def mapDateString(date_string): return datetime.datetime.strptime(date_string, INCOMING_DATE_FORMAT).strftime(OPENBIS_DATE_FORMAT) @@ -245,6 +243,8 @@ def process(transaction): # 1. Initialize the image registration process registrationProcess = irp.ImageRegistrationProcess(transaction) + + print "started reg. process" # 2. We want to get the openBIS sample code from the incoming data # This tells us to which biological sample the image data was aquired from. @@ -253,13 +253,14 @@ def process(transaction): #find specific sample tissueSample = registrationProcess.searchOpenBisSample(sample_code) space = tissueSample.getSpace() - + # 3. We now request the associated omero dataset id for the openBIS sample code. # Each dataset in OMERO contains the associated openBIS biological sample id, which # happened during the experimental design registration with the projectwizard. # Starts omero registration # returns -1 if fetching dataset-id operation failed + omero_dataset_id = registrationProcess.requestOmeroDatasetId(project_code=project_code, sample_code=sample_code) print "omero dataset id:" @@ -342,3 +343,4 @@ def process(transaction): # 7. Last but not least we create the open science file format for images which is # OMERO-Tiff and store it in OMERO next to the proprierary vendor format. +