# HG changeset patch # User iuc # Date 1773172906 0 # Node ID 7207818691affd9226b934499394df04cd7a7dac planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/data_managers/data_manager_celltypist_models commit c2ec745fbeb5e03e8c4e111c87c85823ebe08b43 diff -r 000000000000 -r 7207818691af data_manager/celltypist_model_downloader.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/celltypist_model_downloader.py Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,114 @@ +import argparse +import json +import re +import sys +from pathlib import Path + +import requests + +MODEL_JSON_URL = "https://celltypist.cog.sanger.ac.uk/models/models.json" + + +def fetch_json(url, timeout=30): + response = requests.get(url, timeout=timeout) + response.raise_for_status() + return response.json() + + +def safe_download(url, dest, timeout=30): + Path(dest).parent.mkdir(parents=True, exist_ok=True) + print(f"Downloading {url} to {dest}") + + response = requests.get(url, timeout=timeout) + response.raise_for_status() + with open(dest, "wb") as fh: + fh.write(response.content) + + +def model_version(filename, version): + base = Path(filename).stem.replace(" ", "_").replace("/", "_") + return f"{base}_{version}" + + +def main(): + p = argparse.ArgumentParser() + p.add_argument("--out", required=True, help="Output JSON file") + p.add_argument("--model", default="", help="Model name to download, leave empty for all models") + p.add_argument("--version", default="", help="Model version to download, or empty for latest") + args = p.parse_args() + + with open(args.out) as fh: + params = json.load(fh) + target_directory = Path(params["output_data"][0]["extra_files_path"]) + target_directory.mkdir(parents=True, exist_ok=True) + + print(f"Fetching model metadata from {MODEL_JSON_URL}...", file=sys.stderr) + models = fetch_json(MODEL_JSON_URL).get("models", []) + + # Filter by model name if specified + if args.model and args.model != "": + target = args.model + models = [m for m in models if m.get("filename", "").replace(".pkl", "") == target] + + # Handle version filtering + if args.version and models: + requested_version = args.version if args.version.startswith("v") else f"v{args.version}" + versioned_model = next((m for m in models if m.get("version", "") == requested_version), None) + if versioned_model: + models = [versioned_model] + else: + latest_url = models[0].get("url") + # The json only contains the latest version. So attempt to construct the requested version URL by replacing the version in the latest URL. + # Attempt to construct the requested version URL by replacing the version in the latest URL + requested_url = re.sub(r"/v\d+/", f"/{requested_version}/", latest_url) + + if requested_url != latest_url: + models[0]["url"] = requested_url + models[0]["version"] = requested_version + + # If no version specified, use all models from JSON (which contains only latest versions) + + out_json = {"data_tables": {"celltypist_models": []}} + + for m in models: + filename = m.get("filename", "") + url = m.get("url") + name = m.get("details", "") + version = m.get("version", "") + date = m.get("date", "") + + if name and version: + name_with_version = f"{name} ({version})" + else: + name_with_version = name + + model = model_version(filename, version) + + # Download model files + if url: + dest_path = target_directory / f"{model}.pkl" + if not dest_path.exists(): + print(f"Downloading {filename}...", file=sys.stderr) + try: + safe_download(url, str(dest_path)) + except requests.RequestException as exc: + print(f"Error: Failed to download {filename}({version}): {exc}", file=sys.stderr) + sys.exit(1) + path_value = str(dest_path.resolve()) + else: + path_value = "" + + out_json["data_tables"]["celltypist_models"].append({ + "value": model, + "name": name_with_version, + "date": date, + "path": path_value, + }) + + # Write back the data_manager_json with updated data tables + with open(args.out, "w") as f: + json.dump(out_json, f, indent=2) + + +if __name__ == "__main__": + main() diff -r 000000000000 -r 7207818691af data_manager/celltypist_model_downloader.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager/celltypist_model_downloader.xml Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,120 @@ + + Download or register CellTypist models + + + python + requests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Downloads CellTypist models from the official repository (https://celltypist.cog.sanger.ac.uk/models/models.json) and registers them as Galaxy data tables. + + + 10.1126/science.abl5197 + + diff -r 000000000000 -r 7207818691af data_manager_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data_manager_conf.xml Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + ${GALAXY_DATA_MANAGER_DATA_PATH}/celltypist + abspath + + + + + diff -r 000000000000 -r 7207818691af test-data/celltypist_models.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/celltypist_models.loc Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,61 @@ +Immune_All_Low_v1 immune sub-populations combined from 20 tissues of 18 studies (v1) 2022-07-16 00:20:42.927778 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Immune_All_Low_v2 immune sub-populations combined from 20 tissues of 18 studies (v2) 2022-07-16 00:20:42.927778 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Immune_All_High_v2 immune populations combined from 20 tissues of 18 studies (v2) 2022-07-16 08:53:00.959521 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_COVID19_PBMC_v1 peripheral blood mononuclear cell types from COVID-19 patients and healthy controls (v1) 2024-06-24 19:37:48.634397 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_CynomolgusMacaque_Hippocampus_v1 cell types from the hippocampus of adult cynomolgus monkeys (Macaca fascicularis) (v1) 2023-07-15 19:44:09.541019 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Human_MTG_v1 cell types and subtypes (10x-based) from the adult human middle temporal gyrus (v1) 2024-09-05 12:16:32.271311 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Human_PancreaticIslet_v1 cell types from pancreatic islets of healthy adult humans (v1) 2023-09-15 12:01:27.068556 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Human_PrefrontalCortex_v1 cell types and subtypes from the adult human dorsolateral prefrontal cortex (v1) 2024-09-05 11:40:55.636137 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Human_Skin_v1 cell types from human healthy adult skin (v1) 2023-09-22 18:13:10.902604 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Human_Vascular_v1 vascular populations combined from multiple adult human organs (v1) 2024-12-19 16:51:45.315630 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Mouse_Gut_v2 cell types in the adult mouse gut combined from eight datasets (v2) 2022-08-08 05:26:50.850176 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Mouse_OlfactoryBulb_v1 cell types from the olfactory bulb of adult mice (v1) 2023-07-22 22:13:33.861503 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_Pig_Hippocampus_v1 cell types from the adult pig hippocampus (v1) 2023-07-14 21:40:10.051325 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_RhesusMacaque_Hippocampus_v1 cell types from the hippocampus of adult rhesus monkeys (Macaca mulatta) (v1) 2023-07-14 21:47:21.380795 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_cHSPCs_Illumina_v1 human circulating hematopoietic stem and progenitor cell types in aging, cytopenia, and myelodysplastic syndrome (Illumina) (v1) 2025-09-10 17:01:11.664746 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Adult_cHSPCs_Ultima_v1 human circulating hematopoietic stem and progenitor cell types in aging, cytopenia, and myelodysplastic syndrome (Ultima) (v1) 2025-09-10 15:52:19.243991 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Autopsy_COVID19_Lung_v1 cell types from the lungs of 16 SARS-CoV-2 infected COVID-19 autopsy adult donors (v1) 2022-11-19 12:00:00.583922 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +COVID19_HumanChallenge_Blood_v1 detailed blood cell states from 16 individuals after being challenged with SARS-CoV-2 (v1) 2022-09-29 17:40:05.907115 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +COVID19_Immune_Landscape_v1 immune subtypes from lung and blood of COVID-19 patients and healthy controls (v1) 2022-04-08 02:01:02.730893 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Cells_Adult_Breast_v1 cell types from the adult human breast (v1) 2024-04-20 21:09:27.948338 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Cells_Fetal_Lung_v2 cell types from human embryonic and fetal lungs (v2) 2022-10-15 13:54:37.427721 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Cells_Human_Tonsil_v1 tonsillar cell types from humans (3-65 years) (v1) 2024-04-21 17:50:57.165795 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Cells_Intestinal_Tract_v1 intestinal cells from fetal, pediatric (healthy and Crohn's disease) and adult human gut (v1) 2021-12-17 17:15:04.575098 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Cells_Lung_Airway_v4 cell populations from scRNA-seq of five locations of the human lungs and airways (v4) 2022-09-26 20:32:26.712486 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Human_Brain_v1 cell types from the first-trimester developing human brain (v1) 2022-10-29 21:02:53.713593 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Human_Gonads_v1 cell types of human gonadal and adjacent extragonadal tissue from the first and second trimesters of gestation (v1) 2023-09-16 02:07:24.874009 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Human_Hippocampus_v1 cell types from the developing human hippocampus (v1) 2023-07-18 09:28:10.712405 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Human_Organs_v1 cell types of five endoderm-derived organs in developing humans from 7–21 post-conception weeks (v1) 2023-09-17 13:47:50.974219 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Human_Thymus_v1 cell populations in embryonic, fetal, pediatric, and adult stages of the human thymus (v1) 2022-12-01 02:50:48.767817 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Mouse_Brain_v1 cell types from the embryonic mouse brain between gastrulation and birth (v1) 2022-01-25 09:00:56.249989 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Developing_Mouse_Hippocampus_v1 cell types from the mouse hippocampus at postnatal day 7 (v1) 2023-07-18 22:51:57.960310 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Fetal_Human_AdrenalGlands_v1 cell types of human fetal adrenal glands from 8 to 14 post-conceptional weeks (v1) 2023-09-17 10:03:32.274480 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Fetal_Human_Pancreas_v1 pancreatic cell types from human embryos at 9-19 weeks post conception (v1) 2023-09-17 16:29:53.752285 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Fetal_Human_Pituitary_v1 cell types of human fetal pituitaries from 7 to 25 weeks postfertilization (v1) 2023-09-17 11:06:13.979445 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Fetal_Human_Retina_v1 cell types from human fetal neural retina and retinal pigment epithelium (v1) 2023-09-17 09:17:11.379366 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Fetal_Human_Skin_v1 cell types from developing human fetal skin (v1) 2023-09-20 19:14:33.808090 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Healthy_Adult_Heart_v1 cell types from eight anatomical regions of the healthy adult human heart (v1) 2023-02-27 16:03:27.613149 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Healthy_COVID19_PBMC_v1 peripheral blood mononuclear cell types from healthy and COVID-19 individuals (v1) 2022-03-10 05:08:08.224597 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Healthy_Human_Liver_v1 cell types from scRNA-seq and snRNA-seq of the adult human liver (v1) 2023-09-14 12:48:54.179790 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Healthy_Mouse_Liver_v1 cell types from scRNA-seq and snRNA-seq of the healthy murine liver (v1) 2023-07-28 12:16:49.675179 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_AdultAged_Hippocampus_v1 cell types from the hippocampus of adult and aged humans (v1) 2023-07-16 10:03:59.893289 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Colorectal_Cancer_v1 cell types of colon tissues from patients with colorectal cancer (v1) 2024-04-26 20:47:44.844844 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Developmental_Retina_v1 cell types from human fetal retina (v1) 2023-09-17 20:42:25.314063 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Embryonic_YolkSac_v1 cell types of the human yolk sac from 4-8 post-conception weeks (v1) 2023-09-14 17:32:58.768364 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Endometrium_Atlas_v1 endometrial cell types integrated from seven datasets across the menstrual cycle (v1) 2025-01-09 15:43:11.091556 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_IPF_Lung_v1 cell types from idiopathic pulmonary fibrosis, chronic obstructive pulmonary disease, and healthy lungs of adult humans (v1) 2022-11-16 03:08:53.630039 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Longitudinal_Hippocampus_v1 cell types from the adult human anterior and posterior hippocampus (v1) 2023-07-14 12:59:10.144650 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Lung_Atlas_v2 integrated Human Lung Cell Atlas (HLCA) combining multiple datasets of the healthy respiratory system (v2) 2023-05-17 19:51:55.661237 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_PF_Lung_v1 cell types from different forms of pulmonary fibrosis lungs of adult humans (v1) 2022-11-16 11:53:12.984520 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Human_Placenta_Decidua_v1 cell types from first-trimester human placentas with matched maternal blood and decidua (v1) 2024-06-24 12:24:39.703109 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Lethal_COVID19_Lung_v1 cell types from the lungs of individuals who died of COVID-19 and control individuals (v1) 2022-11-16 15:38:16.170461 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Mouse_Dendritic_Subtypes_v1 dendritic cell subtypes integrated from 9 datasets across murine spleen, bone marrow, blood, and lung tissue (v1) 2025-08-12 18:05:20.370475 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Mouse_Dentate_Gyrus_v1 cell types from the dentate gyrus in perinatal, juvenile, and adult mice (v1) 2023-07-14 20:03:58.410321 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Mouse_Isocortex_Hippocampus_v1 cell types from the adult mouse isocortex (neocortex) and hippocampal formation (v1) 2023-07-16 14:42:07.696736 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Mouse_Postnatal_DentateGyrus_v1 cell types from the mouse dentate gyrus in postnatal days 12-35 (v1) 2023-07-21 23:03:32.480446 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Mouse_Whole_Brain_v1 cell types from the whole adult mouse brain (v1) 2024-04-30 17:19:37.721313 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Nuclei_Human_InnerEar_v1 cell types from human inner ear at fetal age weeks 7.5 and 9.2 as well as adult (v1) 2025-12-02 22:12:13.925426 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Nuclei_Lung_Airway_v4 cell populations from snRNA-seq of five locations of the human lungs and airways (v4) 2022-09-27 01:30:38.635174 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +PaediatricAdult_COVID19_Airway_v1 cell types in the airway of paediatric and adult patients with COVID-19 and healthy controls (v1) 2025-10-14 23:14:36.927842 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +PaediatricAdult_COVID19_PBMC_v1 peripheral blood mononuclear cell types of paediatric and adult patients with COVID-19 and healthy controls (v1) 2025-10-15 00:51:41.857714 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist +Pan_Fetal_Human_v2 stromal and immune populations from the human fetus (v2) 2022-04-23 11:40:27.484223 /home/videmp/projects/galaxy/galaxy-dev/tool-data/celltypist diff -r 000000000000 -r 7207818691af tool-data/celltypist_models.loc.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/celltypist_models.loc.sample Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,7 @@ +#A sample file that contains models provided by celltypist +# +# the columns are: +#value name date /path/to/data +# +#An example +#Immune_All_Low_v2 Model for testing. Actual model used is Immune_All_Low.pkl (v2). 2022-07-16 00:20:42.927778 /path/to/Immune_All_Low_v2.pkl \ No newline at end of file diff -r 000000000000 -r 7207818691af tool_data_table_conf.xml.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,6 @@ + + + value, name, date, path + +
+
diff -r 000000000000 -r 7207818691af tool_data_table_conf.xml.test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.test Tue Mar 10 20:01:46 2026 +0000 @@ -0,0 +1,6 @@ + + + value, name, date, path + +
+