From 06ed01a329bd3957456f29ce405a4a2e93c5c289 Mon Sep 17 00:00:00 2001
From: Arthur Le Bars <arthur.le-bars@sb-roscoff.fr>
Date: Tue, 23 Mar 2021 11:27:07 +0100
Subject: [PATCH] instanceu_url format fix

---
 gga_load_data.py              | 2 +-
 run_workflow_phaeoexplorer.py | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gga_load_data.py b/gga_load_data.py
index 3e05a72..d6f944a 100644
--- a/gga_load_data.py
+++ b/gga_load_data.py
@@ -363,7 +363,7 @@ if __name__ == "__main__":
         # Parse the config yaml file
         load_data_for_current_species.config = utilities.parse_config(args.config)
         # Set the instance url attribute -- Does not work with localhost on scratch (ALB)
-        load_data_for_current_species.instance_url = "http://localhost/sp/{1}_{2}/galaxy/".format(
+        load_data_for_current_species.instance_url = "http://localhost/sp/{0}_{1}/galaxy/".format(
                 load_data_for_current_species.genus_lowercase,
                 load_data_for_current_species.species)
 
diff --git a/run_workflow_phaeoexplorer.py b/run_workflow_phaeoexplorer.py
index 4125f52..786afe8 100644
--- a/run_workflow_phaeoexplorer.py
+++ b/run_workflow_phaeoexplorer.py
@@ -488,8 +488,9 @@ class RunWorkflow(speciesData.SpeciesData):
 
             # In case of the Jbrowse workflow, we unfortunately have to manually edit the parameters instead of setting them
             # as runtime values, using runtime parameters makes the tool throw an internal critical error ("replace not found" error)
+            # Scratchgmod test: need "http" (or "https"), the hostname (+ port)
             if workflow_name == "Jbrowse":
-                workflow_dict["steps"]["2"]["tool_state"] = workflow_dict["steps"]["2"]["tool_state"].replace("__MENU_URL__", "https://{hostname}:{port}/sp/{genus_sp}/feature/{Genus}/{species}/{id}".format(hostname=self.config["hostname"], port=self.config["https_port"], genus_sp=self.genus_species, Genus=self.genus_uppercase, species=self.species, id="{id}"))
+                workflow_dict["steps"]["2"]["tool_state"] = workflow_dict["steps"]["2"]["tool_state"].replace("__MENU_URL__", "https://{hostname}/sp/{genus_sp}/feature/{Genus}/{species}/{id}".format(hostname=self.config["hostname"], genus_sp=self.genus_species, Genus=self.genus_uppercase, species=self.species, id="{id}"))
                 # The UNIQUE_ID is specific to a combination genus_species_strain_sex so every combination should have its unique workflow
                 # in galaxy --> define a naming method for these workflows
                 workflow_dict["steps"]["3"]["tool_state"] = workflow_dict["steps"]["3"]["tool_state"].replace("__FULL_NAME__", self.full_name).replace("__UNIQUE_ID__", self.abbreviation)
@@ -847,7 +848,7 @@ if __name__ == "__main__":
             # Parse the config yaml file
             run_workflow_for_current_organism.config = utilities.parse_config(args.config)
             # Set the instance url attribute --> TODO: the localhost rule in the docker-compose still doesn't work on scratchgmodv1
-            run_workflow_for_current_organism.instance_url = "http://localhost/sp/{1}_{2}/galaxy/".format( 
+            run_workflow_for_current_organism.instance_url = "http://localhost/sp/{0}_{1}/galaxy/".format( 
                 run_workflow_for_current_organism.genus_lowercase,
                 run_workflow_for_current_organism.species)
 
-- 
GitLab