From 22c16d558d2984f8541cf130e3f6c2738cae37db Mon Sep 17 00:00:00 2001 From: Oleg Zharkov Date: Thu, 4 Feb 2021 17:04:52 +0100 Subject: [PATCH] fix composite images report --- .../Dataset/DatasetIndex/DatasetIndex.vue | 5 +---- .../components/Dataset/compositeDatasetUtils.js | 6 +----- lib/galaxy/managers/markdown_util.py | 17 ++++++----------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/client/src/components/Dataset/DatasetIndex/DatasetIndex.vue b/client/src/components/Dataset/DatasetIndex/DatasetIndex.vue index 762e014b574..fb89015727e 100644 --- a/client/src/components/Dataset/DatasetIndex/DatasetIndex.vue +++ b/client/src/components/Dataset/DatasetIndex/DatasetIndex.vue @@ -46,10 +46,7 @@ export default { pathDestination.filepath ); } else if (this.path === undefined || this.path === "undefined") { - this.directoryContent = this.removeParentDirectory( - pathDestination.datasetContent, - pathDestination.datasetRootDir - ); + this.directoryContent = pathDestination.datasetContent } else { this.errorMessage = `is not found!`; } diff --git a/client/src/components/Dataset/compositeDatasetUtils.js b/client/src/components/Dataset/compositeDatasetUtils.js index 67a0bdf5f27..9c83c561314 100644 --- a/client/src/components/Dataset/compositeDatasetUtils.js +++ b/client/src/components/Dataset/compositeDatasetUtils.js @@ -6,15 +6,11 @@ export const getPathDestination = async (history_dataset_id, path) => { const services = new Services({ root: getAppRoot() }); const computePathDestination = (pathDestination) => { - if (pathDestination.datasetContent[0].class === "Directory") - pathDestination.datasetRootDir = datasetContent[0].path; - else return; - if (path === undefined || path === "undefined") { return pathDestination; } - const filepath = `${pathDestination.datasetRootDir}/${path}`; + const filepath = path; const datasetEntry = datasetContent.find((datasetEntry) => { return filepath === datasetEntry.path; diff --git a/lib/galaxy/managers/markdown_util.py b/lib/galaxy/managers/markdown_util.py index 4005a4f1aca..34c441ce3bc 100644 --- a/lib/galaxy/managers/markdown_util.py +++ b/lib/galaxy/managers/markdown_util.py @@ -49,6 +49,7 @@ ARG_VAL_CAPTURED_REGEX = r'''(?:([\w_\-\|]+)|\"([^\"]+)\"|\'([^\']+)\')''' OUTPUT_LABEL_PATTERN = re.compile(r'output=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX) INPUT_LABEL_PATTERN = re.compile(r'input=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX) STEP_LABEL_PATTERN = re.compile(r'step=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX) +PATH_LABEL_PATTERN = re.compile(r'path=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX) # STEP_OUTPUT_LABEL_PATTERN = re.compile(r'step_output=([\w_\-]+)/([\w_\-]+)') UNENCODED_ID_PATTERN = re.compile(r'(workflow_id|history_dataset_id|history_dataset_collection_id|job_id|invocation_id)=([\d]+)') ENCODED_ID_PATTERN = re.compile(r'(workflow_id|history_dataset_id|history_dataset_collection_id|job_id|invocation_id)=([a-z0-9]+)') @@ -386,21 +387,15 @@ class ToBasicMarkdownDirectiveHandler(GalaxyInternalMarkdownDirectiveHandler): def handle_dataset_as_image(self, line, hda): dataset = hda.dataset - print("!!!!!!!!!!!") - print("!!!!!!!!!!!") - print("!!!!!!!!!!!") - print("!!!!!!!!!!!") - print("!!!!!!!!!!!") - print("!!!!!!!!!!!") - print("!!!!!!!!!!!") - print(line) name = hda.name or '' - + filepath = re.search(PATH_LABEL_PATTERN, line).group(2) + + if "path" in line: - file = os.path.join(hda.extra_files_path, 'GSM461178_untreat_paired_subset_1_fastq_fastqc/Images/per_sequence_quality.png') + file = os.path.join(hda.extra_files_path, filepath) else: file = dataset.file_name - + with open(file, "rb") as f: base64_image_data = base64.b64encode(f.read()).decode("utf-8") rval = (f"![{name}](data:image/png;base64,{base64_image_data})", True)