Skip to content

Commit 997fd09

Browse files
committed
viash file of tf binidng fixed
1 parent c365ec3 commit 997fd09

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

scripts/sync_resources.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ set -e
2121

2222

2323

24-
<<<<<<< HEAD
2524
# aws s3 sync s3://openproblems-data/resources/grn/grn_benchmark resources/grn_benchmark/ --no-sign-request
26-
=======
27-
aws s3 sync resources/grn_benchmark/ s3://openproblems-data/resources/grn/grn_benchmark --delete
28-
>>>>>>> 4bed17aa939bcc22fbce6094de8856b85b6c4425
2925
# aws s3 sync resources/grn_benchmark/prior s3://openproblems-data/resources/grn/grn_benchmark/prior --delete
3026
# aws s3 sync resources/extended_data/ s3://openproblems-data/resources/grn/extended_data --delete
3127
# aws s3 sync resources/results/experiment s3://openproblems-data/resources/grn/results/experiment --delete
32-
# aws s3 sync resources/supp_data s3://openproblems-data/resources/grn/supp_data --delete
28+
aws s3 sync resources_test s3://openproblems-data/resources_test/grn/ --delete

src/metrics/tf_binding/run_local.sh

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ save_dir="output/tf_binding"
1616
mkdir -p "$save_dir"
1717

1818
# datasets to process
19-
datasets=('replogle' 'norman' 'adamson' ) #"300BCG" "ibd" 'parsebioscience''op' "300BCG" 'parsebioscience'
19+
datasets=('replogle' 'norman' 'adamson') #"300BCG" "ibd" 'parsebioscience''op' "300BCG" 'parsebioscience'
2020
# methods to process
2121
methods=("negative_control" "pearson_corr" "positive_control" "ppcor" "portia" "scenic" "grnboost" "scprint" "scenicplus" "celloracle" "scglue" "figr" "granie")
2222

23-
# temporary file to collect CSV rows
24-
combined_csv="${save_dir}/tf_binding_scores.csv"
25-
echo "dataset,method,metric,value" > "$combined_csv"
26-
2723
for dataset in "${datasets[@]}"; do
2824
echo -e "\n\nProcessing dataset: $dataset\n"
25+
26+
# Create separate CSV file for each dataset
27+
dataset_csv="${save_dir}/tf_binding_scores_${dataset}.csv"
28+
echo "dataset,method,metric,value" > "$dataset_csv"
2929

3030
evaluation_data="resources/grn_benchmark/evaluation_data/${dataset}_bulk.h5ad"
3131

@@ -39,13 +39,30 @@ for dataset in "${datasets[@]}"; do
3939
fi
4040

4141
echo -e "\nProcessing method: $method\n"
42-
python src/metrics/tf_binding/script.py \
43-
--prediction "$prediction" \
44-
--evaluation_data "$evaluation_data" \
45-
--ground_truth "resources/grn_benchmark/ground_truth/K562.csv" \
46-
--score "$score"
42+
# python src/metrics/tf_binding/script.py \
43+
# --prediction "$prediction" \
44+
# --evaluation_data "$evaluation_data" \
45+
# --ground_truth "resources/grn_benchmark/ground_truth/K562.csv" \
46+
# --score "$score"
47+
48+
# Extract metrics from the .h5ad and append to CSV
49+
python -u - <<EOF
50+
import anndata as ad
51+
import pandas as pd
52+
53+
adata = ad.read_h5ad("${score}")
54+
if "metric_values" in adata.uns:
55+
metric_names = adata.uns["metric_ids"]
56+
metric_values = adata.uns["metric_values"]
57+
df = pd.DataFrame({"metric": metric_names, "value": metric_values})
58+
df["dataset"] = "${dataset}"
59+
df["method"] = "${method}"
60+
df = df[["dataset", "method", "metric", "value"]] # Reorder columns to match header
61+
df.to_csv("${dataset_csv}", mode="a", header=False, index=False)
62+
EOF
4763

4864
done
65+
echo -e "\nResults for dataset $dataset collected in: $dataset_csv"
4966
done
5067

51-
echo -e "\nAll results collected in: $combined_csv"
68+
echo -e "\nAll dataset results saved in separate CSV files in: $save_dir"

src/metrics/tf_recovery/config.vsh.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ info:
66
label: TF recovery
77
summary: Calculates TF activity for perturbations and determines recovery performance
88

9-
9+
arguments:
10+
- name: --evaluation_data_de
11+
type: file
12+
direction: input
13+
must_exist: false
14+
required: false
15+
example: resources_test/grn_benchmark/evaluation_data/replogle_de.csv
16+
17+
1018
resources:
1119
- type: python_script
1220
path: script.py

0 commit comments

Comments
 (0)