Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/methods/senkin/senkin/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
__merge__: ../../../api/comp_method.yaml
name: senkin
label: SenKin
summary: "LightGBM + bidirectional GRU ensemble for CITE-seq protein prediction (OpenProblems 2022 2nd place)"
description: |
Two-stage method from the OpenProblems NeurIPS 2021 competition. Stage 1 trains four
LightGBM models on different RNA feature representations (log-normalized, CLR-TSVD,
custom sqrt-normalized, and raw counts). Stage 2 refines predictions with two neural
network architectures: a bidirectional GRU with cosine-similarity loss and a dense
bidirectional GRU with MSE loss. Final predictions are a weighted blend (55% cosine,
45% MSE) of per-fold averaged outputs.
references:
doi:
- 10.1101/2022.04.11.487796
links:
repository: https://github.com/lueckenlab/senkin-tmp-cite-pred
info:
preferred_normalization: log_cp10k
resources:
- path: main.nf
type: nextflow_script
entrypoint: run_wf
dependencies:
- name: methods/senkin_train
- name: methods/senkin_predict
runners:
- type: nextflow
18 changes: 18 additions & 0 deletions src/methods/senkin/senkin/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
workflow run_wf {
take: input_ch
main:
output_ch = input_ch
| senkin_train.run(
fromState: ["input_train_mod1", "input_train_mod2", "input_test_mod1"],
toState: ["input_model": "output"]
)
| senkin_predict.run(
fromState: ["input_test_mod1", "input_train_mod2", "input_model"],
toState: ["output": "output"]
)
| map { tup ->
[tup[0], [output: tup[1].output]]
}

emit: output_ch
}
24 changes: 24 additions & 0 deletions src/methods/senkin/senkin_predict/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
__merge__: ../../../api/comp_method_predict.yaml
name: senkin_predict
resources:
- path: script.py
type: python_script
engines:
- type: docker
image: openproblems/base_pytorch_nvidia:1
setup:
- type: docker
run: pip install --no-cache-dir --no-deps git+https://github.com/lueckenlab/senkin-tmp-cite-pred.git
- type: python
packages:
- lightgbm>=4.0
- tensorflow>=2.12
- scikit-learn>=1.1
- mudata>=0.2
- muon>=0.1
- fast-array-utils
runners:
- type: executable
- type: nextflow
directives:
label: [highmem, hightime, midcpu, gpu]
41 changes: 41 additions & 0 deletions src/methods/senkin/senkin_predict/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import logging
import pickle

import anndata as ad
import numpy as np
from scipy.sparse import csc_matrix

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

## VIASH START
par = {
"input_test_mod1": "resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/test_mod1.h5ad",
"input_train_mod2": "resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/train_mod2.h5ad",
"input_model": "output_model.pkl",
"output": "output_pred.h5ad",
}
meta = {"name": "senkin"}
## VIASH END

logger.info("Reading input files...")
adata_rna_test = ad.read_h5ad(par["input_test_mod1"])
adata_prot_train = ad.read_h5ad(par["input_train_mod2"])

logger.info("Loading model bundle...")
with open(par["input_model"], "rb") as f:
bundle = pickle.load(f)

logger.info("Writing predictions...")
adata_out = ad.AnnData(
layers={"normalized": csc_matrix(bundle["test_predictions"])},
obs=adata_rna_test.obs,
var=adata_prot_train.var,
uns={
"dataset_id": adata_rna_test.uns.get("dataset_id", bundle.get("dataset_id", "")),
"method_id": meta["name"],
},
)

adata_out.write_h5ad(par["output"], compression="gzip")
logger.info("Predictions saved to %s", par["output"])
45 changes: 45 additions & 0 deletions src/methods/senkin/senkin_train/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
__merge__: ../../../api/comp_method_train.yaml
name: senkin_train
resources:
- path: script.py
type: python_script
arguments:
- name: "--n_folds"
type: integer
default: 5
description: Number of cross-validation folds for LightGBM and neural network training.
- name: "--lgbm_boost_rounds"
type: integer
default: 10000
description: Maximum LightGBM boosting rounds (early stopping applies).
- name: "--lgbm_early_stopping"
type: integer
default: 100
description: LightGBM early stopping patience (rounds without improvement).
- name: "--nn_epochs"
type: integer
default: 100
description: Maximum neural network training epochs (early stopping applies).
- name: "--n_tsvd_components"
type: integer
default: 100
description: TSVD components for reducing LightGBM predictions before NN input.
engines:
- type: docker
image: openproblems/base_pytorch_nvidia:1
setup:
- type: docker
run: pip install --no-cache-dir --no-deps git+https://github.com/lueckenlab/senkin-tmp-cite-pred.git
- type: python
packages:
- lightgbm>=4.0
- tensorflow>=2.12
- scikit-learn>=1.1
- mudata>=0.2
- muon>=0.1
- fast-array-utils
runners:
- type: executable
- type: nextflow
directives:
label: [highmem, hightime, midcpu, gpu]
Loading