-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
307 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# Default values | ||
grn="" | ||
sample="200" # Default value for sample | ||
reg_type="ridge" | ||
score="output/score.csv" | ||
|
||
# Parse arguments | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--grn) grn="$2"; shift ;; | ||
--sample) sample="$2"; shift ;; | ||
--reg_type) reg_type="$2"; shift ;; | ||
--score) score="$2"; shift ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
# Ensure required arguments are provided | ||
if [ -z "$grn" ]; then | ||
echo "Usage: $0 --grn <grn_file> [--sample <sample_value>]" | ||
exit 1 | ||
fi | ||
|
||
# Print parsed arguments (for debugging purposes) | ||
echo "GRN file: $grn" | ||
echo "Sample value: $sample" | ||
echo "Regression model: $reg_type" | ||
|
||
# Clean bin/ folder | ||
rm -r bin | ||
mkdir bin | ||
|
||
# Run regression analysis 1 | ||
echo "Running GRN benchmark with $grn and sample size $sample" | ||
echo "Regression 1" | ||
mkdir -p bin/regression_1 | ||
viash build src/metrics/regression_1/config.vsh.yaml -p docker -o bin/regression_1 | ||
bin/regression_1/regression_1 --perturbation_data resources/grn-benchmark/perturbation_data.h5ad --reg_type $reg_type --prediction $grn --score $score | ||
|
||
# Run regression analysis 2 | ||
echo "Regression 2" | ||
if [ ! -f resources/grn-benchmark/consensus-num-regulators.json ]; then | ||
viash build src/metrics/regression_2/consensus/config.vsh.yaml --platform docker -o bin/regression_2/consensus | ||
bin/regression_2/consensus/consensus_for_regression_2 --perturbation_data resources/grn-benchmark/perturbation_data.h5ad --output resources/grn-benchmark/consensus-num-regulators.json --grn_folder resources/grn-benchmark/grn_models/ --grns ananse.csv,celloracle.csv,figr.csv,granie.csv,scenicplus.csv,scglue.csv | ||
fi | ||
mkdir -p bin/regression_2 | ||
viash build src/metrics/regression_2/config.vsh.yaml -p docker -o bin/regression_2 | ||
bin/regression_2/regression_2 --perturbation_data resources/grn-benchmark/perturbation_data.h5ad --consensus resources/grn-benchmark/consensus-num-regulators.json --layer scgen_pearson --reg_type $reg_type --prediction $grn --score $score |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,95 @@ | ||
#!/bin/bash | ||
|
||
# Default values | ||
grn="" | ||
sample="200" # Default value for sample | ||
reg_type="ridge" | ||
score="output/score.csv" | ||
|
||
# Parse arguments | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--grn) grn="$2"; shift ;; | ||
--sample) sample="$2"; shift ;; | ||
--reg_type) reg_type="$2"; shift ;; | ||
--score) score="$2"; shift ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
# RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)" | ||
reg_type=${1} #GB, ridge | ||
|
||
RUN_ID="grn_evaluation_${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" | ||
|
||
subsample=-2 | ||
max_workers=10 | ||
|
||
param_file="./params/${RUN_ID}.yaml" | ||
|
||
grn_names=( | ||
"collectri" | ||
"celloracle" | ||
"scenicplus" | ||
"figr" | ||
"granie" | ||
"scglue" | ||
) | ||
# Start writing to the YAML file | ||
cat > $param_file << HERE | ||
param_list: | ||
HERE | ||
|
||
append_entry() { | ||
cat >> $param_file << HERE | ||
- id: ${reg_type}_${1}_${3} | ||
perturbation_data: ${resources_dir}/grn-benchmark/perturbation_data.h5ad | ||
reg_type: $reg_type | ||
method_id: $1 | ||
subsample: $subsample | ||
max_workers: $max_workers | ||
tf_all: ${resources_dir}/prior/tf_all.csv | ||
layer: ${3} | ||
consensus: ${resources_dir}/prior/consensus-num-regulators.json | ||
HERE | ||
|
||
# Conditionally append the prediction line if the second argument is "true" | ||
if [[ $2 == "true" ]]; then | ||
cat >> $param_file << HERE | ||
prediction: ${grn_models_folder}/$1.csv | ||
HERE | ||
fi | ||
} | ||
layers=(pearson scgen_pearson) | ||
# Loop through grn_names and layers | ||
for layer in "${layers[@]}"; do | ||
for grn_name in "${grn_names[@]}"; do | ||
append_entry "$grn_name" "true" "$layer" | ||
done | ||
done | ||
|
||
# # Append negative control | ||
grn_name="negative_control" | ||
for layer in "${layers[@]}"; do | ||
append_entry "$grn_name" "false" "$layer" | ||
done | ||
|
||
# Ensure required arguments are provided | ||
if [ -z "$grn" ]; then | ||
echo "Usage: $0 --grn <grn_file> [--sample <sample_value>]" | ||
exit 1 | ||
fi | ||
|
||
# Print parsed arguments (for debugging purposes) | ||
echo "GRN file: $grn" | ||
echo "Sample value: $sample" | ||
echo "Regression model: $reg_type" | ||
|
||
# Clean bin/ folder | ||
rm -r bin | ||
mkdir bin | ||
|
||
# Run regression analysis 1 | ||
echo "Running GRN benchmark with $grn and sample size $sample" | ||
echo "Regression 1" | ||
mkdir -p bin/regression_1 | ||
viash build src/metrics/regression_1/config.vsh.yaml -p docker -o bin/regression_1 | ||
bin/regression_1/regression_1 --perturbation_data resources/grn-benchmark/perturbation_data.h5ad --reg_type $reg_type --prediction $grn --score $score | ||
|
||
# Run regression analysis 2 | ||
echo "Regression 2" | ||
if [ ! -f resources/grn-benchmark/consensus-num-regulators.json ]; then | ||
viash build src/metrics/regression_2/consensus/config.vsh.yaml --platform docker -o bin/regression_2/consensus | ||
bin/regression_2/consensus/consensus_for_regression_2 --perturbation_data resources/grn-benchmark/perturbation_data.h5ad --output resources/grn-benchmark/consensus-num-regulators.json --grn_folder resources/grn-benchmark/grn_models/ --grns ananse.csv,celloracle.csv,figr.csv,granie.csv,scenicplus.csv,scglue.csv | ||
fi | ||
mkdir -p bin/regression_2 | ||
viash build src/metrics/regression_2/config.vsh.yaml -p docker -o bin/regression_2 | ||
bin/regression_2/regression_2 --perturbation_data resources/grn-benchmark/perturbation_data.h5ad --consensus resources/grn-benchmark/consensus-num-regulators.json --layer scgen_pearson --reg_type $reg_type --prediction $grn --score $score | ||
|
||
# Append positive controls | ||
grn_name="positive_control" | ||
for layer in "${layers[@]}"; do | ||
append_entry "$grn_name" "false" "$layer" | ||
done | ||
|
||
|
||
# Append the remaining output_state and publish_dir to the YAML file | ||
cat >> $param_file << HERE | ||
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} | ||
|
||
# ./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_evaluation/main.nf ` | ||
# --workspace 53907369739130 ` | ||
# --compute-env 6TeIFgV5OY4pJCk8I0bfOh ` | ||
# --params-file ./params/scgen_pearson_gb_pcs.yaml ` | ||
# --config src/common/nextflow_helpers/labels_tw.config | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
} | ||
## VIASH END | ||
|
||
print(par) | ||
sys.path.append(meta['resources_dir']) | ||
from main import main | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,11 +24,9 @@ workflow run_wf { | |
// ] | ||
|
||
methods = [ | ||
portia, | ||
ennet, | ||
grnboost2, | ||
scsgl, | ||
ppcor, | ||
tigress | ||
] | ||
|
||
|
Oops, something went wrong.