Skip to content
Snippets Groups Projects
Commit a1d874e2 authored by Arthur Le Bars's avatar Arthur Le Bars
Browse files

Let galaxy decide which versions of tools it wants to use for gga_load_data.py

parent 6ba67a53
No related branches found
No related tags found
2 merge requests!9Release 2.0 (merge dev to master),!5Workflow v2
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
...@@ -127,12 +127,13 @@ class DeploySpeciesStack(speciesData.SpeciesData): ...@@ -127,12 +127,13 @@ class DeploySpeciesStack(speciesData.SpeciesData):
gspecies_compose_file.write(gspecies_compose_output) gspecies_compose_file.write(gspecies_compose_output)
galaxy_nginx_conf_template = env.get_template("galaxy_nginx.conf.j2") if not os.path.isfile(os.path.join(self.main_dir, "galaxy_nginx.conf")):
galaxy_nginx_conf_output = galaxy_nginx_conf_template.render(render_vars) galaxy_nginx_conf_template = env.get_template("galaxy_nginx.conf.j2")
with open(os.path.join(self.main_dir, "galaxy_nginx.conf"), "w") as galaxy_nginx_conf_file: galaxy_nginx_conf_output = galaxy_nginx_conf_template.render(render_vars)
logging.debug("Writing the galaxy_nginx.conf file for %s" % self.genus_species) with open(os.path.join(self.main_dir, "galaxy_nginx.conf"), "w") as galaxy_nginx_conf_file:
galaxy_nginx_conf_file.truncate(0) logging.debug("Writing the galaxy_nginx.conf file for %s" % self.genus_species)
galaxy_nginx_conf_file.write(galaxy_nginx_conf_output) galaxy_nginx_conf_file.truncate(0)
galaxy_nginx_conf_file.write(galaxy_nginx_conf_output)
# Create the volumes (directory) of the species docker-compose file # Create the volumes (directory) of the species docker-compose file
create_mounts(working_dir=".", main_dir=self.main_dir) create_mounts(working_dir=".", main_dir=self.main_dir)
......
...@@ -81,43 +81,46 @@ class LoadData(speciesData.SpeciesData): ...@@ -81,43 +81,46 @@ class LoadData(speciesData.SpeciesData):
""" """
get_organism_tool = self.instance.tools.show_tool("toolshed.g2.bx.psu.edu/repos/gga/chado_organism_get_organisms/organism_get_organisms/2.3.3") get_organism_tool = self.instance.tools.show_tool("toolshed.g2.bx.psu.edu/repos/gga/chado_organism_get_organisms/organism_get_organisms/2.3.4+galaxy0")
delete_organism_tool = self.instance.tools.show_tool("toolshed.g2.bx.psu.edu/repos/gga/chado_organism_delete_organisms/organism_delete_organisms/2.3.4+galaxy0") delete_organism_tool = self.instance.tools.show_tool("toolshed.g2.bx.psu.edu/repos/gga/chado_organism_delete_organisms/organism_delete_organisms/2.3.4+galaxy0")
if delete_organism_tool["version"] != "2.3.4+galaxy0": get_organism_tool_version = get_organism_tool["version"]
toolshed_dict = delete_organism_tool["tool_shed_repository"] delete_organism_tool_version = delete_organism_tool["version"]
logging.warning("Changeset for %s is not installed" % toolshed_dict["name"])
changeset_revision = "b1aa4f9d82fe" # if delete_organism_tool["version"] != "2.3.4+galaxy0":
name = toolshed_dict["name"] # toolshed_dict = delete_organism_tool["tool_shed_repository"]
owner = toolshed_dict["owner"] # logging.warning("Changeset for %s is not installed" % toolshed_dict["name"])
toolshed = "https://" + toolshed_dict["tool_shed"] # changeset_revision = "b1aa4f9d82fe"
logging.warning("Installing changeset for %s" % toolshed_dict["name"]) # name = toolshed_dict["name"]
# owner = toolshed_dict["owner"]
self.instance.toolshed.install_repository_revision(tool_shed_url=toolshed, name=name, owner=owner, # toolshed = "https://" + toolshed_dict["tool_shed"]
changeset_revision=changeset_revision, # logging.warning("Installing changeset for %s" % toolshed_dict["name"])
install_tool_dependencies=True,
install_repository_dependencies=False, # self.instance.toolshed.install_repository_revision(tool_shed_url=toolshed, name=name, owner=owner,
install_resolver_dependencies=True) # changeset_revision=changeset_revision,
# install_tool_dependencies=True,
# install_repository_dependencies=False,
if get_organism_tool["version"] != "2.3.3": # install_resolver_dependencies=True)
toolshed_dict = get_organism_tool["tool_shed_repository"]
logging.warning("Changeset for %s is not installed" % toolshed_dict["name"])
changeset_revision = "b07279b5f3bf" # if get_organism_tool["version"] != "2.3.4+galaxy0":
name = toolshed_dict["name"] # toolshed_dict = get_organism_tool["tool_shed_repository"]
owner = toolshed_dict["owner"] # logging.warning("Changeset for %s is not installed" % toolshed_dict["name"])
toolshed = "https://" + toolshed_dict["tool_shed"] # changeset_revision = "831229e6cda2"
logging.warning("Installing changeset for %s" % toolshed_dict["name"]) # name = toolshed_dict["name"]
# owner = toolshed_dict["owner"]
self.instance.toolshed.install_repository_revision(tool_shed_url=toolshed, name=name, owner=owner, # toolshed = "https://" + toolshed_dict["tool_shed"]
changeset_revision=changeset_revision, # logging.warning("Installing changeset for %s" % toolshed_dict["name"])
install_tool_dependencies=True,
install_repository_dependencies=False, # self.instance.toolshed.install_repository_revision(tool_shed_url=toolshed, name=name, owner=owner,
install_resolver_dependencies=True) # changeset_revision=changeset_revision,
# install_tool_dependencies=True,
# install_repository_dependencies=False,
# install_resolver_dependencies=True)
logging.debug("Getting 'Homo sapiens' ID in instance's chado database") logging.debug("Getting 'Homo sapiens' ID in instance's chado database")
get_sapiens_id_job = self.instance.tools.run_tool( get_sapiens_id_job = self.instance.tools.run_tool(
tool_id="toolshed.g2.bx.psu.edu/repos/gga/chado_organism_get_organisms/organism_get_organisms/2.3.4+galaxy0", tool_id="toolshed.g2.bx.psu.edu/repos/gga/chado_organism_get_organisms/organism_get_organisms/%s" % get_organism_tool_version,
history_id=self.history_id, history_id=self.history_id,
tool_inputs={"genus": "Homo", "species": "sapiens"}) tool_inputs={"genus": "Homo", "species": "sapiens"})
get_sapiens_id_job_output = get_sapiens_id_job["outputs"][0]["id"] get_sapiens_id_job_output = get_sapiens_id_job["outputs"][0]["id"]
...@@ -128,7 +131,7 @@ class LoadData(speciesData.SpeciesData): ...@@ -128,7 +131,7 @@ class LoadData(speciesData.SpeciesData):
sapiens_id = str( sapiens_id = str(
get_sapiens_id_final_output["organism_id"]) # needs to be str to be recognized by the chado tool get_sapiens_id_final_output["organism_id"]) # needs to be str to be recognized by the chado tool
self.instance.tools.run_tool( self.instance.tools.run_tool(
tool_id="toolshed.g2.bx.psu.edu/repos/gga/chado_organism_delete_organisms/organism_delete_organisms/2.3.4+galaxy0", tool_id="toolshed.g2.bx.psu.edu/repos/gga/chado_organism_delete_organisms/organism_delete_organisms/%s" % delete_organism_tool_version,
history_id=self.history_id, history_id=self.history_id,
tool_inputs={"organism": str(sapiens_id)}) tool_inputs={"organism": str(sapiens_id)})
except bioblend.ConnectionError: except bioblend.ConnectionError:
......
...@@ -640,25 +640,26 @@ class RunWorkflow(speciesData.SpeciesData): ...@@ -640,25 +640,26 @@ class RunWorkflow(speciesData.SpeciesData):
if dataset_dict["history_id"] == self.history_id: if dataset_dict["history_id"] == self.history_id:
if dataset_dict["name"] == self.datasets_name["genome_file"] and dataset_dict["id"] not in imported_datasets_ids: if dataset_dict["name"] == self.datasets_name["genome_file"] and dataset_dict["id"] not in imported_datasets_ids:
genome_dataset_hda_id = dataset_dict["id"] genome_dataset_hda_id = dataset_dict["id"]
logging.debug("Genome dataset hda id: %s" % genome_dataset_hda_id)
elif dataset_dict["name"] == self.datasets_name["proteins_file"] and dataset_dict["id"] not in imported_datasets_ids: elif dataset_dict["name"] == self.datasets_name["proteins_file"] and dataset_dict["id"] not in imported_datasets_ids:
proteins_datasets_hda_id = dataset_dict["id"] proteins_datasets_hda_id = dataset_dict["id"]
logging.debug("Proteins dataset hda ID: %s" % proteins_datasets_hda_id)
elif dataset_dict["name"] == self.datasets_name["transcripts_file"] and dataset_dict["id"] not in imported_datasets_ids: elif dataset_dict["name"] == self.datasets_name["transcripts_file"] and dataset_dict["id"] not in imported_datasets_ids:
transcripts_dataset_hda_id = dataset_dict["id"] transcripts_dataset_hda_id = dataset_dict["id"]
logging.debug("Transcripts dataset hda ID: %s" % transcripts_dataset_hda_id)
elif dataset_dict["name"] == self.datasets_name["gff_file"] and dataset_dict["id"] not in imported_datasets_ids: elif dataset_dict["name"] == self.datasets_name["gff_file"] and dataset_dict["id"] not in imported_datasets_ids:
gff_dataset_hda_id = dataset_dict["id"] gff_dataset_hda_id = dataset_dict["id"]
logging.debug("GFF dataset hda ID: %s" % gff_dataset_hda_id)
if "interproscan_file" in self.datasets_name.keys(): if "interproscan_file" in self.datasets_name.keys():
if dataset_dict["name"] == self.datasets_name["interproscan_file"] and dataset_dict["id"] not in imported_datasets_ids: if dataset_dict["name"] == self.datasets_name["interproscan_file"] and dataset_dict["id"] not in imported_datasets_ids:
interproscan_dataset_hda_id = dataset_dict["id"] interproscan_dataset_hda_id = dataset_dict["id"]
logging.debug("InterproScan dataset hda ID: %s" % gff_dataset_hda_id)
if "blast_diamond_file" in self.datasets_name.keys(): if "blast_diamond_file" in self.datasets_name.keys():
if dataset_dict["name"] == self.datasets_name["blast_diamond_file"] and dataset_dict["id"] not in imported_datasets_ids: if dataset_dict["name"] == self.datasets_name["blast_diamond_file"] and dataset_dict["id"] not in imported_datasets_ids:
blast_diamond_dataset_hda_id = dataset_dict["id"] blast_diamond_dataset_hda_id = dataset_dict["id"]
logging.debug("Blast Diamond dataset hda ID: %s" % gff_dataset_hda_id)
logging.debug("Genome dataset hda id: %s" % genome_dataset_hda_id)
logging.debug("Proteins dataset hda ID: %s" % proteins_datasets_hda_id)
logging.debug("Transcripts dataset hda ID: %s" % transcripts_dataset_hda_id)
logging.debug("GFF dataset hda ID: %s" % gff_dataset_hda_id)
logging.debug("InterproScan dataset hda ID: %s" % gff_dataset_hda_id)
logging.debug("Blast Diamond dataset hda ID: %s" % gff_dataset_hda_id)
# Add datasets IDs to already imported IDs (so we don't assign all the wrong IDs to the next organism if there is one) # Add datasets IDs to already imported IDs (so we don't assign all the wrong IDs to the next organism if there is one)
imported_datasets_ids.append(genome_dataset_hda_id) imported_datasets_ids.append(genome_dataset_hda_id)
...@@ -1200,6 +1201,8 @@ if __name__ == "__main__": ...@@ -1200,6 +1201,8 @@ if __name__ == "__main__":
workflow_dict["steps"]["10"]["tool_state"] = workflow_dict["steps"]["10"]["tool_state"].replace("__FULL_NAME_ORG1__", org1_full_name).replace("__UNIQUE_ID_ORG1__", org1_species_folder_name) workflow_dict["steps"]["10"]["tool_state"] = workflow_dict["steps"]["10"]["tool_state"].replace("__FULL_NAME_ORG1__", org1_full_name).replace("__UNIQUE_ID_ORG1__", org1_species_folder_name)
workflow_dict["steps"]["10"]["tool_state"] = workflow_dict["steps"]["10"]["tool_state"].replace("__FULL_NAME_ORG2__", org2_full_name).replace("__UNIQUE_ID_ORG2__", org2_species_folder_name) workflow_dict["steps"]["10"]["tool_state"] = workflow_dict["steps"]["10"]["tool_state"].replace("__FULL_NAME_ORG2__", org2_full_name).replace("__UNIQUE_ID_ORG2__", org2_species_folder_name)
print(workflow_dict)
# Import the workflow in galaxy as a dict # Import the workflow in galaxy as a dict
instance.workflows.import_workflow_dict(workflow_dict=workflow_dict) instance.workflows.import_workflow_dict(workflow_dict=workflow_dict)
......
...@@ -87,7 +87,9 @@ class SpeciesData: ...@@ -87,7 +87,9 @@ class SpeciesData:
self.datasets = dict() self.datasets = dict()
self.config = None # Custom config used to set environment variables inside containers self.config = None # Custom config used to set environment variables inside containers
self.species_folder_name = "_".join(utilities.filter_empty_not_empty_items([self.genus_lowercase.lower(), self.species.lower(), self.strain.lower(), self.sex.lower()])["not_empty"]) self.species_folder_name = "_".join(utilities.filter_empty_not_empty_items([self.genus_lowercase.lower(), self.species.lower(), self.strain.lower(), self.sex.lower()])["not_empty"])
self.species_folder_name = self.species_folder_name .replace("-", "_").replace('__', '_') self.species_folder_name = self.species_folder_name .replace("-", "_").replace('__', '_').replace("(", "_").replace(")", "_")
if self.species_folder_name.endswith("_"):
self.species_folder_name = self.species_folder_name[0:-2]
self.existing_folders_cache = {} self.existing_folders_cache = {}
self.bam_metadata_cache = {} self.bam_metadata_cache = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment