Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion drop-boxes/register-omero-metadata/backendinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -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) )

Expand All @@ -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:
Expand All @@ -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]) + "//"
Expand All @@ -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


Expand Down
8 changes: 5 additions & 3 deletions drop-boxes/register-omero-metadata/register-omero.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand All @@ -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:"
Expand Down Expand Up @@ -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.