From 60d0d9d5ec36fb1e6a79a4f51ab919325687b10d Mon Sep 17 00:00:00 2001 From: Pierrick Roger Date: Wed, 31 Jan 2018 13:50:34 +0100 Subject: [PATCH 01/26] Add grooming for composite files. Add call to groom_dataset_content() for composite files. --- tools/data_source/upload.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/data_source/upload.py b/tools/data_source/upload.py index 6b4f636d7da..e2e2a1ab5c3 100644 --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -166,7 +166,15 @@ def add_file(dataset, registry, output_path): return info -def add_composite_file(dataset, output_path, files_path): +def add_composite_file(dataset, registry, output_path, files_path): + + # Find data type + if dataset.file_type is not None: + try: + datatype = registry.get_datatype_by_extension(dataset.file_type) + except Exception as e: + print("Unable to instantiate the datatype object for the file type '%s'" % dataset.file_type) + if dataset.composite_files: os.mkdir(files_path) for name, value in dataset.composite_files.items(): @@ -190,9 +198,17 @@ def add_composite_file(dataset, output_path, files_path): sniff.convert_newlines_sep2tabs(dp, tmp_dir=tmpdir, tmp_prefix=tmp_prefix) else: sniff.convert_newlines(dp, tmp_dir=tmpdir, tmp_prefix=tmp_prefix) - shutil.move(dp, os.path.join(files_path, name)) + + # move the file to its final destination + file_output_path = os.path.join(files_path, name) + shutil.move(dp, file_output_path) + # groom the dataset file content if required by the corresponding datatype definition + if datatype.dataset_content_needs_grooming(file_output_path): + datatype.groom_dataset_content(file_output_path) + # Move the dataset to its "real" path shutil.move(dataset.primary_file, output_path) + # Write the job info return dict(type='dataset', dataset_id=dataset.dataset_id, @@ -258,7 +274,7 @@ def __main__(): try: if dataset.type == 'composite': files_path = output_paths[int(dataset.dataset_id)][1] - metadata.append(add_composite_file(dataset, output_path, files_path)) + metadata.append(add_composite_file(dataset, registry, output_path, files_path)) else: metadata.append(add_file(dataset, registry, output_path)) except UploadProblemException as e: From 665e11facbf0b9b86fbcde04593fcd49ebe96777 Mon Sep 17 00:00:00 2001 From: Pierrick Roger Date: Wed, 31 Jan 2018 13:51:38 +0100 Subject: [PATCH 02/26] Add ISA composite data type. Add new data types isa-tab and isa-json. Add isa-rwval library (isatools Python 2 version) in requirements. --- config/datatypes_conf.xml.sample | 6 + lib/galaxy/datatypes/isa.py | 516 ++++++++++++++++++ .../pipfiles/default/pinned-requirements.txt | 1 + 3 files changed, 523 insertions(+) create mode 100644 lib/galaxy/datatypes/isa.py diff --git a/config/datatypes_conf.xml.sample b/config/datatypes_conf.xml.sample index d4422b7adeb..a66d8b69540 100644 --- a/config/datatypes_conf.xml.sample +++ b/config/datatypes_conf.xml.sample @@ -147,6 +147,11 @@ + + + + + @@ -809,6 +814,7 @@ +