Skip to content
Snippets Groups Projects

Run wf

Merged Loraine Gueguen requested to merge run_wf into dev
Files
3
@@ -7,7 +7,6 @@ import os
import logging
import sys
import json
import time
from bioblend.galaxy.objects import GalaxyInstance
import utilities
@@ -66,9 +65,11 @@ class RunWorkflowJbrowse(runWorkflowPhaeo.RunWorkflow):
self.abbreviation = self.genus_uppercase[0] + ". " + self.chado_species_name
self.common = self.name
self.common = self.genus_uppercase + " " + self.chado_species_name
if not self.common_name is None and self.common_name != "":
self.common = self.common_name
# common_name only is not sufficient as may not be unique between the different strains of the species and
# galaxy will throw error "OrgWorkflowParam"
self.common = self.common + " (" + self.common_name + ")"
self.genome_analysis_name = "genome v{0} of {1}".format(self.genome_version, self.full_name)
self.genome_analysis_programversion = "genome v{0}".format(self.genome_version)
@@ -156,13 +157,14 @@ class RunWorkflowJbrowse(runWorkflowPhaeo.RunWorkflow):
tool_inputs={"abbr": self.abbreviation,
"genus": self.genus_uppercase,
"species": self.chado_species_name,
"common": self.common})
"common": self.common},
time_sleep=10
)
organism_dict = json.loads(add_organism_tool_dataset)
org_id = str(organism_dict["organism_id"]) # id needs to be a str to be recognized by chado tools
# Synchronize newly added organism in Tripal
logging.info("Synchronizing organism %s in Tripal" % self.full_name)
time.sleep(60)
utilities_bioblend.run_tool(
instance=self.instance,
tool_id=constants_phaeo.ORGANISM_SYNC_TOOL_ID,
@@ -171,7 +173,7 @@ class RunWorkflowJbrowse(runWorkflowPhaeo.RunWorkflow):
return org_id
def import_datasets_into_history(self):
def import_datasets_into_history(self, config):
"""
Find datasets in a library, get their ID and import them into the current history if they are not already
"""
@@ -187,14 +189,15 @@ class RunWorkflowJbrowse(runWorkflowPhaeo.RunWorkflow):
proteins_hda_id = None
gio = GalaxyInstance(url=self.instance_url,
email=self.config[constants.CONF_GALAXY_DEFAULT_ADMIN_EMAIL],
password=self.config[constants.CONF_GALAXY_DEFAULT_ADMIN_PASSWORD]
email=config[constants.CONF_GALAXY_DEFAULT_ADMIN_EMAIL],
password=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)
logging.critical("Multiple (or no one) libraries '%s' exist" % constants.GALAXY_LIBRARY_NAME)
sys.exit()
folder_dict_list = self.instance.libraries.get_folders(library_id=str(library_id))
folders_id_dict = {}
@@ -227,7 +230,7 @@ class RunWorkflowJbrowse(runWorkflowPhaeo.RunWorkflow):
elif ldda_name.endswith(self.gff_filename):
gff_ldda_id = ldda_id
hda_list = self.instance.datasets.get_datasets(self.history_id)
hda_list = self.instance.datasets.get_datasets()
# Finding datasets in history (matching datasets names)
for hda in hda_list:
hda_name = hda["name"]
@@ -284,7 +287,7 @@ def prepare_history_and_get_wf_param(sp_dict_list, main_dir, config):
run_workflow_for_current_organism.set_galaxy_instance(config)
run_workflow_for_current_organism.set_history()
run_workflow_for_current_organism.install_individual_tools()
run_workflow_for_current_organism.import_datasets_into_history()
run_workflow_for_current_organism.import_datasets_into_history(config)
analyses_dict_list = run_workflow_for_current_organism.get_analyses()
Loading