diff --git a/client/pages/phenotypes.vue b/client/pages/phenotypes.vue index c64e3c4db389756d343f17d1e6483302d1d7c044..16f0475c1966db59c8b27eacc2b795d595756f9a 100644 --- a/client/pages/phenotypes.vue +++ b/client/pages/phenotypes.vue @@ -87,7 +87,12 @@ export default { }, runAnalysis(){ const { selectedRows, $axios } = this; - const phenotypeIds = {phenotypeID: selectedRows.map(function(phenotype){return phenotype.id})}; + const phenotypeIds = { + phenotypeID: selectedRows.map(function(phenotype){return phenotype.id}), + initTableName: "initTable.hdf5" + // phenotypeID: ["z_MAGIC_FAST-GLUCOSE", "z_MAGIC_FAST-INSULIN"], + // initTableName: "initTableTest.hdf5" + }; console.log("REQUEST POST") console.log(phenotypeIds) diff --git a/jass/models/phenotype.py b/jass/models/phenotype.py index c99b7d4b04f97f861590f289ec047ff3733daa4c..5abe2ec6bc5052857b7221e44d02261b4c02d074 100644 --- a/jass/models/phenotype.py +++ b/jass/models/phenotype.py @@ -85,5 +85,5 @@ class ProjectNameModel(BaseModel): raise ValueError(f"Prohibited char, only \"{_initTableNamePattern.pattern}\" allowed.") return value -class PhenotypeIdList(BaseModel): +class PhenotypeIdList(ProjectNameModel, BaseModel): phenotypeID: List[str] = [] diff --git a/jass/server.py b/jass/server.py index da2feb991562e09620773198a381ec58e6def6a2..9314435d441d188a67eea31b141a805ec0e277d3 100644 --- a/jass/server.py +++ b/jass/server.py @@ -70,7 +70,7 @@ def inittable_meta(): def project_create(phenotype_id_list: PhenotypeIdList): return create_project( phenotype_id_list.phenotypeID, - get_available_phenotypes(os.path.join(config["DATA_DIR"], "initTable.hdf5")), + init_table_name=phenotype_id_list.initTableName, ) diff --git a/jass/tasks.py b/jass/tasks.py index 25c96082385add317e0be42d8211e9c305e07ea0..82e9b9d9c014f7468726cfb268e376099ff9b3cb 100644 --- a/jass/tasks.py +++ b/jass/tasks.py @@ -10,7 +10,7 @@ from flask import Flask import jass.models.project from jass.models.project import GlobalProject, Project, ensure_space_in_project_dir -from jass.models.phenotype import Phenotype +from jass.models.phenotype import Phenotype, get_available_phenotypes from jass.config import config @@ -155,22 +155,22 @@ def run_project_analysis_if_needed(project): def create_project( phenotype_ids: List[str], - available_phenotypes: List[Phenotype], chromosome: str = None, start: str = None, end: str = None, + init_table_name: str = None, ): - - available_phenotype_ids = [phenotype.id for phenotype in available_phenotypes] + init_table_path = os.path.join(config["DATA_DIR"], init_table_name) + available_phenotypes=get_available_phenotypes(init_table_path) unavailable_requested_ids = set(phenotype_ids).difference( - set(available_phenotype_ids) + set(phenotype.id for phenotype in available_phenotypes) ) if len(unavailable_requested_ids) > 0: raise HTTPException(status_code=404, detail=f"Phenotype IDs not found: {','.join(unavailable_requested_ids)}") phenotypes = [ phenotype for phenotype in available_phenotypes if phenotype.id in phenotype_ids ] - project = GlobalProject(phenotypes=phenotypes) + project = GlobalProject(phenotypes=phenotypes, init_table_path=init_table_path) project.create(fail_if_exists=False) ensure_space_in_project_dir(except_project_id=project.id)