-
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
12 changed files
with
199 additions
and
56 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
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,47 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# Default values | ||
grn="" | ||
sample="200" # Default value for sample | ||
grn_name="test" | ||
subsample="200" # Default value for sample | ||
reg_type="ridge" | ||
score="out/score.csv" | ||
layer="pearson" | ||
max_workers="4" | ||
|
||
# Parse arguments | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--grn) grn="$2"; shift ;; | ||
--sample) sample="$2"; shift ;; | ||
--grn_model) grn_model="$2"; shift ;; | ||
--grn_name) grn_name="$2"; shift ;; | ||
--subsample) subsample="$2"; shift ;; | ||
--reg_type) reg_type="$2"; shift ;; | ||
--score) score="$2"; shift ;; | ||
--layer) layer="$2"; shift ;; | ||
--max_workers) max_workers="$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>]" | ||
if [ -z "$grn_model" ]; then | ||
echo "Usage: $0 --grn_model <grn_file> [--subsample <sample_value>]" | ||
exit 1 | ||
fi | ||
|
||
# Print parsed arguments (for debugging purposes) | ||
echo "GRN file: $grn" | ||
echo "Sample value: $sample" | ||
echo "Regression model: $reg_type" | ||
echo "GRN name: $grn_name Regression model: $reg_type Samples: $subsample layer: $layer max_workers: $max_workers" | ||
|
||
# Clean bin/ folder | ||
rm -r bin | ||
mkdir bin | ||
|
||
# Run regression analysis 1 | ||
echo "Running GRN benchmark with $grn and sample size $sample" | ||
# # Run regression analysis 1 | ||
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 | ||
score_reg1="${score/.csv/_reg1.csv}" | ||
viash run src/metrics/regression_1/config.vsh.yaml -- --perturbation_data resources/grn-benchmark/perturbation_data.h5ad \ | ||
--reg_type $reg_type --prediction $grn_model --score $score_reg1 --layer $layer --subsample $subsample --max_workers $max_workers | ||
|
||
# Run regression analysis 2 | ||
# # Run regression analysis 2 | ||
echo "Regression 2" | ||
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 --reg_type $reg_type --prediction $grn --score $score | ||
score_reg2="${score/.csv/_reg2.csv}" | ||
time viash run src/metrics/regression_1/config.vsh.yaml -- --perturbation_data resources/grn-benchmark/perturbation_data.h5ad \ | ||
--reg_type $reg_type --prediction $grn_model --score $score_reg2 --layer $layer --subsample $subsample --max_workers $max_workers | ||
|
||
|
||
paste -d ',' "$score_reg1" <(cut -d ',' -f2- "$score_reg2") > $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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,56 @@ | ||
#!/bin/bash | ||
|
||
models_folder="resources/grn-benchmark/grn_models" | ||
grn_models=( | ||
grn_names=( | ||
"celloracle" | ||
"scenicplus" | ||
"figr" | ||
"granie" | ||
"scglue" | ||
"positive_control" | ||
"negative_control" | ||
) | ||
reg_type="ridge" | ||
subsample="2" | ||
max_workers="4" | ||
folder="out" | ||
|
||
# Loop through each GRN model and run the benchmark script | ||
for grn_model in "${grn_models[@]}"; do | ||
bash scripts/run_evaluation_grn.sh --grn "$models_folder/$grn_model.csv" --sample 200 --reg_type ridge --score "out/$grn_model.csv" | ||
|
||
# layer="pearson" | ||
layers=("pearson" "lognorm" "scgen_pearson" "scgen_lognorm" "seurat_pearson" "seurat_lognorm") | ||
|
||
for layer in "${layers[@]}"; do | ||
# Loop through each GRN model and run the benchmark script | ||
layer_folder="${folder}/${layer}" | ||
mkdir $layer_folder | ||
for grn_name in "${grn_names[@]}"; do | ||
grn_model="${models_folder}/${grn_name}.csv" | ||
score="${layer_folder}/${grn_name}.csv" | ||
bash scripts/run_evaluation.sh --grn_model "$grn_model" \ | ||
--grn_name "$grn_name" --subsample "$subsample" --reg_type "$reg_type" \ | ||
--score "$score" --max_workers "$max_workers" --layer "$layer" | ||
done | ||
done | ||
|
||
# aggregate the scores across layers (axis=0) | ||
for grn_name in "${grn_names[@]}"; do | ||
# Define a file to store the aggregated scores | ||
aggregated_score="${folder}/${grn_name}.csv" | ||
|
||
# Remove the file if it exists (to avoid appending to old data) | ||
rm -f "$aggregated_score" | ||
|
||
for layer in "${layers[@]}"; do | ||
# Define the path to the score file for the current layer | ||
layer_folder="${folder}/${layer}" | ||
score="${layer_folder}/${grn_name}.csv" | ||
|
||
# Append the score to the aggregated file | ||
# Skip the header for all but the first file | ||
if [ -s "$aggregated_score" ]; then | ||
tail -n +2 "$score" >> "$aggregated_score" | ||
else | ||
cat "$score" > "$aggregated_score" | ||
fi | ||
done | ||
done |
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
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