-
Notifications
You must be signed in to change notification settings - Fork 0
/
labelator.sh
executable file
·132 lines (104 loc) · 5.76 KB
/
labelator.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# Function to run the Python CLI with given parameters
run_model() {
local train_adata=$1
local query_adata=$2
local model_names=("${!3}")
local model_path=$4
local output_data_path=$5
local artifacts_path=$6
for model_name in "${model_names[@]}"
do
# echo "🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 🌊 "
echo "########################################################################"
echo "🚀 🚀 🚀 🚀 Running model: $model_name 🚀 🚀 🚀 🚀 🚀 🚀 🚀 🚀"
echo "## ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬ ⏬"
# Start timing
start_time=$(date +%s)
python -m labelator_api \
--train-path $train_adata \
--query-path $query_adata \
--model-path $model_path \
--model-name $model_name \
--output-data-path $output_data_path \
--artifacts-path $artifacts_path \
--gen-plots \
--labels-key "cell_type"
# --retrain-model
if [ $? -ne 0 ]; then
echo "🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 "
echo "🚨 🚨 🚨 🚨 🚨 Error: Model $model_name failed to run. 🚨 🚨 🚨 🚨 🚨"
echo "🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 "
fi
# End timing
end_time=$(date +%s)
echo "##### ⏫⏫⏫⏫⏫⏫⏫⏫⏫⏫ #############"
echo "# 🏁 🏁 🏁 Model $model_name completed in $((end_time - start_time)) seconds. 🏁 🏁 🏁 "
echo "## 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 🏁 "
done
}
train_data="data/scdata/xylena5k/xyl2_train.h5ad"
query_data="data/scdata/xylena5k/xyl2_test.h5ad"
adata_output_path='data/scdata/xylena5k/LABELATOR/'
# query_adata=$'/media/ergonyc/data/sc/ASAP/artifacts/07_merged_filtered_processed_integrated_clustered_annotated_anndata_object.h5ad'
# query_adata=$'/media/ergonyc/data/sc/ASAP/artifacts/07_merged_filtered_integrated_clustered_annotated_anndata_object.h5ad'
# artifacts_path='artifacts5k/'
# # Call the function
# model_path='models5k/REPR/scvi'
# # repr_model_names=("scvi_emb" "scvi_expr" "scvi_expr_pcs" "scvi_emb_xgb" "scvi_expr_xgb" "scvi_expr_pcs_xgb")
# repr_model_names=("scvi_emb" "scvi_expr" "scvi_expr_pcs")
# run_model $train_data $query_data repr_model_names[@] $model_path $adata_output_path $artifacts_path
# # model_path='models5k/CNT'
# # count_model_names=("pcs_lbl8r" "raw_lbl8r" "raw_xgb" "pcs_xgb" )
# count_model_names=("pcs_lbl8r" "raw_lbl8r")
# count_model_names=("pcs_lbl8r")
# run_model $train_data $query_data count_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models5k/TRANSFER/'
# transfer_model_names=("scanvi_batch_eq" "scanvi" )
# # run_model $train_data $query_data transfer_model_names[@] $model_path $adata_output_path $artifacts_path
query_data="data/scdata/xylena5k/xyl2_query.h5ad"
train_data=""
# Call the function
model_path='models5k/REPR/scvi'
repr_model_names=("scvi_emb" "scvi_expr" "scvi_expr_pcs")
run_model $train_data $query_data repr_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models5k/CNT'
# count_model_names=("pcs_lbl8r" "raw_lbl8r")
# count_model_names=("pcs_lbl8r")
# run_model $train_data $query_data count_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models5k/TRANSFER/'
# transfer_model_names=("scanvi_batch_eq" "scanvi" )
# # run_model $train_data $query_data transfer_model_names[@] $model_path $adata_output_path $artifacts_path
################
train_data="data/scdata/xylena10k/xyl2_train.h5ad"
query_data="data/scdata/xylena10k/xyl2_test.h5ad"
adata_output_path='data/scdata/xylena10k/LABELATOR/'
# query_adata=$'/media/ergonyc/data/sc/ASAP/artifacts/07_merged_filtered_processed_integrated_clustered_annotated_anndata_object.h5ad'
# query_adata=$'/media/ergonyc/data/sc/ASAP/artifacts/07_merged_filtered_integrated_clustered_annotated_anndata_object.h5ad'
artifacts_path='artifacts10k/'
# Call the function
model_path='models10k/REPR/scvi'
# repr_model_names=("scvi_emb" "scvi_expr" "scvi_expr_pcs" "scvi_emb_xgb" "scvi_expr_xgb" "scvi_expr_pcs_xgb")
repr_model_names=("scvi_emb" "scvi_expr" "scvi_expr_pcs")
run_model $train_data $query_data repr_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models10k/CNT'
# # count_model_names=("pcs_lbl8r" "raw_lbl8r" "raw_xgb" "pcs_xgb" )
# count_model_names=("pcs_lbl8r" "raw_lbl8r")
# count_model_names=("pcs_lbl8r")
# run_model $train_data $query_data count_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models10k/TRANSFER/'
# transfer_model_names=("scanvi_batch_eq" "scanvi" )
# # run_model $train_data $query_data transfer_model_names[@] $model_path $adata_output_path $artifacts_path
query_data="data/scdata/xylena10k/xyl2_query.h5ad"
train_data=""
# Call the function
model_path='models10k/REPR/scvi'
repr_model_names=("scvi_emb" "scvi_expr" "scvi_expr_pcs")
run_model $train_data $query_data repr_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models10k/CNT'
# count_model_names=("pcs_lbl8r" "raw_lbl8r")
# count_model_names=("pcs_lbl8r")
# run_model $train_data $query_data count_model_names[@] $model_path $adata_output_path $artifacts_path
# model_path='models10k/TRANSFER/'
# transfer_model_names=("scanvi_batch_eq" "scanvi" )
# # run_model $train_data $query_data transfer_model_names[@] $model_path $adata_output_path $artifacts_path