Skip to content

Commit

Permalink
bug in util file fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
janursa committed Sep 19, 2024
1 parent 0f9772f commit 1f61770
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 100 deletions.
181 changes: 127 additions & 54 deletions runs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": [
"<style type=\"text/css\">\n",
"#T_9cafd_row0_col0 {\n",
"#T_b33f6_row0_col0 {\n",
" background-color: #d0d1e6;\n",
" color: #000000;\n",
"}\n",
"#T_9cafd_row0_col1, #T_9cafd_row0_col2, #T_9cafd_row0_col3, #T_9cafd_row2_col0 {\n",
"#T_b33f6_row0_col1, #T_b33f6_row0_col2, #T_b33f6_row0_col3, #T_b33f6_row2_col0 {\n",
" background-color: #fff7fb;\n",
" color: #000000;\n",
"}\n",
"#T_9cafd_row1_col0, #T_9cafd_row1_col1, #T_9cafd_row1_col2, #T_9cafd_row2_col3 {\n",
"#T_b33f6_row1_col0, #T_b33f6_row1_col1, #T_b33f6_row1_col2, #T_b33f6_row2_col3 {\n",
" background-color: #023858;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_9cafd_row1_col3 {\n",
"#T_b33f6_row1_col3 {\n",
" background-color: #4295c3;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_9cafd_row2_col1 {\n",
"#T_b33f6_row2_col1 {\n",
" background-color: #04639b;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_9cafd_row2_col2 {\n",
"#T_b33f6_row2_col2 {\n",
" background-color: #fef6fb;\n",
" color: #000000;\n",
"}\n",
"</style>\n",
"<table id=\"T_9cafd\">\n",
"<table id=\"T_b33f6\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th id=\"T_9cafd_level0_col0\" class=\"col_heading level0 col0\" >ex(False)_tf(-1)</th>\n",
" <th id=\"T_9cafd_level0_col1\" class=\"col_heading level0 col1\" >ex(True)_tf(-1)</th>\n",
" <th id=\"T_9cafd_level0_col2\" class=\"col_heading level0 col2\" >static-theta-0.0</th>\n",
" <th id=\"T_9cafd_level0_col3\" class=\"col_heading level0 col3\" >static-theta-0.5</th>\n",
" <th id=\"T_b33f6_level0_col0\" class=\"col_heading level0 col0\" >ex(False)_tf(-1)</th>\n",
" <th id=\"T_b33f6_level0_col1\" class=\"col_heading level0 col1\" >ex(True)_tf(-1)</th>\n",
" <th id=\"T_b33f6_level0_col2\" class=\"col_heading level0 col2\" >static-theta-0.0</th>\n",
" <th id=\"T_b33f6_level0_col3\" class=\"col_heading level0 col3\" >static-theta-0.5</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_9cafd_level0_row0\" class=\"row_heading level0 row0\" >pearson_corr</th>\n",
" <td id=\"T_9cafd_row0_col0\" class=\"data row0 col0\" >0.239620</td>\n",
" <td id=\"T_9cafd_row0_col1\" class=\"data row0 col1\" >0.518217</td>\n",
" <td id=\"T_9cafd_row0_col2\" class=\"data row0 col2\" >0.529502</td>\n",
" <td id=\"T_9cafd_row0_col3\" class=\"data row0 col3\" >0.524232</td>\n",
" <th id=\"T_b33f6_level0_row0\" class=\"row_heading level0 row0\" >pearson_corr</th>\n",
" <td id=\"T_b33f6_row0_col0\" class=\"data row0 col0\" >0.239620</td>\n",
" <td id=\"T_b33f6_row0_col1\" class=\"data row0 col1\" >0.518217</td>\n",
" <td id=\"T_b33f6_row0_col2\" class=\"data row0 col2\" >0.529502</td>\n",
" <td id=\"T_b33f6_row0_col3\" class=\"data row0 col3\" >0.524232</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_9cafd_level0_row1\" class=\"row_heading level0 row1\" >pearson_causal</th>\n",
" <td id=\"T_9cafd_row1_col0\" class=\"data row1 col0\" >0.364656</td>\n",
" <td id=\"T_9cafd_row1_col1\" class=\"data row1 col1\" >0.592457</td>\n",
" <td id=\"T_9cafd_row1_col2\" class=\"data row1 col2\" >0.741328</td>\n",
" <td id=\"T_9cafd_row1_col3\" class=\"data row1 col3\" >0.560490</td>\n",
" <th id=\"T_b33f6_level0_row1\" class=\"row_heading level0 row1\" >pearson_causal</th>\n",
" <td id=\"T_b33f6_row1_col0\" class=\"data row1 col0\" >0.364656</td>\n",
" <td id=\"T_b33f6_row1_col1\" class=\"data row1 col1\" >0.592457</td>\n",
" <td id=\"T_b33f6_row1_col2\" class=\"data row1 col2\" >0.741328</td>\n",
" <td id=\"T_b33f6_row1_col3\" class=\"data row1 col3\" >0.560490</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_9cafd_level0_row2\" class=\"row_heading level0 row2\" >positive_control</th>\n",
" <td id=\"T_9cafd_row2_col0\" class=\"data row2 col0\" >0.197307</td>\n",
" <td id=\"T_9cafd_row2_col1\" class=\"data row2 col1\" >0.579238</td>\n",
" <td id=\"T_9cafd_row2_col2\" class=\"data row2 col2\" >0.530848</td>\n",
" <td id=\"T_9cafd_row2_col3\" class=\"data row2 col3\" >0.584694</td>\n",
" <th id=\"T_b33f6_level0_row2\" class=\"row_heading level0 row2\" >positive_control</th>\n",
" <td id=\"T_b33f6_row2_col0\" class=\"data row2 col0\" >0.197307</td>\n",
" <td id=\"T_b33f6_row2_col1\" class=\"data row2 col1\" >0.579238</td>\n",
" <td id=\"T_b33f6_row2_col2\" class=\"data row2 col2\" >0.530848</td>\n",
" <td id=\"T_b33f6_row2_col3\" class=\"data row2 col3\" >0.584694</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x14a589aae560>"
"<pandas.io.formats.style.Styler at 0x7fe34e74ba00>"
]
},
"execution_count": 7,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -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": [
"<style type=\"text/css\">\n",
"#T_32bb3_row0_col0, #T_32bb3_row0_col1, #T_32bb3_row0_col2, #T_32bb3_row0_col3 {\n",
" background-color: #023858;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_32bb3_row1_col0 {\n",
" background-color: #cacee5;\n",
" color: #000000;\n",
"}\n",
"#T_32bb3_row1_col1, #T_32bb3_row1_col3, #T_32bb3_row2_col0, #T_32bb3_row2_col2 {\n",
" background-color: #fff7fb;\n",
" color: #000000;\n",
"}\n",
"#T_32bb3_row1_col2 {\n",
" background-color: #b8c6e0;\n",
" color: #000000;\n",
"}\n",
"#T_32bb3_row2_col1 {\n",
" background-color: #1c7fb8;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_32bb3_row2_col3 {\n",
" background-color: #1379b5;\n",
" color: #f1f1f1;\n",
"}\n",
"</style>\n",
"<table id=\"T_32bb3\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th id=\"T_32bb3_level0_col0\" class=\"col_heading level0 col0\" >ex(False)_tf(-1)</th>\n",
" <th id=\"T_32bb3_level0_col1\" class=\"col_heading level0 col1\" >ex(True)_tf(-1)</th>\n",
" <th id=\"T_32bb3_level0_col2\" class=\"col_heading level0 col2\" >static-theta-0.0</th>\n",
" <th id=\"T_32bb3_level0_col3\" class=\"col_heading level0 col3\" >static-theta-0.5</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_32bb3_level0_row0\" class=\"row_heading level0 row0\" >pearson_corr</th>\n",
" <td id=\"T_32bb3_row0_col0\" class=\"data row0 col0\" >0.286728</td>\n",
" <td id=\"T_32bb3_row0_col1\" class=\"data row0 col1\" >0.543611</td>\n",
" <td id=\"T_32bb3_row0_col2\" class=\"data row0 col2\" >0.739006</td>\n",
" <td id=\"T_32bb3_row0_col3\" class=\"data row0 col3\" >0.553125</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_32bb3_level0_row1\" class=\"row_heading level0 row1\" >pearson_causal</th>\n",
" <td id=\"T_32bb3_row1_col0\" class=\"data row1 col0\" >0.152208</td>\n",
" <td id=\"T_32bb3_row1_col1\" class=\"data row1 col1\" >0.436537</td>\n",
" <td id=\"T_32bb3_row1_col2\" class=\"data row1 col2\" >0.632154</td>\n",
" <td id=\"T_32bb3_row1_col3\" class=\"data row1 col3\" >0.520246</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_32bb3_level0_row2\" class=\"row_heading level0 row2\" >positive_control</th>\n",
" <td id=\"T_32bb3_row2_col0\" class=\"data row2 col0\" >0.103243</td>\n",
" <td id=\"T_32bb3_row2_col1\" class=\"data row2 col1\" >0.510231</td>\n",
" <td id=\"T_32bb3_row2_col2\" class=\"data row2 col2\" >0.581397</td>\n",
" <td id=\"T_32bb3_row2_col3\" class=\"data row2 col3\" >0.543740</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x7fe34e7a9840>"
]
},
"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()"
]
},
{
Expand Down
36 changes: 18 additions & 18 deletions scripts/run_benchmark_all.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]"
Expand Down Expand Up @@ -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 `
Expand All @@ -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
17 changes: 0 additions & 17 deletions src/api/comp_method_mo.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/control_methods/pearson/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/control_methods/pearson/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/control_methods/pearson_causal/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ functionality:
- type: python_script
path: script.py
- path: /src/utils/util.py
dest: util.py

platforms:
- type: docker
Expand Down
4 changes: 2 additions & 2 deletions src/control_methods/pearson_causal/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions src/control_methods/positive_control/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ functionality:
- type: python_script
path: script.py
- path: /src/utils/util.py
dest: util.py

platforms:
- type: docker
Expand Down
4 changes: 2 additions & 2 deletions src/control_methods/positive_control/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions src/methods/multi_omics/celloracle/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down

0 comments on commit 1f61770

Please sign in to comment.