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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.8.0 2021-05-11

* Add example Java dropbox

## 1.7.0 2021-03-19

* Provides fully tested functionality to register generic imaging data, with OMERO server support (v5.4.10). [Link to PR](https://github.com/qbicsoftware/etl-scripts/pull/78)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ OpenBIS loads Java libararies on startup, if they are provided in a `lib` folder

We decoupled some shared functionality in the [data-model-lib](https://github.com/qbicsoftware/data-model-lib) and the [core-utils-lib](https://github.com/qbicsoftware/core-utils-lib). Please make sure to deploy them as well in of the lib folders, such that the classes are loaded by the etlserver class loader and available during runtime.

##4. Dependencies for the example dropbox written in pure Java/Groovy

Just deploy the compiled JAR of the [Java openBIS dropbox](https://github
.com/qbicsoftware/java-openbis-dropboxes) in the `lib` folder of the dropbox (`
./register-example-java-dropbox/lib`).

## Data format guidelines

Expand Down
16 changes: 16 additions & 0 deletions drop-boxes/register-example-java-dropbox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Example openBIS dropbox written in Java

Please find the source code of the ETL routine that this article is referring to in the
[Java openBIS dropboxes](https://github.com/qbicsoftware/java-openbis-dropboxes) Github repository.

## Installation

Please provide the Java binaries as JAR from the [Java openBIS dropbox](https://github.com/qbicsoftware/java-openbis-dropboxes) in this directories
folder `./lib`.

The DSS needs to be restarted in order to activate this dropbox.

## ETL routine

This dropbox expects a file of any type and creates a new openBIS dataset from it. This dataset
is then attached to a fixed sample with id `/TEST28/QXEGD018AW` for demonstration purposes.
2 changes: 2 additions & 0 deletions drop-boxes/register-example-java-dropbox/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Put the compiled Java binaries as JARs in this directory in order
to be loaded by the openBIS DSS class loader on DSS startup.
11 changes: 11 additions & 0 deletions drop-boxes/register-example-java-dropbox/plugin.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Drop box for registering a fastq file as a data set
#
# Variables:
# incoming-root-dir
# Path to the directory which contains incoming directories for drop boxes.
incoming-dir = ${incoming-root-dir}/QBiC-register-example-java-data
incoming-data-completeness-condition = marker-file
top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.api.v2.JavaTopLevelDataSetHandlerV2
program-class = life.qbic.registration.MainETL
storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
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.