From 56e8c0db0ddec34d42bc05b72ed015549f2b3cfa Mon Sep 17 00:00:00 2001 From: Oddant1 Date: Tue, 27 Feb 2024 11:15:26 -0700 Subject: [PATCH] Only have import-fastq if the necessary types are present --- q2galaxy/core/drivers/builtins.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/q2galaxy/core/drivers/builtins.py b/q2galaxy/core/drivers/builtins.py index 6ee86c1..c1a1a7c 100644 --- a/q2galaxy/core/drivers/builtins.py +++ b/q2galaxy/core/drivers/builtins.py @@ -14,10 +14,15 @@ import qiime2.sdk import qiime2.util -from q2_types.per_sample_sequences import ( - CasavaOneEightSingleLanePerSampleDirFmt, SequencesWithQuality, - PairedEndSequencesWithQuality) -from q2_types.sample_data import SampleData +_IMPORT_FASTQ_ = True + +try: + from q2_types.per_sample_sequences import ( + CasavaOneEightSingleLanePerSampleDirFmt, SequencesWithQuality, + PairedEndSequencesWithQuality) + from q2_types.sample_data import SampleData +except Exception: + _IMPORT_FASTQ_ = False from q2galaxy.core.drivers.stdio import error_handler, stdio_files @@ -33,10 +38,13 @@ def builtin_runner(action_id, inputs): def _get_tool(action_id): builtin_map = { 'import': import_data, - 'import-fastq': import_fastq_data, 'export': export_data, 'qza_to_tabular': qza_to_tabular } + + if _IMPORT_FASTQ_: + builtin_map['import-fastq'] = import_fastq_data + try: return builtin_map[action_id] except KeyError: