Skip to content

Commit

Permalink
fix viash 0.9 refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Oct 31, 2024
1 parent cb4543d commit 501a886
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion common
2 changes: 1 addition & 1 deletion src/control_methods/ground_truth/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ output <- anndata::AnnData(
var = de_test_h5ad$var[, c()],
uns = list(
dataset_id = de_test_h5ad$uns$dataset_id,
method_id = meta$functionality_name
method_id = meta$name
)
)

Expand Down
2 changes: 1 addition & 1 deletion src/control_methods/mean_across_celltypes/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)
output.write_h5ad(par["output"], compression="gzip")
2 changes: 1 addition & 1 deletion src/control_methods/mean_across_compounds/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)
output.write_h5ad(par["output"], compression="gzip")
2 changes: 1 addition & 1 deletion src/control_methods/mean_outcome/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)
output.write_h5ad(par["output"], compression="gzip")
4 changes: 2 additions & 2 deletions src/control_methods/sample/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ par <- list(
output = "resources/datasets/neurips-2023-data/output_identity.h5ad"
)
meta <- list(
functionality_name = "sample"
name = "sample"
)
## VIASH END

Expand All @@ -35,7 +35,7 @@ output <- anndata::AnnData(
shape = c(nrow(id_map), length(gene_names)),
uns = list(
dataset_id = de_train_h5ad$uns$dataset_id,
method_id = meta$functionality_name
method_id = meta$name
)
)

Expand Down
2 changes: 1 addition & 1 deletion src/control_methods/zeros/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)
output.write_h5ad(par["output"], compression="gzip")
2 changes: 1 addition & 1 deletion src/methods/jn_ap_op2/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/methods/lgc_ensemble_helpers/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def predict(par, meta, paths):
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)
print(output)
Expand Down
2 changes: 1 addition & 1 deletion src/methods/lgc_ensemble_predict/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
df_sub.reset_index(drop=True, inplace=True)

# write output
method_id = meta["functionality_name"].replace("_predict", "")
method_id = meta["name"].replace("_predict", "")
output = ad.AnnData(
layers={"prediction": df_sub.to_numpy()},
obs=pd.DataFrame(index=id_map["id"]),
Expand Down
2 changes: 1 addition & 1 deletion src/methods/nn_retraining_with_pseudolabels/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/methods/pyboost/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
var=pd.DataFrame(index=genes),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/methods/scape/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def write_predictions(df_submission_data, par, meta, de_train_h5ad, id_map):
var=pd.DataFrame(index=genes),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/methods/transformer_ensemble/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
var=pd.DataFrame(index=gene_names),
uns={
"dataset_id": de_train_h5ad.uns["dataset_id"],
"method_id": meta["functionality_name"]
"method_id": meta["name"]
}
)

Expand Down
14 changes: 7 additions & 7 deletions src/workflows/run_benchmark/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ workflow run_wf {
output: 'predictions/$id.$key.output.h5ad',
output_model: null
]
if (comp.config.functionality.info.type == "control_method") {
if (comp.config.info.type == "control_method") {
new_args.de_test_h5ad = state.de_test_h5ad
}
new_args
Expand Down Expand Up @@ -126,10 +126,10 @@ def run_benchmark_fun(args) {
// add the key prefix to the method and metric names
if (keyPrefix && keyPrefix != "") {
methods_ = methods.collect{ method ->
method.run(key: keyPrefix + method.config.functionality.name)
method.run(key: keyPrefix + method.config.name)
}
metrics_ = metrics.collect{ metric ->
metric.run(key: keyPrefix + metric.config.functionality.name)
metric.run(key: keyPrefix + metric.config.name)
}
}

Expand All @@ -142,10 +142,10 @@ def run_benchmark_fun(args) {
| runEach(
components: methods_,
filter: { id, state, comp ->
!state.method_ids || state.method_ids.contains(comp.config.functionality.name)
!state.method_ids || state.method_ids.contains(comp.config.name)
},
id: { id, state, comp ->
id + "." + comp.config.functionality.name
id + "." + comp.config.name
},
fromState: methodFromState,
toState: methodToState,
Expand All @@ -156,10 +156,10 @@ def run_benchmark_fun(args) {
| runEach(
components: metrics_,
filter: { id, state, comp ->
!state.metric_ids || state.metric_ids.contains(comp.config.functionality.name)
!state.metric_ids || state.metric_ids.contains(comp.config.name)
},
id: { id, state, comp ->
id + "." + comp.config.functionality.name
id + "." + comp.config.name
},
fromState: metricFromState,
toState: metricToState,
Expand Down

0 comments on commit 501a886

Please sign in to comment.