From 1f617709f57ed76c054dc83b6681c6d406c2647a Mon Sep 17 00:00:00 2001 From: jalil Date: Thu, 19 Sep 2024 17:47:30 +0200 Subject: [PATCH] bug in util file fixed --- runs.ipynb | 181 ++++++++++++------ scripts/run_benchmark_all.sh | 36 ++-- src/api/comp_method_mo.yaml | 17 -- src/control_methods/pearson/config.vsh.yaml | 2 +- src/control_methods/pearson/script.py | 5 +- .../pearson_causal/config.vsh.yaml | 1 + src/control_methods/pearson_causal/script.py | 4 +- .../positive_control/config.vsh.yaml | 1 + .../positive_control/script.py | 4 +- src/methods/multi_omics/celloracle/script.py | 6 +- 10 files changed, 157 insertions(+), 100 deletions(-) delete mode 100644 src/api/comp_method_mo.yaml diff --git a/runs.ipynb b/runs.ipynb index 56eca8ce8..658343c22 100644 --- a/runs.ipynb +++ b/runs.ipynb @@ -9,28 +9,7 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Collecting PyYAML\n", - " Downloading PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl.metadata (2.1 kB)\n", - "Downloading PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl (171 kB)\n", - "Installing collected packages: PyYAML\n", - "Successfully installed PyYAML-6.0.2\n" - ] - } - ], - "source": [ - "!pip install PyYAML" - ] - }, - { - "cell_type": "code", - "execution_count": 5, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -167,78 +146,90 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines/state.yaml to resources/results/benchmark_donor_0_baselines/state.yaml\n", + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines/scores.yaml to resources/results/benchmark_donor_0_baselines/scores.yaml\n", + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines/trace.txt to resources/results/benchmark_donor_0_baselines/trace.txt\n", + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines/ridge.positive_control.positive_control.prediction.csv to resources/results/benchmark_donor_0_baselines/ridge.positive_control.positive_control.prediction.csv\n", + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines/ridge.pearson_corr.pearson_corr.prediction.csv to resources/results/benchmark_donor_0_baselines/ridge.pearson_corr.pearson_corr.prediction.csv\n", + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines/ridge.pearson_causal.pearson_causal.prediction.csv to resources/results/benchmark_donor_0_baselines/ridge.pearson_causal.pearson_causal.prediction.csv\n" + ] + }, { "data": { "text/html": [ "\n", - "\n", + "
\n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", - " \n", - " \n", - " \n", - " \n", - " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", " \n", "
 ex(False)_tf(-1)ex(True)_tf(-1)static-theta-0.0static-theta-0.5ex(False)_tf(-1)ex(True)_tf(-1)static-theta-0.0static-theta-0.5
pearson_corr0.2396200.5182170.5295020.524232pearson_corr0.2396200.5182170.5295020.524232
pearson_causal0.3646560.5924570.7413280.560490pearson_causal0.3646560.5924570.7413280.560490
positive_control0.1973070.5792380.5308480.584694positive_control0.1973070.5792380.5308480.584694
\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 7, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -259,12 +250,94 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "download: s3://openproblems-data/resources/grn/results/benchmark_donor_0_baselines_nonspecific_notnormalized/trace.txt to resources/results/benchmark_donor_0_baselines_nonspecific_notnormalized/trace.txt\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
 ex(False)_tf(-1)ex(True)_tf(-1)static-theta-0.0static-theta-0.5
pearson_corr0.2867280.5436110.7390060.553125
pearson_causal0.1522080.4365370.6321540.520246
positive_control0.1032430.5102310.5813970.543740
\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "RUN_ID=\"benchmark_donor_0_baselines_nonspecific_notnormalized\"\n", - "\n" + "models_all = ['pearson_corr', 'pearson_causal', 'positive_control']\n", + "df_all = process_data(RUN_ID, models_all)\n", + "df_all.style.background_gradient()" ] }, { diff --git a/scripts/run_benchmark_all.sh b/scripts/run_benchmark_all.sh index 811bb7c6b..d7b41ba0e 100644 --- a/scripts/run_benchmark_all.sh +++ b/scripts/run_benchmark_all.sh @@ -1,9 +1,9 @@ #!/bin/bash # RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)" -RUN_ID="benchmark_donor_0_baselines_nonspecific_notnormalized" -# resources_dir="./resources_test/" -resources_dir="s3://openproblems-data/resources/grn" +RUN_ID="benchmark_donor_0_baselines" +resources_dir="./resources/" +# resources_dir="s3://openproblems-data/resources/grn" publish_dir="${resources_dir}/results/${RUN_ID}" reg_type=ridge @@ -12,7 +12,7 @@ max_workers=10 layer='scgen_pearson' metric_ids="[regression_1, regression_2]" cell_type_specific=false #for controls -normalize=false +normalize=true only_hvgs=false # method_ids="[tigress, ennet, scsgl, pidc]" method_ids="[pearson_corr, pearson_causal, positive_control]" @@ -42,12 +42,12 @@ output_state: "state.yaml" publish_dir: "$publish_dir" HERE -# nextflow run . \ -# -main-script target/nextflow/workflows/run_benchmark/main.nf \ -# -profile docker \ -# -with-trace \ -# -c src/common/nextflow_helpers/labels_ci.config \ -# -params-file ${param_file} +nextflow run . \ + -main-script target/nextflow/workflows/run_benchmark/main.nf \ + -profile docker \ + -with-trace \ + -c src/common/nextflow_helpers/labels_ci.config \ + -params-file ${param_file} # ./tw-windows-x86_64.exe launch ` # https://github.com/openproblems-bio/task_grn_inference.git ` @@ -59,11 +59,11 @@ HERE # --params-file ./params/benchmark_donor_0_default.yaml ` # --config src/common/nextflow_helpers/labels_tw.config -./tw launch https://github.com/openproblems-bio/task_grn_inference \ - --revision build/main \ - --pull-latest \ - --main-script target/nextflow/workflows/run_benchmark/main.nf \ - --workspace 53907369739130 \ - --compute-env 6TeIFgV5OY4pJCk8I0bfOh \ - --params-file ${param_file} \ - --config src/common/nextflow_helpers/labels_tw.config +# ./tw launch https://github.com/openproblems-bio/task_grn_inference \ +# --revision build/main \ +# --pull-latest \ +# --main-script target/nextflow/workflows/run_benchmark/main.nf \ +# --workspace 53907369739130 \ +# --compute-env 6TeIFgV5OY4pJCk8I0bfOh \ +# --params-file ${param_file} \ +# --config src/common/nextflow_helpers/labels_tw.config diff --git a/src/api/comp_method_mo.yaml b/src/api/comp_method_mo.yaml deleted file mode 100644 index bd8e1c843..000000000 --- a/src/api/comp_method_mo.yaml +++ /dev/null @@ -1,17 +0,0 @@ -__merge__: comp_method.yaml - -functionality: - info: - type: methods - type_info: - label: Method - summary: A GRN inference method for multiomics grn - description: | - A method for inferring GRN from atac and rna data. - arguments: - - name: --multiomics_atac - __merge__: file_multiomics_atac_h5ad.yaml - required: true - direction: input - must_exist: false - example: resources_test/grn-benchmark/multiomics_atac.h5ad diff --git a/src/control_methods/pearson/config.vsh.yaml b/src/control_methods/pearson/config.vsh.yaml index 03c3361fa..667b88d1c 100644 --- a/src/control_methods/pearson/config.vsh.yaml +++ b/src/control_methods/pearson/config.vsh.yaml @@ -12,7 +12,7 @@ functionality: path: script.py - path: /src/utils/util.py - + dest: util.py platforms: - type: docker image: ghcr.io/openproblems-bio/base_python:1.0.4 diff --git a/src/control_methods/pearson/script.py b/src/control_methods/pearson/script.py index 5002260f4..dde473edd 100644 --- a/src/control_methods/pearson/script.py +++ b/src/control_methods/pearson/script.py @@ -11,9 +11,8 @@ 'normalize': False } ## VIASH END -print(par) -# import sys -# sys.path.append('./src/utils') +import sys +sys.path.append(meta["resources_dir"]) from util import create_corr_net par['causal'] = False diff --git a/src/control_methods/pearson_causal/config.vsh.yaml b/src/control_methods/pearson_causal/config.vsh.yaml index be967e2ea..c7477f6dc 100644 --- a/src/control_methods/pearson_causal/config.vsh.yaml +++ b/src/control_methods/pearson_causal/config.vsh.yaml @@ -11,6 +11,7 @@ functionality: - type: python_script path: script.py - path: /src/utils/util.py + dest: util.py platforms: - type: docker diff --git a/src/control_methods/pearson_causal/script.py b/src/control_methods/pearson_causal/script.py index 13fe38c83..ba8b41a37 100644 --- a/src/control_methods/pearson_causal/script.py +++ b/src/control_methods/pearson_causal/script.py @@ -9,8 +9,8 @@ "seed": 32 } ## VIASH END -# import sys -# sys.path.append('./src/utils') +import sys +sys.path.append(meta["resources_dir"]) from util import create_corr_net print('Create causal corr net') diff --git a/src/control_methods/positive_control/config.vsh.yaml b/src/control_methods/positive_control/config.vsh.yaml index 553f1fc2b..87b93595f 100644 --- a/src/control_methods/positive_control/config.vsh.yaml +++ b/src/control_methods/positive_control/config.vsh.yaml @@ -16,6 +16,7 @@ functionality: - type: python_script path: script.py - path: /src/utils/util.py + dest: util.py platforms: - type: docker diff --git a/src/control_methods/positive_control/script.py b/src/control_methods/positive_control/script.py index 080e44618..b3772a432 100644 --- a/src/control_methods/positive_control/script.py +++ b/src/control_methods/positive_control/script.py @@ -18,8 +18,8 @@ "seed": 32, 'normalize': False} ## VIASH END -# import sys -# sys.path.append('./src/utils') +import sys +sys.path.append(meta["resources_dir"]) from util import create_corr_net print('Create causal corr net') diff --git a/src/methods/multi_omics/celloracle/script.py b/src/methods/multi_omics/celloracle/script.py index b44dae210..eaf48131f 100644 --- a/src/methods/multi_omics/celloracle/script.py +++ b/src/methods/multi_omics/celloracle/script.py @@ -13,9 +13,9 @@ "prediction": "output/celloracle_test.h5ad", } ## VIASH END -meta = { - "resources_dir":'src/methods/multi_omics/celloracle' -} +# meta = { +# "resources_dir":'src/methods/multi_omics/celloracle' +# } par['links'] = f"{par['temp_dir']}/links.celloracle.links" sys.path.append(meta["resources_dir"])