Skip to content

Commit

Permalink
bug in workflow fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
janursa committed Sep 13, 2024
1 parent 4a35f67 commit b9385f2
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
46 changes: 23 additions & 23 deletions scripts/run_grn_evaluation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ viash ns build --parallel
reg_type=ridge

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

subsample=-2
max_workers=10
layer=scgen_pearson
metric_ids="[regression_1]"
metric_ids="[regression_1, regression_2]"

param_file="./params/${RUN_ID}.yaml"

Expand Down Expand Up @@ -75,21 +75,21 @@ HERE

}

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

## controls
# append_entry_control "negative_control" "" "" "false" "false" "false"
# append_entry_control "positive_control" "" "" "false" "false" "false"
append_entry_control "baseline_pearson" "False" "pearson" "false" "false" "false"
append_entry_control "baseline_dotproduct" "False" "dotproduct" "false" "false" "false"
append_entry_control "baseline_dotproduct_causal" "True" "dotproduct" "false" "false" "false"
append_entry_control "baseline_dotproduct_causal_cell_type" "True" "dotproduct" "true" "false" "false"
append_entry_control "baseline_dotproduct_causal_metacell" "True" "dotproduct" "false" "true" "false"
append_entry_control "baseline_dotproduct_causal_impute" "True" "dotproduct" "false" "false" "true"
# append_entry_control "baseline_corr_causal_spearman" "True" "spearman"
append_entry_control "negative_control" "" "" "false" "false" "false"
append_entry_control "positive_control" "" "" "false" "false" "false"
append_entry_control "baseline_pearson" "false" "pearson" "false" "false" "false"
append_entry_control "baseline_dotproduct" "false" "dotproduct" "false" "false" "false"
append_entry_control "baseline_dotproduct_causal" "true" "dotproduct" "false" "false" "false"
append_entry_control "baseline_dotproduct_causal_cell_type" "true" "dotproduct" "true" "false" "false"
append_entry_control "baseline_dotproduct_causal_metacell" "true" "dotproduct" "false" "true" "false"
append_entry_control "baseline_dotproduct_causal_impute" "true" "dotproduct" "false" "false" "true"
append_entry_control "baseline_corr_causal_spearman" "true" "spearman"


# Append the remaining output_state and publish_dir to the YAML file
Expand All @@ -98,13 +98,13 @@ output_state: "state.yaml"
publish_dir: "$publish_dir"
HERE

nextflow run . \
-main-script target/nextflow/workflows/run_grn_evaluation/main.nf \
-profile docker \
-with-trace \
-c src/common/nextflow_helpers/labels_ci.config \
-params-file ${param_file}
subl resources/results/grn_evaluation_all_ridge/scores.yaml
# nextflow run . \
# -main-script target/nextflow/workflows/run_grn_evaluation/main.nf \
# -profile docker \
# -with-trace \
# -c src/common/nextflow_helpers/labels_ci.config \
# -params-file ${param_file}
# subl resources/results/grn_evaluation_all_ridge/scores.yaml

# ./tw-windows-x86_64.exe launch `
# https://github.com/openproblems-bio/task_grn_inference.git `
Expand Down
2 changes: 1 addition & 1 deletion src/api/comp_method.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ functionality:
example: resources_test/grn-benchmark/multiomics_rna.h5ad
- name: --prediction
__merge__: file_prediction.yaml
required: true
required: false
direction: output
example: resources_test/grn_models/collectri.csv
- name: --tf_all
Expand Down
3 changes: 3 additions & 0 deletions src/api/comp_metric.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ functionality:
direction: input
required: false
default: scgen_pearson
- name: --max_n_links
type: integer
default: 50000



Expand Down
2 changes: 1 addition & 1 deletion src/control_methods/baseline_corr/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create_corr_net(X: np.ndarray, groups: np.ndarray, method="pearson"):
return grn
print('Read data')
multiomics_rna = ad.read_h5ad(par["multiomics_rna"])
# multiomics_rna = multiomics_rna[:,:5000] #TODO: togo
multiomics_rna = multiomics_rna[:,:5000] #TODO: togo

if par['metacell']:
print('metacell')
Expand Down
8 changes: 8 additions & 0 deletions src/metrics/regression_1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
import os


def select_top_links(net, par):
print("Number of links reduced to ", par['max_n_links'])
net_sorted = net.reindex(net['weight'].abs().sort_values(ascending=False).index)
net = net_sorted.head(par['max_n_links']).reset_index(drop=True)
return net

class lightgbm_wrapper:
def __init__(self, params, max_workers=None):
self.params = params
Expand Down Expand Up @@ -146,6 +152,8 @@ def regression_1(
net_sub = net[net.cell_type==cell_type]
else:
net_sub = net

net_sub = select_top_links(net_sub, par) #only top links are considered

prturb_adata_sub = prturb_adata[prturb_adata.obs.cell_type==cell_type,:]
y_true_sub, y_pred_sub = cross_validation(net_sub, prturb_adata_sub, par)
Expand Down
2 changes: 2 additions & 0 deletions src/workflows/run_grn_evaluation/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ workflow run_wf {
},
fromState: [
perturbation_data: "perturbation_data",
multiomics_rna: "multiomics_rna",
layer: "layer",
tf_all: "tf_all"
],
Expand Down Expand Up @@ -175,6 +176,7 @@ workflow run_wf {
},
fromState: [
perturbation_data: "perturbation_data",
multiomics_rna: "multiomics_rna",
tf_all: "tf_all",
],
toState: {id, output, state ->
Expand Down

0 comments on commit b9385f2

Please sign in to comment.