diff --git a/__pycache__/docker_compose_generator.cpython-38.pyc b/__pycache__/docker_compose_generator.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..84d509046e11c2024881f7fc2b2a27ec25116d56 Binary files /dev/null and b/__pycache__/docker_compose_generator.cpython-38.pyc differ diff --git a/__pycache__/metadata_generator.cpython-38.pyc b/__pycache__/metadata_generator.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f693bd48b005c04c666e0e91a23b55d5e922f8d Binary files /dev/null and b/__pycache__/metadata_generator.cpython-38.pyc differ diff --git a/__pycache__/table_parser.cpython-38.pyc b/__pycache__/table_parser.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..acfef713a99d6e9df6999bde42a8dfc2a24bb97c Binary files /dev/null and b/__pycache__/table_parser.cpython-38.pyc differ diff --git a/autoload.py b/autoload.py index c26495b92f655999e35c657c3ed60a7988c0d549..29ff70210a63fc1e6cb8c0e705c5145e24f4c6f4 100644 --- a/autoload.py +++ b/autoload.py @@ -517,7 +517,8 @@ if __name__ == "__main__": " modify headers (abims), generate blast banks (doesn't commit them: TODO), initialize GGA instance, load the data and run," " the main workflow. To update/add data to container, use --update in conjunction to --full (TODO)") parser.add_argument("--init-instance", - help="Initialization of galaxy instance. Run first in an empty instance") + help="Initialization of galaxy instance. Run first in an empty instance", + action="store_true") parser.add_argument("--load-data", help="Create src_data directory tree and load its data into the instance") parser.add_argument("--run-main", @@ -551,6 +552,7 @@ if __name__ == "__main__": logging.basicConfig(level=logging.INFO) if str(args.input).endswith(".json"): + print("JSON") input_json = args.input else: tp = table_parser.TableParser() @@ -564,6 +566,7 @@ if __name__ == "__main__": for json_sp in json_sp_dict: sp_dict_list.append(json_sp) + metadata = {} for sp_dict in sp_dict_list: al = Autoload(species_parameters_dictionary=sp_dict, args=args) al.main_dir = os.path.abspath(args.dir) @@ -574,7 +577,7 @@ if __name__ == "__main__": metadata[genus_species_strain_sex]["initialized"] = True if args.load_data: logging.info("loading data into galaxy") - al.load_data_in_galaxy() + # al.load_data() metadata[genus_species_strain_sex]["data_loaded_in_instance"] = True if args.run_main: logging.info("running main workflow") diff --git a/docker_compose_generator.py b/docker_compose_generator.py index e76198bae1a8835096a1f326394aa338c7a4c022..c999460b8d0278003c7b8eecc81d248d18c90218 100644 --- a/docker_compose_generator.py +++ b/docker_compose_generator.py @@ -17,6 +17,8 @@ TODO: write the whole yml dict from scratch (would allow the script to be more r more customizable while being clearer (instead of the default yml string or input docker-compose template) TODO: read json + +API master key or galaxy: MASTER_API_KEY: XXXXXXX (alphanum, user prompt/git env variable) """ diff --git a/table_parser.py b/table_parser.py index 0059fdbe72c3b08f63ea8f3b634f81b6e5545885..9c44cd8da9fee254e6de27335684b8e096d242bc 100755 --- a/table_parser.py +++ b/table_parser.py @@ -1,4 +1,5 @@ import os +import sys import pandas # xlrd required for excel files reading import numpy import json @@ -28,54 +29,35 @@ class TableParser: def parse_table(self, extension): if extension == "xls": pandas_table = pandas.DataFrame(pandas.read_excel(self.table_file)) - pandas_table = pandas_table.replace(numpy.nan, "", regex=True) - for char in " ,.()-/": - pandas_table = pandas_table.replace("\\" + char, "_", regex=True) - pandas_table = pandas_table.replace("\\__", "_", regex=True) - pandas_table.loc[pandas_table["genome version"] == "", "genome version"] = "1.0" - pandas_table.loc[pandas_table["ogs version"] == "", "ogs version"] = "1.0" - pandas_table.loc[pandas_table["version"] == "", "version"] = "1.0" - pandas_table.loc[pandas_table["date"] == "", "date"] = datetime.today().strftime("%Y-%m-%d") - with open(os.path.join(self.dir, self.json_file), 'w') as json_file: - json_file.truncate(0) - json_content = list() - for organism in range(0, len(pandas_table.index)): - organism_dict = pandas_table.iloc[organism].to_dict() - for k, v in organism_dict.items(): - v = str(v).split(" ") - v = "_".join(v) - v = v.replace("__", "_") - if v.endswith("_"): - v = v[:-1] - json_content.append(organism_dict) - json.dump(json_content, json_file, indent=4) - elif extension == "csv": pandas_table = pandas.DataFrame(pandas.read_csv(self.table_file)) - pandas_table = pandas_table.replace(numpy.nan, "", regex=True) - for char in " ,.()-/": - pandas_table = pandas_table.replace("\\" + char, "_", regex=True) - pandas_table = pandas_table.replace("\\__", "_", regex=True) - pandas_table.loc[pandas_table["genome version"] == "", "genome version"] = "1.0" - pandas_table.loc[pandas_table["ogs version"] == "", "ogs version"] = "1.0" - pandas_table.loc[pandas_table["version"] == "", "version"] = "1.0" - pandas_table.loc[pandas_table["date"] == "", "date"] = datetime.today().strftime("%Y-%m-%d") - with open(os.path.join(self.dir, self.json_file), 'w') as json_file: - json_file.truncate(0) - json_content = list() - for organism in range(0, len(pandas_table.index)): - organism_dict = pandas_table.iloc[organism].to_dict() - for k, v in organism_dict.items(): - v = str(v).split(" ") - v = "_".join(v) - v = v.replace("__", "_") - if v.endswith("_"): - v = v[:-1] - json_content.append(organism_dict) - json.dump(json_content, json_file, indent=4) - else: - logging.info("input tabulated file doesn't have the correct extension (supported extensions: xls, xlsx, csv)") + logging.info("wrong format: input tabulated file cannot be read (supported formats: xls, xlsx, csv)") + sys.exit() + pandas_table = pandas_table.replace(numpy.nan, "", regex=True) + + for char in " ,.()-/": + pandas_table = pandas_table.replace("\\" + char, "_", regex=True) + pandas_table = pandas_table.replace("\\__", "_", regex=True) + pandas_table.loc[pandas_table["genome version"] == "", "genome version"] = "1.0" + pandas_table.loc[pandas_table["ogs version"] == "", "ogs version"] = "1.0" + pandas_table.loc[pandas_table["version"] == "", "version"] = "1.0" + pandas_table.loc[pandas_table["date"] == "", "date"] = datetime.today().strftime("%Y-%m-%d") + with open(os.path.join(self.dir, self.json_file), 'w') as json_file: + json_file.truncate(0) + json_content = list() + for organism in range(0, len(pandas_table.index)): + organism_dict = pandas_table.iloc[organism].to_dict() + for k, v in organism_dict.items(): + v = str(v).split(" ") + v = "_".join(v) + v = v.replace("__", "_") + if v.endswith("_"): + v = v[:-1] + json_content.append(organism_dict) + json.dump(json_content, json_file, indent=4) + + def write_json(self, data, filename): with open(filename, 'w') as f: diff --git a/templates/compose-template.yml b/templates/compose-template.yml index ee3e04ebf89f21498de0f10ea2e46aa1ff5cc1bb..590923cd3b27ff536dd15d51931524783b5c52a3 100755 --- a/templates/compose-template.yml +++ b/templates/compose-template.yml @@ -110,6 +110,7 @@ services: GALAXY_AUTO_UPDATE_DB: 1 GALAXY_AUTO_UPDATE_CONDA: 1 GALAXY_AUTO_UPDATE_TOOLS: "/galaxy-central/tools_1.yaml" + MASTER_API_KEY: dev BLAT_ENABLED: 1 jbrowse: diff --git a/templates/stack_template.yml b/templates/stack_template.yml index 68adc74b0148d4a44c653e1e0b1f12b538a6064b..1844b7c958d481490e6258aca9d9d2bdab071edf 100755 --- a/templates/stack_template.yml +++ b/templates/stack_template.yml @@ -138,7 +138,7 @@ services: GALAXY_AUTO_UPDATE_TOOLS: "/galaxy-central/tools_1.yaml" GALAXY_SHARED_DIR: "" BLAT_ENABLED: 1 - master_api_key: MASTERLOCK + MASTER_API_KEY: dev networks: - traefik - genus_species