From 07d45756bd4cc3c8216905570a64f93f50829765 Mon Sep 17 00:00:00 2001 From: Loraine Gueguen <loraine.gueguen@sb-roscoff.fr> Date: Sun, 30 May 2021 22:37:06 +0200 Subject: [PATCH] fix library_id --- gga_load_data.py | 4 ++-- gga_run_workflow_phaeo_jbrowse.py | 12 +++++++++++- speciesData.py | 1 - 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gga_load_data.py b/gga_load_data.py index f4e0818..726b4e9 100755 --- a/gga_load_data.py +++ b/gga_load_data.py @@ -86,8 +86,8 @@ class LoadData(speciesData.SpeciesData): logging.info("Creating new %s library" % constants.GALAXY_LIBRARY_NAME) prj_lib = gio.libraries.create(constants.GALAXY_LIBRARY_NAME, constants.GALAXY_LIBRARY_DESC) - self.library_id = prj_lib.id # project data folder/library - logging.info("Library for {0}: {1}".format(self.full_name, self.library_id)) + library_id = prj_lib.id # project data folder/library + logging.info("Library for {0}: {1}".format(self.full_name, library_id)) for fname, files in folders.items(): if fname and files: diff --git a/gga_run_workflow_phaeo_jbrowse.py b/gga_run_workflow_phaeo_jbrowse.py index e6eada5..b7a9a24 100644 --- a/gga_run_workflow_phaeo_jbrowse.py +++ b/gga_run_workflow_phaeo_jbrowse.py @@ -8,6 +8,7 @@ import logging import sys import json import time +from bioblend.galaxy.objects import GalaxyInstance import utilities import utilities_bioblend @@ -185,7 +186,16 @@ class RunWorkflowJbrowse(runWorkflowPhaeo.RunWorkflow): transcripts_hda_id = None proteins_hda_id = None - folder_dict_list = self.instance.libraries.get_folders(library_id=str(self.library_id)) + gio = GalaxyInstance(url=self.instance_url, + email=self.config[constants.CONF_GALAXY_DEFAULT_ADMIN_EMAIL], + password=self.config[constants.CONF_GALAXY_DEFAULT_ADMIN_PASSWORD] + ) + prj_lib = gio.libraries.get_previews(constants.GALAXY_LIBRARY_NAME) + if len(prj_lib) == 1: + library_id = prj_lib[0].id + else: + logging.error("Multiple (or no one) libraries '%s' exist" % constants.GALAXY_LIBRARY_NAME) + folder_dict_list = self.instance.libraries.get_folders(library_id=str(library_id)) folders_id_dict = {} diff --git a/speciesData.py b/speciesData.py index 3d41670..4102680 100755 --- a/speciesData.py +++ b/speciesData.py @@ -140,4 +140,3 @@ class SpeciesData: self.instance = None self.history_id = None self.history_name = str(self.genus_species) - self.library_id = None -- GitLab