Skip to content

Commit

Permalink
reg1 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
janursa committed Sep 17, 2024
1 parent fb851e7 commit aa3da45
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 61 deletions.
93 changes: 66 additions & 27 deletions runs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3816,64 +3816,104 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"tag = \"celltype_donor_0_subset_ridge\"\n",
"!aws s3 sync s3://openproblems-data/resources/grn/results/{tag} resources/results/{tag}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style type=\"text/css\">\n",
"#T_419d4_row0_col0, #T_419d4_row0_col1, #T_419d4_row0_col2, #T_419d4_row0_col3, #T_419d4_row1_col4 {\n",
"#T_c5ac9_row0_col0, #T_c5ac9_row1_col1, #T_c5ac9_row2_col2 {\n",
" background-color: #023858;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_419d4_row0_col4, #T_419d4_row1_col0, #T_419d4_row1_col1, #T_419d4_row1_col2, #T_419d4_row1_col3 {\n",
"#T_c5ac9_row0_col1 {\n",
" background-color: #045687;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_c5ac9_row0_col2, #T_c5ac9_row2_col0, #T_c5ac9_row2_col1 {\n",
" background-color: #fff7fb;\n",
" color: #000000;\n",
"}\n",
"#T_c5ac9_row1_col0 {\n",
" background-color: #63a2cb;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_c5ac9_row1_col2 {\n",
" background-color: #b4c4df;\n",
" color: #000000;\n",
"}\n",
"#T_c5ac9_row3_col0 {\n",
" background-color: #f4edf6;\n",
" color: #000000;\n",
"}\n",
"#T_c5ac9_row3_col1 {\n",
" background-color: #76aad0;\n",
" color: #f1f1f1;\n",
"}\n",
"#T_c5ac9_row3_col2 {\n",
" background-color: #2685bb;\n",
" color: #f1f1f1;\n",
"}\n",
"</style>\n",
"<table id=\"T_419d4\">\n",
"<table id=\"T_c5ac9\">\n",
" <thead>\n",
" <tr>\n",
" <th class=\"blank level0\" >&nbsp;</th>\n",
" <th id=\"T_419d4_level0_col0\" class=\"col_heading level0 col0\" >ex(False)_tf(-1)</th>\n",
" <th id=\"T_419d4_level0_col1\" class=\"col_heading level0 col1\" >ex(True)_tf(-1)</th>\n",
" <th id=\"T_419d4_level0_col2\" class=\"col_heading level0 col2\" >static-theta-0.0</th>\n",
" <th id=\"T_419d4_level0_col3\" class=\"col_heading level0 col3\" >static-theta-0.5</th>\n",
" <th id=\"T_419d4_level0_col4\" class=\"col_heading level0 col4\" >Rank</th>\n",
" <th id=\"T_c5ac9_level0_col0\" class=\"col_heading level0 col0\" >static-theta-0.0</th>\n",
" <th id=\"T_c5ac9_level0_col1\" class=\"col_heading level0 col1\" >static-theta-0.5</th>\n",
" <th id=\"T_c5ac9_level0_col2\" class=\"col_heading level0 col2\" >Rank</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th id=\"T_419d4_level0_row0\" class=\"row_heading level0 row0\" >grnboost2</th>\n",
" <td id=\"T_419d4_row0_col0\" class=\"data row0 col0\" >0.265609</td>\n",
" <td id=\"T_419d4_row0_col1\" class=\"data row0 col1\" >0.403231</td>\n",
" <td id=\"T_419d4_row0_col2\" class=\"data row0 col2\" >0.831048</td>\n",
" <td id=\"T_419d4_row0_col3\" class=\"data row0 col3\" >0.588393</td>\n",
" <td id=\"T_419d4_row0_col4\" class=\"data row0 col4\" >1</td>\n",
" <th id=\"T_c5ac9_level0_row0\" class=\"row_heading level0 row0\" >grnboost2</th>\n",
" <td id=\"T_c5ac9_row0_col0\" class=\"data row0 col0\" >0.478448</td>\n",
" <td id=\"T_c5ac9_row0_col1\" class=\"data row0 col1\" >0.584824</td>\n",
" <td id=\"T_c5ac9_row0_col2\" class=\"data row0 col2\" >1</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_419d4_level0_row1\" class=\"row_heading level0 row1\" >portia</th>\n",
" <td id=\"T_419d4_row1_col0\" class=\"data row1 col0\" >0.014677</td>\n",
" <td id=\"T_419d4_row1_col1\" class=\"data row1 col1\" >0.035305</td>\n",
" <td id=\"T_419d4_row1_col2\" class=\"data row1 col2\" >0.580474</td>\n",
" <td id=\"T_419d4_row1_col3\" class=\"data row1 col3\" >0.535289</td>\n",
" <td id=\"T_419d4_row1_col4\" class=\"data row1 col4\" >2</td>\n",
" <th id=\"T_c5ac9_level0_row1\" class=\"row_heading level0 row1\" >positive_control</th>\n",
" <td id=\"T_c5ac9_row1_col0\" class=\"data row1 col0\" >0.406963</td>\n",
" <td id=\"T_c5ac9_row1_col1\" class=\"data row1 col1\" >0.596213</td>\n",
" <td id=\"T_c5ac9_row1_col2\" class=\"data row1 col2\" >2</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_c5ac9_level0_row2\" class=\"row_heading level0 row2\" >portia</th>\n",
" <td id=\"T_c5ac9_row2_col0\" class=\"data row2 col0\" >0.325534</td>\n",
" <td id=\"T_c5ac9_row2_col1\" class=\"data row2 col1\" >0.492725</td>\n",
" <td id=\"T_c5ac9_row2_col2\" class=\"data row2 col2\" >4</td>\n",
" </tr>\n",
" <tr>\n",
" <th id=\"T_c5ac9_level0_row3\" class=\"row_heading level0 row3\" >pearson_causal</th>\n",
" <td id=\"T_c5ac9_row3_col0\" class=\"data row3 col0\" >0.337034</td>\n",
" <td id=\"T_c5ac9_row3_col1\" class=\"data row3 col1\" >0.543906</td>\n",
" <td id=\"T_c5ac9_row3_col2\" class=\"data row3 col2\" >3</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n"
],
"text/plain": [
"<pandas.io.formats.style.Styler at 0x154bc4842050>"
"<pandas.io.formats.style.Styler at 0x1507ab3c8040>"
]
},
"execution_count": 42,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"base_folder = f'resources/results/{tag}'\n",
"models_all = ['negative_control', 'baseline_pearson', \n",
" 'baseline_pearson_causal', 'baseline_pearson_causal_celltype', \n",
" 'baseline_pearson_causal_metacell', 'positive_control', 'collectri','granie', 'figr', 'celloracle', \n",
Expand Down Expand Up @@ -3903,8 +3943,7 @@
" return df_reg\n",
"import yaml\n",
"import pandas as pd\n",
"# base_folder = 'resources/results/grn_evaluation_all_ridge/'\n",
"base_folder = 'resources/results/single_omics_inference'\n",
"\n",
"\n",
"result_file = f'{base_folder}/scores.yaml'\n",
"with open(result_file, 'r') as file:\n",
Expand All @@ -3915,7 +3954,7 @@
"else:\n",
" df_reg1 = extract_data(data, reg='reg1').drop(columns=['Mean'])\n",
" df_reg2 = extract_data(data, reg='reg2').drop(columns=['Mean'])\n",
"df_all = pd.concat([df_reg1,df_reg2], axis=1).fillna(0)\n",
"df_all = pd.concat([df_reg1, df_reg2], axis=1).fillna(0)\n",
"df_all[df_all<0]=0\n",
"df_all_n = (df_all-df_all.min(axis=0))/(df_all.max(axis=0)-df_all.min(axis=0))\n",
"df_all['Rank'] = df_all_n.mean(axis=1).rank(ascending=False).astype(int)\n",
Expand Down
50 changes: 22 additions & 28 deletions scripts/run_grn_evaluation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# viash ns build --parallel
reg_type=ridge

RUN_ID="grn_evaluation_all_${reg_type}"
RUN_ID="celltype_donor_0_subset_${reg_type}"
resources_dir="s3://openproblems-data/resources/grn"
# resources_dir="./resources"
publish_dir="${resources_dir}/results/${RUN_ID}"
grn_models_folder="${resources_dir}/grn_models"
grn_models_folder="${resources_dir}/grn_models/donor_0_celltype"

subsample=-2
max_workers=10
Expand All @@ -19,26 +19,20 @@ metric_ids="[regression_1, regression_2]"
param_file="./params/${RUN_ID}.yaml"

grn_names=(
"scglue"
"scenicplus"
"celloracle"
"granie"
"figr"
"collectri"
"genie3"
# "scglue"
# "scenicplus"
# "celloracle"
# "granie"
# "figr"
# "collectri"
# "genie3"
"grnboost2"
"ppcor"
# "ppcor"
"portia"
"positive_control"
"pearson_causal"
)

baseline_models=(
baseline_pearson
baseline_pearson_causal
baseline_pearson_causal_celltype
baseline_pearson_causal_metacell
baseline_pearson_causal_impute
positive_control
)
# Start writing to the YAML file
cat > $param_file << HERE
param_list:
Expand All @@ -57,23 +51,15 @@ append_entry() {
tf_all: ${resources_dir}/prior/tf_all.csv
layer: ${layer}
consensus: ${resources_dir}/prior/consensus-num-regulators.json
prediction: ${2}/$1.csv
prediction: ${grn_models_folder}/$1.csv
HERE
}


folder=${grn_models_folder}
# Loop through grn_names and layers
for grn_name in "${grn_names[@]}"; do
append_entry "$grn_name" "$folder"
append_entry "$grn_name"
done

folder=${grn_models_folder}/baselines
for grn_name in "${baseline_models[@]}"; do
append_entry "$grn_name" "$folder"
done


# Append the remaining output_state and publish_dir to the YAML file
cat >> $param_file << HERE
output_state: "state.yaml"
Expand All @@ -99,3 +85,11 @@ HERE
# --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_grn_evaluation/main.nf \
--workspace 53907369739130 \
--compute-env 6TeIFgV5OY4pJCk8I0bfOh \
--params-file ${param_file} \
--config src/common/nextflow_helpers/labels_tw.config
6 changes: 3 additions & 3 deletions src/metrics/regression_1/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
'max_workers': 4,
}
## VIASH END
meta = {
"resources_dir":'src/metrics/regression_1/'
}
# meta = {
# "resources_dir":'src/metrics/regression_1/'
# }
sys.path.append(meta["resources_dir"])
from main import main

Expand Down
3 changes: 0 additions & 3 deletions src/workflows/run_grn_evaluation/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ functionality:
- name: --perturbation_data
type: file
direction: input
- name: --multiomics_rna
type: file
direction: input
- name: --layer
type: string
direction: input
Expand Down

0 comments on commit aa3da45

Please sign in to comment.