diff --git a/scripts/run_robust_analys.sh b/scripts/run_robust_analys.sh index 0847ba6f2..876e06f5f 100644 --- a/scripts/run_robust_analys.sh +++ b/scripts/run_robust_analys.sh @@ -3,11 +3,11 @@ # RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)" RUN_ID="robust_analy" -# resources_dir="resources" -# publish_dir="output/${RUN_ID}" +resources_dir="resources" +publish_dir="output/${RUN_ID}" -resources_dir="s3://openproblems-data/resources/grn" -publish_dir="s3://openproblems-data/resources/grn/results/${RUN_ID}" +# resources_dir="s3://openproblems-data/resources/grn" +# publish_dir="s3://openproblems-data/resources/grn/results/${RUN_ID}" grn_models_folder="${resources_dir}/grn_models" diff --git a/src/api/comp_metric.yaml b/src/api/comp_metric.yaml index 50e60cdf8..76413c764 100644 --- a/src/api/comp_metric.yaml +++ b/src/api/comp_metric.yaml @@ -15,7 +15,7 @@ functionality: default: resources/grn-benchmark/perturbation_data.h5ad - name: --prediction __merge__: file_prediction.yaml - required: false + required: true direction: input default: resources/grn_models/collectri.csv - name: --score diff --git a/src/methods/multi_omics/scenicplus/config.vsh.yaml b/src/methods/multi_omics/scenicplus/config.vsh.yaml index 4fbf1085e..bbb78b760 100644 --- a/src/methods/multi_omics/scenicplus/config.vsh.yaml +++ b/src/methods/multi_omics/scenicplus/config.vsh.yaml @@ -11,10 +11,9 @@ functionality: GRN inference using scenicplus documentation_url: https://scenicplus.readthedocs.io/en/latest/human_cerebellum.html arguments: - - name: --cistopic_out + - name: --cistopic_object type: file - required: false - direction: input + direction: output resources: - type: python_script path: script.py diff --git a/src/methods/multi_omics/scenicplus/script.py b/src/methods/multi_omics/scenicplus/script.py index 9131d8763..16805f070 100644 --- a/src/methods/multi_omics/scenicplus/script.py +++ b/src/methods/multi_omics/scenicplus/script.py @@ -21,13 +21,14 @@ par = { 'multiomics_rna': 'resources/grn-benchmark/multiomics_rna.h5ad', 'multiomics_atac': 'resources/grn-benchmark/multiomics_atac.h5ad', - 'cistopic_out': 'output/pycistopic', 'temp_dir': 'output/scenicplus', 'prediction': 'output/prediction.csv', } ## VIASH END work_dir = par['temp_dir'] +par['cistopic_out'] = f'{work_dir}/cistopic_out' +par['cistopic_object'] = os.path.join(par['cistopic_out'], f'cistopic_object_with_model.pkl') os.makedirs(os.path.join(work_dir, 'scRNA'), exist_ok=True) # Download databases @@ -96,6 +97,7 @@ def download_checksum(url: str, filepath: str) -> str: with open(os.path.join(par['cistopic_out'], f'candidate_enhancers/markers_dict.pkl'), 'rb') as f: markers_dict = pickle.load(f) + # Convert to dictionary of pyrange objects region_sets = {} region_sets['topics_otsu'] = {} @@ -126,7 +128,7 @@ def download_checksum(url: str, filepath: str) -> str: settings = yaml.safe_load(f) # Update settings: indicate locations of input files -settings['input_data']['cisTopic_obj_fname'] = os.path.join(par['cistopic_out'], f'cistopic_object_with_model.pkl') +settings['input_data']['cisTopic_obj_fname'] = par['cistopic_object'] settings['input_data']['GEX_anndata_fname'] = os.path.join(work_dir, 'rna.h5ad') settings['input_data']['region_set_folder'] = os.path.join(par['cistopic_out'], 'region_sets') settings['input_data']['ctx_db_fname'] = rankings_db @@ -152,3 +154,10 @@ def download_checksum(url: str, filepath: str) -> str: # Make sure the file is properly formatted, and re-format it if needed filepath = os.path.join(work_dir, 'tf_to_gene_adj.tsv') shutil.copyfile(filepath, par['prediction']) + + +# cistopic_obj = pickle.load(os.path.join(par['cistopic_out'], f'cistopic_object_with_model.pkl')) +# # get cell topic association +# cell_topic = cistopic_obj.selected_model.cell_topic.T +# cell_names = cistopic_obj.cell_data.obs_id.values +# cell_topic.index = cell_names diff --git a/src/methods/multi_omics/scenicplus_ns/config.vsh.yaml b/src/methods/multi_omics/scenicplus_ns/config.vsh.yaml index 92ab82478..1589a59bb 100644 --- a/src/methods/multi_omics/scenicplus_ns/config.vsh.yaml +++ b/src/methods/multi_omics/scenicplus_ns/config.vsh.yaml @@ -7,6 +7,10 @@ functionality: info: label: grn_inference_scenicplus summary: "Infers GRNs from multiomics data using scenicplus." + arguments: + - name: --cistopic_object + type: file + direction: output resources: - type: nextflow_script diff --git a/src/methods/multi_omics/scenicplus_ns/main.nf b/src/methods/multi_omics/scenicplus_ns/main.nf index 6492cb243..b3e73439a 100644 --- a/src/methods/multi_omics/scenicplus_ns/main.nf +++ b/src/methods/multi_omics/scenicplus_ns/main.nf @@ -11,10 +11,10 @@ workflow run_wf { temp_dir: "temp_dir", num_workers: "num_workers" ], - toState: [prediction:"prediction"] + toState: [prediction:"prediction", cistopic_object:"cistopic_object"] ) - | setState(["prediction"]) + | setState(["prediction", "cistopic_object"]) emit: output_ch diff --git a/src/methods/multi_omics/scenicplus_ns/run.sh b/src/methods/multi_omics/scenicplus_ns/run.sh index 725161975..c7b02faae 100644 --- a/src/methods/multi_omics/scenicplus_ns/run.sh +++ b/src/methods/multi_omics/scenicplus_ns/run.sh @@ -31,14 +31,14 @@ HERE # -params-file params/${RUN_ID}.yaml -# ./tw-windows-x86_64.exe launch ` -# https://github.com/openproblems-bio/task_grn_benchmark.git ` -# --revision build/main ` -# --pull-latest ` -# --main-script target/nextflow/workflows/run_grn_inference/main.nf ` -# --workspace 53907369739130 ` -# --compute-env 6TeIFgV5OY4pJCk8I0bfOh ` -# --params-file ./params/celloracle_test.yaml ` -# --config src/common/nextflow_helpers/labels_tw.config +./tw-windows-x86_64.exe launch ` + https://github.com/openproblems-bio/task_grn_benchmark.git ` + --revision build/main ` + --pull-latest ` + --main-script target/nextflow/workflows/grn_inference_scenicplus/main.nf ` + --workspace 53907369739130 ` + --compute-env 6TeIFgV5OY4pJCk8I0bfOh ` + --params-file ./params/scenicplus.yaml ` + --config src/common/nextflow_helpers/labels_tw.config diff --git a/src/workflows/run_robustness_analysis/main.nf b/src/workflows/run_robustness_analysis/main.nf index 815081ef1..feca5f6f0 100644 --- a/src/workflows/run_robustness_analysis/main.nf +++ b/src/workflows/run_robustness_analysis/main.nf @@ -43,7 +43,7 @@ workflow run_wf { // use 'fromState' to fetch the arguments the component requires from the overall state fromState: [ perturbation_data: "perturbation_data", - prediction_n: "prediction", + prediction: "prediction_n", layer: "layer", subsample: "subsample", reg_type: "reg_type",