diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 183b5d9..1b269b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: cache: pip - run: python -m pip install torch==2.4.1 --index-url https://download.pytorch.org/whl/cpu - run: python -m pip install -e ".[dev]" - - run: python -m compileall -q src tests + - run: python -m compileall -q src - run: python -m pytest -q - run: rtp-codec --help && rtp-codec train --help && rtp-codec encode --help - - run: find scripts -type f \( -name '*.sh' -o -name '*.sbatch' \) -print0 | xargs -0 -n1 bash -n + - run: find research/scripts -type f \( -name '*.sh' -o -name '*.sbatch' \) -print0 | xargs -0 -n1 bash -n diff --git a/CITATION.cff b/CITATION.cff index 4b026c2..264049e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,5 +1,5 @@ cff-version: 1.2.0 -message: "Please cite the RTP-CODEC manuscript and this repository when using the code." +message: "Please cite RTP-CODEC, accepted to BioFM @ ICDM'26, and this repository when using the code." title: "RTP-CODEC: Learning Compact TCR Representations from Multiple Biological Objectives" type: software version: 0.1.0 diff --git a/README.md b/README.md index f7e0904..c43ada3 100644 --- a/README.md +++ b/README.md @@ -1,172 +1,58 @@ # RTP-CODEC -**Learning Compact TCR Representations from Multiple Biological Objectives** +![RTP-CODEC model: CDR3 sequence, anchor tokenizer, Transformer encoder and three biological objectives](docs/figures/model-schematic.png) -Elizaveta Vlasova, Petr Grigorev, Mariia Demidova, Sergey Muravyov and Mikhail Shugay +**Learning Compact TCR Representations from Multiple Biological Objectives**
+**Accepted to BioFM @ ICDM'26** -RTP-CODEC learns a **128-dimensional representation of a human TRB CDR3 amino-acid sequence**. A shared Transformer encoder is trained jointly to reconstruct the sequence (**R**), predict TCRemP reference coordinates (**T**), and estimate generation probability (**P**). Once trained, the encoder takes only the CDR3 sequence; TCRemP computation and V/J annotations are needed for training supervision, not for sequence encoding. +Elizaveta Vlasova · Petr Grigorev · Mariia Demidova · Sergey Muravyov · Mikhail Shugay -This repository contains the model, training pipeline, tokenizers, evaluation tools and result tables accompanying the manuscript *RTP-CODEC: Learning Compact TCR Representations from Multiple Biological Objectives*. +RTP-CODEC learns a **128-dimensional TRB CDR3 representation** through sequence reconstruction (**R**), TCRemP supervision (**T**) and generation-probability prediction (**P**). After training, encoding requires only the amino-acid sequence. -```mermaid -flowchart LR - S[TRB CDR3 sequence] --> A[DATA-ANCHOR tokenizer] - A --> E[Transformer encoder] - E --> Z[128-dimensional vector] - Z --> R[Sequence reconstruction] - Z --> T[TCRemP coordinates] - Z --> P[log10 generation probability] -``` - -The three heads provide supervision during training. The reusable representation is the encoder output before those heads. +[Quick start](#quick-start) · [Reproduce the paper](docs/reproduction.md) · [Results](research/results/paper/README.md) · [Documentation](docs/README.md) -## Installation +## Quick start -Python 3.11 or newer is required. From the repository root: +Python 3.11+; install from the repository root: ```bash -git clone https://github.com/VEK239/rtp-codec.git -cd rtp-codec -python -m venv .venv -# Linux/macOS: -source .venv/bin/activate -# Windows PowerShell: .venv/Scripts/Activate.ps1 -python -m pip install --upgrade pip python -m pip install -e . ``` -For a CPU-only environment, install CPU PyTorch before the package: - -```bash -python -m pip install torch==2.4.1 --index-url https://download.pytorch.org/whl/cpu -python -m pip install -e ".[dev]" -``` - -Optional dependencies are grouped by purpose: - -| Extra | Purpose | -| --- | --- | -| `pgen` | OLGA-backed target generation through the pinned mirpy revision | -| `benchmarks` | ESM, TCR-BERT and SCEPTR representation comparisons | -| `tracking` | Weights & Biases logging for earlier training workflows | -| `notebooks` | Interactive analyses and plots | -| `dev` | CPU test suite | - -For example, `python -m pip install -e ".[pgen,benchmarks,dev]"`. External encoders also require their own model weights; TCRemP requires its separate installation and prototype data. The reported manuscript environment used PyTorch 2.4.1; GPU work additionally requires a compatible CUDA installation. - -## Encode sequences - -The repository contains source code and result tables. **Trained model weights, tokenizer bundles and the full benchmark data are not bundled here.** Encoding requires a compatible `best.pt` checkpoint and, for DATA-ANCHOR or WordPiece models, its original tokenizer bundle. See [data and model assets](docs/assets.md). - -Prepare a TSV with a `junction_aa` column; [examples/data/sequences.tsv](examples/data/sequences.tsv) shows the format. Each sequence must contain standard amino acids and fit the checkpoint's maximum length (40 residues in the manuscript). +Encode an input TSV with a `junction_aa` column: ```bash rtp-codec encode \ - --checkpoint artifacts/paper/rtp-seed42/best.pt \ - --tokenizer data/tokenizers/data_anchor/anchored_tokenizer.json \ - --input examples/data/sequences.tsv \ - --output artifacts/example_latents.npy \ - --device cpu + --checkpoint /path/to/best.pt \ + --tokenizer /path/to/anchored_tokenizer.json \ + --input research/examples/data/sequences.tsv \ + --output artifacts/latents.npy ``` -The output is a float32 NumPy matrix with one vector per input row in the same order, plus a JSON sidecar describing the input and matrix. The vector dimension comes from the checkpoint. `--tokenizer` relocates a saved bundle; it does not retrain or replace the tokenizer. Use `--sequence-column cdr3` for a differently named input column. - -The same interface is available in Python: +This writes one vector per input row, preserving order. Model weights, tokenizer bundles and the locked dataset are separate assets; see [asset requirements](docs/assets.md). Installation options, the Python API and training examples are in the [usage guide](docs/usage.md). -```python -from rtp_codec.inference import load_encoder +## Repository -encoder = load_encoder( - "artifacts/paper/rtp-seed42/best.pt", - tokenizer_path="data/tokenizers/data_anchor/anchored_tokenizer.json", - device="cpu", -) -vectors = encoder.encode_sequences(["CASSLGQETQYF", "CASSIRSSYEQYF"]) -# vectors.shape == (2, 128) for the manuscript checkpoint -``` - -## Train the manuscript model +| Directory | Contents | +| --- | --- | +| [`src/`](src/) | Installable `rtp_codec` library and CPU tests | +| [`research/`](research/README.md) | Paper configurations, results, launchers, examples and historical notebooks | +| [`docs/`](docs/README.md) | Usage, reproduction, architecture and migration guides | -The paper uses a locked synthetic TRB dataset of 99,430 unique receptors, split into 79,544 training, 9,943 validation and 9,943 test rows. DATA-ANCHOR edge motifs and target normalizers are fitted on training rows only. Its middle WordPiece vocabulary is trained on a separate 500,000-sequence OLGA corpus with all benchmark sequences excluded. Reconstruction always uses an autoregressive character decoder. +The diagram above is the original first figure from the final manuscript, rendered for GitHub; its [vector PDF](docs/figures/model-schematic.pdf) is preserved. -Seven matched objective presets live in [configs/paper](configs/paper): `r`, `t`, `p`, `rt`, `rp`, `tp` and `rtp`. Supply the prepared dataset and tokenizer paths: +## Citation -```bash -rtp-codec train \ - --config configs/paper/rtp.json \ - --data-dir data/benchmark/trb \ - --tokenizer-path data/tokenizers/data_anchor/anchored_tokenizer.json \ - --device cuda -``` +**Accepted to BioFM @ ICDM'26.** -These presets use a 128-dimensional bottleneck, hidden width 320, eight attention heads, four encoder and four decoder layers, batch size 64 and up to 40 epochs. Early stopping is disabled; the checkpoint with the lowest joint validation loss is retained. Command-line arguments override preset values. Training writes `best.pt`, `last.pt`, target normalization statistics, run configuration and evaluation metrics to the configured output directory. - -For data preparation, tokenizer construction, the full objective factorial and downstream evaluation, follow [the reproduction guide](docs/reproduction.md). Cluster launchers are described in [docs/cluster.md](docs/cluster.md). A new split or regenerated tokenizer constitutes a new experiment; it should not be presented as an exact reproduction of the locked manuscript runs. - -## Results reported in the manuscript - -Native heads on the held-out synthetic benchmark: - -| Objectives | Reconstruction exact match ↑ | TCRemP cosine ↑ | Pgen RMSE ↓ | -| --- | ---: | ---: | ---: | -| R | 0.9766 | — | — | -| T | — | 0.99149 | — | -| P | — | — | 0.2753 | -| RT | 0.9632 | 0.99178 | — | -| RP | 0.9813 | — | 0.2264 | -| TP | — | 0.99169 | 0.3496 | -| RTP | 0.9636 | 0.99190 | 0.2702 | - -Source: [matched objective factorial](results/paper/factorial_results.tsv). Pgen means regression of `log10_pgen_1mm`. Dashes indicate inactive objectives. These results show an objective tradeoff: adding T to RP improves teacher agreement while reducing native reconstruction and Pgen performance. - -New heads trained on frozen representations provide a separate information-recovery comparison: - -| Frozen representation | Reconstruction exact match ↑ | Pgen RMSE ↓ | -| --- | ---: | ---: | -| RTP-CODEC | 0.8831 ± 0.0058 | 0.2375 ± 0.0008 | -| TCRemP | 0.5181 ± 0.0024 | 0.6038 ± 0.0019 | -| TCR-BERT | 0.4778 ± 0.0179 | 0.4299 ± 0.0022 | -| ESM2-35M | 0.2042 ± 0.0132 | 0.7086 ± 0.0033 | -| SCEPTR, CDR3-only | 0.8213 ± 0.0043 | 0.6637 ± 0.0062 | - -Source: [consolidated frozen-representation comparison](results/paper/external_author_global_comparison.tsv). Values are mean ± standard deviation across probe seeds; reconstruction uses the common 64-dimensional comparison space. These are fresh probe heads, not the codec's native heads above. - -On the independent real VDJdb cohort, RTP-CODEC achieved macro Cohen's d of 0.6866 and improved epitope separation over RP for 31 of 40 epitopes. Native TCRemP and its PCA-128 control remained stronger (0.9563 and 0.8230). The manuscript's single runtime measurements on 68,302 receptors were 29.26 s for RTP-CODEC on CPU, 9.36 s on GPU and 350.25 s for 16-thread TCRemP. Timings exclude loading and warm-up and use different pipeline boundaries; they are hardware-specific, not a general speed guarantee. - -The [paper result index](results/paper/README.md) links architecture, tokenizer, downstream and error-analysis tables with their provenance. Earlier benchmark tables are retained in [results/legacy](results/legacy). - -## Repository layout - -```text -src/rtp_codec/ - models/ Shared codec and earlier forward/inverse/Pgen models - tokenization/ Character, WordPiece and anchored tokenizers - data/ AIRR input, dataset alignment, caches and target generation - training/ Trainers, losses, checkpoint handling and tracking - inference.py Checkpoint loading and sequence-to-vector API - evaluation/ Shared metric accumulation - benchmarks/ Dataset preparation, frozen probes, VDJdb and runtime analyses - experiments/ Tokenizer studies, comparison runners and preflight checks -configs/ - paper/ Seven manuscript objective presets - trb/ Recorded configurations for earlier controlled studies -scripts/ - training/ Shell training entry points - slurm/ Cluster templates grouped by task - legacy/ Earlier experiment launchers -results/ - paper/ Manuscript result tables and provenance - legacy/ Earlier benchmark results -examples/data/ Small input examples -notebooks/ Exploratory and historical notebooks -tests/ CPU regression and integration tests -docs/ Reproduction, architecture, assets and migration guides +```bibtex +@inproceedings{vlasova2026rtpcodec, + title = {RTP-CODEC: Learning Compact TCR Representations from Multiple Biological Objectives}, + author = {Vlasova, Elizaveta and Grigorev, Petr and Demidova, Mariia and Muravyov, Sergey and Shugay, Mikhail}, + booktitle = {BioFM @ ICDM'26}, + year = {2026}, + note = {Accepted} +} ``` -Run `python -m pytest -q` after installing the `dev` extra. The CPU suite includes a small end-to-end training run, tokenizer compatibility checks, dataset alignment, metric checks and checkpoint-based inference. GitHub Actions also checks the public CLI and shell syntax. - -## Citation and license - -Please cite *RTP-CODEC: Learning Compact TCR Representations from Multiple Biological Objectives* by Elizaveta Vlasova, Petr Grigorev, Mariia Demidova, Sergey Muravyov and Mikhail Shugay. A publication DOI has not yet been added to this repository. [CITATION.cff](CITATION.cff) provides software citation metadata. - -The code is distributed under [GNU GPL v3](LICENSE). External models and datasets retain their own licenses. +Software citation metadata: [CITATION.cff](CITATION.cff). Code license: [GPL v3](LICENSE). diff --git a/docs/README.md b/docs/README.md index 06750e4..3cb49a4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,6 @@ # Documentation +- [Installation, encoding and training](usage.md) - [Reproduce the manuscript experiments](reproduction.md) - [Model architecture and objectives](architecture.md) - [Data, tokenizer and checkpoint assets](assets.md) @@ -8,6 +9,6 @@ - [Development and validation](development.md) - [Anchored tokenizer study](anchored_tokenizer_study.md) - [VDJdb validation protocol](vdjdb_epitope_validation.md) -- [Earlier benchmark protocols](protocols/) +- [Earlier benchmark protocols](protocols) -The main results are indexed in [results/paper](../results/paper/README.md). Historical reports and integration provenance are retained under [legacy](legacy/). +The main results are indexed in [research/results/paper](../research/results/paper/README.md). Historical reports and integration provenance are retained under [legacy](legacy). diff --git a/docs/architecture.md b/docs/architecture.md index 95d5628..9be42dc 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -14,6 +14,6 @@ The DATA-ANCHOR tokenizer uses train-derived edge motifs and a separately traine Full RTP training assigns weight 1 to each term. Inactive objectives have weight 0. Normalization statistics are fitted only on the training rows. TCRemP and Pgen targets are precomputed; sequence encoding after training does not run either target generator. -Implementation: [codec](../src/rtp_codec/models/codec.py), [objectives](../src/rtp_codec/training/objectives.py), [trainer](../src/rtp_codec/training/multitask.py). The seven [paper presets](../configs/paper/) hold architecture and optimization settings fixed while changing objective weights. +Implementation: [codec](../src/rtp_codec/models/codec.py), [objectives](../src/rtp_codec/training/objectives.py), [trainer](../src/rtp_codec/training/multitask.py). The seven [paper presets](../research/configs/paper) hold architecture and optimization settings fixed while changing objective weights. -Earlier configurations under `configs/trb` include other bottleneck widths and tokenizer choices. Always load the architecture recorded in a checkpoint rather than substituting the current defaults. +Earlier configurations under `research/configs/trb` include other bottleneck widths and tokenizer choices. Always load the architecture recorded in a checkpoint rather than substituting the current defaults. diff --git a/docs/assets.md b/docs/assets.md index 36a6d72..2409f6f 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -1,6 +1,6 @@ # Data and model assets -The Git repository distributes code, small format examples, experiment configuration records and result tables. It does not currently distribute the locked dataset, trained model checkpoint, DATA-ANCHOR bundle or a DOI-backed model/data release. Their existing hashes and run locations are recorded in [results/paper/provenance_and_hashes.tsv](../results/paper/provenance_and_hashes.tsv); recorded cluster paths describe past runs and are not public download links. +The Git repository distributes code, small format examples, experiment configuration records and result tables. It does not currently distribute the locked dataset, trained model checkpoint, DATA-ANCHOR bundle or a DOI-backed model/data release. Their existing hashes and run locations are recorded in [research/results/paper/provenance_and_hashes.tsv](../research/results/paper/provenance_and_hashes.tsv); recorded cluster paths describe past runs and are not public download links. ## Prepared training dataset diff --git a/docs/cluster.md b/docs/cluster.md index 852364c..39c7af1 100644 --- a/docs/cluster.md +++ b/docs/cluster.md @@ -2,7 +2,7 @@ Install RTP-CODEC into the Python environment used by compute jobs. Submit from the repository root; scheduler partitions, GPU resources and memory limits must match the destination cluster. -The launchers are grouped under `scripts/slurm/{data,training,evaluation,preflight,reports,legacy}`. They preserve earlier experiment conditions and some external asset paths; review those paths before submitting. No jobs are launched merely by installing the package. +The launchers are grouped under `research/scripts/slurm/{data,training,evaluation,preflight,reports,legacy}`. They preserve earlier experiment conditions and some external asset paths; review those paths before submitting. No jobs are launched merely by installing the package. The compact manuscript launcher accepts any of the seven paper conditions: @@ -11,9 +11,9 @@ export RTP_CODEC_ROOT="$PWD" export RTP_CODEC_PYTHON="$PWD/.venv/bin/python" export DATA_DIR=/path/to/locked/trb export TOKENIZER_PATH=/path/to/data_anchor/anchored_tokenizer.json -sbatch scripts/slurm/training/paper.sbatch rtp +sbatch research/scripts/slurm/training/paper.sbatch rtp ``` Change scheduler resource flags with `sbatch --partition=... --gres=...` as appropriate. Logs use the submission directory, and the preset writes results under `artifacts/paper/-seed42` unless `OUTPUT_DIR` is supplied. -Historical launchers may require preflight manifests, external encoder weights, TCRemP software and existing experiment directories. Their sequence/data gates should be satisfied before full jobs are submitted. Use the [reproduction guide](reproduction.md) and the corresponding [protocol](protocols/) for asset requirements. +Historical launchers may require preflight manifests, external encoder weights, TCRemP software and existing experiment directories. Their sequence/data gates should be satisfied before full jobs are submitted. Use the [reproduction guide](reproduction.md) and the corresponding [protocol](protocols) for asset requirements. diff --git a/docs/figures/model-schematic.pdf b/docs/figures/model-schematic.pdf new file mode 100644 index 0000000..074e1ae Binary files /dev/null and b/docs/figures/model-schematic.pdf differ diff --git a/docs/figures/model-schematic.png b/docs/figures/model-schematic.png new file mode 100644 index 0000000..c399215 Binary files /dev/null and b/docs/figures/model-schematic.png differ diff --git a/docs/legacy/benchmark_report.md b/docs/legacy/benchmark_report.md index fecffc8..1e98a2f 100644 --- a/docs/legacy/benchmark_report.md +++ b/docs/legacy/benchmark_report.md @@ -158,7 +158,7 @@ property IRRM-CODEC adds on top. The reconstruction benchmark therefore bounds o about the representation; the Pgen benchmark tests the project's speed argument, where the comparison is against OLGA rather than against other encoders. -Reproduce with `scripts/slurm/legacy/reconstruction_array.sbatch`, then +Reproduce with `research/scripts/slurm/legacy/reconstruction_array.sbatch`, then `python -m rtp_codec.benchmarks.reconstruction.collect_reconstruction`. ## 3. Pgen prediction @@ -183,7 +183,7 @@ The whole sweep was then run **twice**, under two learning-rate configurations: patience widened from 8 to 12 so the schedule reaches its tail). The second configuration was not a tuning pass but a robustness check, and it changed the headline conclusion. All tables below report the cosine runs, which converge better and vary less; the constant-rate -numbers are kept in `results/pgen_constlr/` for comparison. +numbers are kept in `research/results/pgen_constlr/` for comparison. ### Results on the full training split @@ -214,7 +214,7 @@ Mean ± standard deviation over seeds, on the held-out test split. The ordering is identical on both targets and at every training size: the two IRRM arms lead, TCR-BERT is the best frozen representation, then SCEPTR and ESM-2, with Ridge last. The gaps are large — IRRM halves the error of SCEPTR, ESM-2 and Ridge — and far exceed -seed spread. Per-size tables are in `results/legacy/pgen/pgen_summary.md`. +seed spread. Per-size tables are in `research/results/legacy/pgen/pgen_summary.md`. For reference, the committed pgen notebook reports RMSE 0.5914, R² 0.9437 and Pearson 0.9874 on `log10_pgen_1mm`. The best arm here reaches RMSE 0.2181, R² 0.9813 and Pearson @@ -349,8 +349,8 @@ demonstrated. **Loses: throughput against a trivial baseline.** TF-IDF + Ridge is 22× faster on CPU. If an application needs coarse Pgen estimates at maximum rate, k-mers remain the right tool. -Reproduce with `scripts/slurm/legacy/pgen_array.sbatch` and -`scripts/slurm/legacy/pgen_seeds_array.sbatch`, then `python -m rtp_codec.benchmarks.pgen.collect_pgen` and +Reproduce with `research/scripts/slurm/legacy/pgen_array.sbatch` and +`research/scripts/slurm/legacy/pgen_seeds_array.sbatch`, then `python -m rtp_codec.benchmarks.pgen.collect_pgen` and `python -m rtp_codec.benchmarks.runtime.benchmark_speed`. ## Limitations diff --git a/docs/legacy/publication.md b/docs/legacy/publication.md index b405ec9..d39ffdc 100644 --- a/docs/legacy/publication.md +++ b/docs/legacy/publication.md @@ -41,7 +41,7 @@ No cluster jobs are submitted by installing this repository or running its CPU t Run `python -m pytest -q` from the repository root. Tests cover reconstruction, objective combinations, tokenizers, data identity/alignment, standardizers, metrics, external benchmark bookkeeping, and VDJdb cohort rules. Optional external encoders -need requirements/benchmarks.txt plus model downloads; complete GPU training and +need research/environments/benchmarks.txt plus model downloads; complete GPU training and external-data experiments require separately provisioned resources. Tab-separated result files preserve empty terminal fields. Trailing tabs in these diff --git a/docs/migration.md b/docs/migration.md index 9d5ad79..bddaae2 100644 --- a/docs/migration.md +++ b/docs/migration.md @@ -23,9 +23,9 @@ python -m pip install -e . | `irrm_codec.anchored_tokenization` | `rtp_codec.tokenization.anchored` | | `benchmark.` | Task-specific module under `rtp_codec.benchmarks` | | `scripts.` | Task-specific module under `rtp_codec.experiments` | -| `experiments/trb/` | `configs/trb/` | -| `results/author` | `results/paper` | -| Root requirements files | `pyproject.toml` and `requirements/` | +| `experiments/trb/` | `research/configs/trb/` | +| `research/results/author` | `research/results/paper` | +| Root requirements files | `pyproject.toml` and `research/environments/` | Python modules are launched with `python -m ...` after installation. The old `irrm_codec` Python namespace is no longer exposed. Existing shell launchers have been updated; update imports in your own notebooks or external scripts. diff --git a/docs/reproduction.md b/docs/reproduction.md index ce84019..0595ce6 100644 --- a/docs/reproduction.md +++ b/docs/reproduction.md @@ -33,7 +33,7 @@ The routine fits edge motifs on the training split, filters the independent corp For one condition: ```bash -rtp-codec train --config configs/paper/rtp.json \ +rtp-codec train --config research/configs/paper/rtp.json \ --data-dir data/benchmark/trb \ --tokenizer-path data/tokenizers/data_anchor/anchored_tokenizer.json \ --device cuda @@ -43,7 +43,7 @@ For all seven conditions (Bash): ```bash for arm in r t p rt rp tp rtp; do - rtp-codec train --config "configs/paper/$arm.json" \ + rtp-codec train --config "research/configs/paper/$arm.json" \ --data-dir data/benchmark/trb \ --tokenizer-path data/tokenizers/data_anchor/anchored_tokenizer.json \ --device cuda @@ -74,7 +74,7 @@ python -m rtp_codec.benchmarks.representations.preflight_author_global_embedding python -m rtp_codec.benchmarks.runtime.benchmark_rtp_runtime --help ``` -The [protocol documents](protocols/) and grouped [Slurm templates](../scripts/slurm/) specify the respective asset layouts and experiment arguments. Use the final consolidated [frozen comparison](../results/paper/external_author_global_comparison.tsv) for the article's main ESM2-35M and CDR3-only SCEPTR comparison; earlier 8M and annotation-aware controls answer different questions. +The [protocol documents](protocols) and grouped [Slurm templates](../research/scripts/slurm) specify the respective asset layouts and experiment arguments. Use the final consolidated [frozen comparison](../research/results/paper/external_author_global_comparison.tsv) for the article's main ESM2-35M and CDR3-only SCEPTR comparison; earlier 8M and annotation-aware controls answer different questions. ## 5. Validate before large runs diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..e98a607 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,139 @@ +# Usage and experiment details + +**Learning Compact TCR Representations from Multiple Biological Objectives** + +Elizaveta Vlasova, Petr Grigorev, Mariia Demidova, Sergey Muravyov and Mikhail Shugay + +RTP-CODEC learns a **128-dimensional representation of a human TRB CDR3 amino-acid sequence**. A shared Transformer encoder is trained jointly to reconstruct the sequence (**R**), predict TCRemP reference coordinates (**T**), and estimate generation probability (**P**). Once trained, the encoder takes only the CDR3 sequence; TCRemP computation and V/J annotations are needed for training supervision, not for sequence encoding. + +This repository contains the model, training pipeline, tokenizers, evaluation tools and result tables accompanying the manuscript *RTP-CODEC: Learning Compact TCR Representations from Multiple Biological Objectives*. + + +The three heads provide supervision during training. The reusable representation is the encoder output before those heads. + +## Installation + +Python 3.11 or newer is required. From the repository root: + +```bash +git clone https://github.com/VEK239/rtp-codec.git +cd rtp-codec +python -m venv .venv +# Linux/macOS: +source .venv/bin/activate +# Windows PowerShell: .venv/Scripts/Activate.ps1 +python -m pip install --upgrade pip +python -m pip install -e . +``` + +For a CPU-only environment, install CPU PyTorch before the package: + +```bash +python -m pip install torch==2.4.1 --index-url https://download.pytorch.org/whl/cpu +python -m pip install -e ".[dev]" +``` + +Optional dependencies are grouped by purpose: + +| Extra | Purpose | +| --- | --- | +| `pgen` | OLGA-backed target generation through the pinned mirpy revision | +| `benchmarks` | ESM, TCR-BERT and SCEPTR representation comparisons | +| `tracking` | Weights & Biases logging for earlier training workflows | +| `notebooks` | Interactive analyses and plots | +| `dev` | CPU test suite | + +For example, `python -m pip install -e ".[pgen,benchmarks,dev]"`. External encoders also require their own model weights; TCRemP requires its separate installation and prototype data. The reported manuscript environment used PyTorch 2.4.1; GPU work additionally requires a compatible CUDA installation. + +## Encode sequences + +The repository contains source code and result tables. **Trained model weights, tokenizer bundles and the full benchmark data are not bundled here.** Encoding requires a compatible `best.pt` checkpoint and, for DATA-ANCHOR or WordPiece models, its original tokenizer bundle. See [data and model assets](../docs/assets.md). + +Prepare a TSV with a `junction_aa` column; [research/examples/data/sequences.tsv](../research/examples/data/sequences.tsv) shows the format. Each sequence must contain standard amino acids and fit the checkpoint's maximum length (40 residues in the manuscript). + +```bash +rtp-codec encode \ + --checkpoint artifacts/paper/rtp-seed42/best.pt \ + --tokenizer data/tokenizers/data_anchor/anchored_tokenizer.json \ + --input research/examples/data/sequences.tsv \ + --output artifacts/example_latents.npy \ + --device cpu +``` + +The output is a float32 NumPy matrix with one vector per input row in the same order, plus a JSON sidecar describing the input and matrix. The vector dimension comes from the checkpoint. `--tokenizer` relocates a saved bundle; it does not retrain or replace the tokenizer. Use `--sequence-column cdr3` for a differently named input column. + +The same interface is available in Python: + +```python +from rtp_codec.inference import load_encoder + +encoder = load_encoder( + "artifacts/paper/rtp-seed42/best.pt", + tokenizer_path="data/tokenizers/data_anchor/anchored_tokenizer.json", + device="cpu", +) +vectors = encoder.encode_sequences(["CASSLGQETQYF", "CASSIRSSYEQYF"]) +# vectors.shape == (2, 128) for the manuscript checkpoint +``` + +## Train the manuscript model + +The paper uses a locked synthetic TRB dataset of 99,430 unique receptors, split into 79,544 training, 9,943 validation and 9,943 test rows. DATA-ANCHOR edge motifs and target normalizers are fitted on training rows only. Its middle WordPiece vocabulary is trained on a separate 500,000-sequence OLGA corpus with all benchmark sequences excluded. Reconstruction always uses an autoregressive character decoder. + +Seven matched objective presets live in [research/configs/paper](../research/configs/paper): `r`, `t`, `p`, `rt`, `rp`, `tp` and `rtp`. Supply the prepared dataset and tokenizer paths: + +```bash +rtp-codec train \ + --config research/configs/paper/rtp.json \ + --data-dir data/benchmark/trb \ + --tokenizer-path data/tokenizers/data_anchor/anchored_tokenizer.json \ + --device cuda +``` + +These presets use a 128-dimensional bottleneck, hidden width 320, eight attention heads, four encoder and four decoder layers, batch size 64 and up to 40 epochs. Early stopping is disabled; the checkpoint with the lowest joint validation loss is retained. Command-line arguments override preset values. Training writes `best.pt`, `last.pt`, target normalization statistics, run configuration and evaluation metrics to the configured output directory. + +For data preparation, tokenizer construction, the full objective factorial and downstream evaluation, follow [the reproduction guide](../docs/reproduction.md). Cluster launchers are described in [docs/cluster.md](../docs/cluster.md). A new split or regenerated tokenizer constitutes a new experiment; it should not be presented as an exact reproduction of the locked manuscript runs. + +## Results reported in the manuscript + +Native heads on the held-out synthetic benchmark: + +| Objectives | Reconstruction exact match ↑ | TCRemP cosine ↑ | Pgen RMSE ↓ | +| --- | ---: | ---: | ---: | +| R | 0.9766 | — | — | +| T | — | 0.99149 | — | +| P | — | — | 0.2753 | +| RT | 0.9632 | 0.99178 | — | +| RP | 0.9813 | — | 0.2264 | +| TP | — | 0.99169 | 0.3496 | +| RTP | 0.9636 | 0.99190 | 0.2702 | + +Source: [matched objective factorial](../research/results/paper/factorial_results.tsv). Pgen means regression of `log10_pgen_1mm`. Dashes indicate inactive objectives. These results show an objective tradeoff: adding T to RP improves teacher agreement while reducing native reconstruction and Pgen performance. + +New heads trained on frozen representations provide a separate information-recovery comparison: + +| Frozen representation | Reconstruction exact match ↑ | Pgen RMSE ↓ | +| --- | ---: | ---: | +| RTP-CODEC | 0.8831 ± 0.0058 | 0.2375 ± 0.0008 | +| TCRemP | 0.5181 ± 0.0024 | 0.6038 ± 0.0019 | +| TCR-BERT | 0.4778 ± 0.0179 | 0.4299 ± 0.0022 | +| ESM2-35M | 0.2042 ± 0.0132 | 0.7086 ± 0.0033 | +| SCEPTR, CDR3-only | 0.8213 ± 0.0043 | 0.6637 ± 0.0062 | + +Source: [consolidated frozen-representation comparison](../research/results/paper/external_author_global_comparison.tsv). Values are mean ± standard deviation across probe seeds; reconstruction uses the common 64-dimensional comparison space. These are fresh probe heads, not the codec's native heads above. + +On the independent real VDJdb cohort, RTP-CODEC achieved macro Cohen's d of 0.6866 and improved epitope separation over RP for 31 of 40 epitopes. Native TCRemP and its PCA-128 control remained stronger (0.9563 and 0.8230). The manuscript's single runtime measurements on 68,302 receptors were 29.26 s for RTP-CODEC on CPU, 9.36 s on GPU and 350.25 s for 16-thread TCRemP. Timings exclude loading and warm-up and use different pipeline boundaries; they are hardware-specific, not a general speed guarantee. + +The [paper result index](../research/results/paper/README.md) links architecture, tokenizer, downstream and error-analysis tables with their provenance. Earlier benchmark tables are retained in [research/results/legacy](../research/results/legacy). + +## Repository layout + +The repository root contains `src/`, `research/` and `docs/`, plus package metadata, citation and license files. The library and CPU tests are under `src`; configurations, results, launchers, examples, environments and historical notebooks are grouped under `research`. See [the research index](../research/README.md). + +Run `python -m pytest -q` after installing the `dev` extra. GitHub Actions also checks the public CLI and shell syntax. + +## Citation and license + +Please cite *RTP-CODEC: Learning Compact TCR Representations from Multiple Biological Objectives* by Elizaveta Vlasova, Petr Grigorev, Mariia Demidova, Sergey Muravyov and Mikhail Shugay. Accepted to BioFM @ ICDM'26. [CITATION.cff](../CITATION.cff) provides software citation metadata. + +The code is distributed under [GNU GPL v3](../LICENSE). External models and datasets retain their own licenses. diff --git a/pyproject.toml b/pyproject.toml index b3497ec..a722e78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ Issues = "https://github.com/VEK239/rtp-codec/issues" [tool.setuptools.packages.find] where = ["src"] +include = ["rtp_codec*"] [tool.pytest.ini_options] -testpaths = ["tests"] +testpaths = ["src/tests"] diff --git a/research/README.md b/research/README.md new file mode 100644 index 0000000..aaeeccc --- /dev/null +++ b/research/README.md @@ -0,0 +1,14 @@ +# Research materials + +| Directory | Contents | +| --- | --- | +| [configs/paper](configs/paper/) | Seven matched DATA-ANCHOR R/T/P objective presets | +| [results/paper](results/paper/README.md) | Manuscript result tables and provenance | +| [scripts](scripts/) | Shell and Slurm launchers grouped by task | +| [examples](examples/) | Small example inputs | +| [notebooks](notebooks/README.md) | Exploratory and historical analyses | +| [environments](environments/) | Optional dependency-installation shortcuts | + +[Reproduction guide](../docs/reproduction.md) · [Cluster execution](../docs/cluster.md) · [Usage](../docs/usage.md) + +Commands run from the repository root. Generated datasets and training outputs are external to this versioned directory; historical configs and result values remain unchanged. diff --git a/configs/paper/p.json b/research/configs/paper/p.json similarity index 100% rename from configs/paper/p.json rename to research/configs/paper/p.json diff --git a/configs/paper/r.json b/research/configs/paper/r.json similarity index 100% rename from configs/paper/r.json rename to research/configs/paper/r.json diff --git a/configs/paper/rp.json b/research/configs/paper/rp.json similarity index 100% rename from configs/paper/rp.json rename to research/configs/paper/rp.json diff --git a/configs/paper/rt.json b/research/configs/paper/rt.json similarity index 100% rename from configs/paper/rt.json rename to research/configs/paper/rt.json diff --git a/configs/paper/rtp.json b/research/configs/paper/rtp.json similarity index 100% rename from configs/paper/rtp.json rename to research/configs/paper/rtp.json diff --git a/configs/paper/t.json b/research/configs/paper/t.json similarity index 100% rename from configs/paper/t.json rename to research/configs/paper/t.json diff --git a/configs/paper/tp.json b/research/configs/paper/tp.json similarity index 100% rename from configs/paper/tp.json rename to research/configs/paper/tp.json diff --git a/configs/trb/anchored-tokenizer-study/stage_manifest.json b/research/configs/trb/anchored-tokenizer-study/stage_manifest.json similarity index 100% rename from configs/trb/anchored-tokenizer-study/stage_manifest.json rename to research/configs/trb/anchored-tokenizer-study/stage_manifest.json diff --git a/configs/trb/phase1-rq1-char-seed42/experiment_manifest.json b/research/configs/trb/phase1-rq1-char-seed42/experiment_manifest.json similarity index 100% rename from configs/trb/phase1-rq1-char-seed42/experiment_manifest.json rename to research/configs/trb/phase1-rq1-char-seed42/experiment_manifest.json diff --git a/configs/trb/phase2-rq23-char-seed42/experiment_manifest.json b/research/configs/trb/phase2-rq23-char-seed42/experiment_manifest.json similarity index 100% rename from configs/trb/phase2-rq23-char-seed42/experiment_manifest.json rename to research/configs/trb/phase2-rq23-char-seed42/experiment_manifest.json diff --git a/configs/trb/rq1-char-r-seed42/experiment_config.json b/research/configs/trb/rq1-char-r-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq1-char-r-seed42/experiment_config.json rename to research/configs/trb/rq1-char-r-seed42/experiment_config.json diff --git a/configs/trb/rq1-char-rtp-seed42/experiment_config.json b/research/configs/trb/rq1-char-rtp-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq1-char-rtp-seed42/experiment_config.json rename to research/configs/trb/rq1-char-rtp-seed42/experiment_config.json diff --git a/configs/trb/rq2-char-rp-seed42/experiment_config.json b/research/configs/trb/rq2-char-rp-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq2-char-rp-seed42/experiment_config.json rename to research/configs/trb/rq2-char-rp-seed42/experiment_config.json diff --git a/configs/trb/rq2-char-rt-seed42/experiment_config.json b/research/configs/trb/rq2-char-rt-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq2-char-rt-seed42/experiment_config.json rename to research/configs/trb/rq2-char-rt-seed42/experiment_config.json diff --git a/configs/trb/rq4-wordpiece-r-seed42/experiment_config.json b/research/configs/trb/rq4-wordpiece-r-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq4-wordpiece-r-seed42/experiment_config.json rename to research/configs/trb/rq4-wordpiece-r-seed42/experiment_config.json diff --git a/configs/trb/rq4-wordpiece-rtp-seed42/experiment_config.json b/research/configs/trb/rq4-wordpiece-rtp-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq4-wordpiece-rtp-seed42/experiment_config.json rename to research/configs/trb/rq4-wordpiece-rtp-seed42/experiment_config.json diff --git a/configs/trb/rq4-wordpiece-seed42/experiment_manifest.json b/research/configs/trb/rq4-wordpiece-seed42/experiment_manifest.json similarity index 100% rename from configs/trb/rq4-wordpiece-seed42/experiment_manifest.json rename to research/configs/trb/rq4-wordpiece-seed42/experiment_manifest.json diff --git a/configs/trb/rq5-char-rtp-d128-depths-seed42/experiment_manifest.json b/research/configs/trb/rq5-char-rtp-d128-depths-seed42/experiment_manifest.json similarity index 100% rename from configs/trb/rq5-char-rtp-d128-depths-seed42/experiment_manifest.json rename to research/configs/trb/rq5-char-rtp-d128-depths-seed42/experiment_manifest.json diff --git a/configs/trb/rq5-char-rtp-d128-e2d4-seed42/experiment_config.json b/research/configs/trb/rq5-char-rtp-d128-e2d4-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq5-char-rtp-d128-e2d4-seed42/experiment_config.json rename to research/configs/trb/rq5-char-rtp-d128-e2d4-seed42/experiment_config.json diff --git a/configs/trb/rq5-char-rtp-d128-e6d4-seed42/experiment_config.json b/research/configs/trb/rq5-char-rtp-d128-e6d4-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq5-char-rtp-d128-e6d4-seed42/experiment_config.json rename to research/configs/trb/rq5-char-rtp-d128-e6d4-seed42/experiment_config.json diff --git a/configs/trb/rq5-char-rtp-d128-seed42/experiment_config.json b/research/configs/trb/rq5-char-rtp-d128-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq5-char-rtp-d128-seed42/experiment_config.json rename to research/configs/trb/rq5-char-rtp-d128-seed42/experiment_config.json diff --git a/configs/trb/rq5-char-rtp-d512-seed42/experiment_config.json b/research/configs/trb/rq5-char-rtp-d512-seed42/experiment_config.json similarity index 100% rename from configs/trb/rq5-char-rtp-d512-seed42/experiment_config.json rename to research/configs/trb/rq5-char-rtp-d512-seed42/experiment_config.json diff --git a/configs/trb/rq5-char-rtp-widths-seed42/experiment_manifest.json b/research/configs/trb/rq5-char-rtp-widths-seed42/experiment_manifest.json similarity index 100% rename from configs/trb/rq5-char-rtp-widths-seed42/experiment_manifest.json rename to research/configs/trb/rq5-char-rtp-widths-seed42/experiment_manifest.json diff --git a/configs/trb/wordpiece-sweep-seed42/experiment_manifest.json b/research/configs/trb/wordpiece-sweep-seed42/experiment_manifest.json similarity index 100% rename from configs/trb/wordpiece-sweep-seed42/experiment_manifest.json rename to research/configs/trb/wordpiece-sweep-seed42/experiment_manifest.json diff --git a/configs/trb/wordpiece-sweep-seed42/validation_results.md b/research/configs/trb/wordpiece-sweep-seed42/validation_results.md similarity index 100% rename from configs/trb/wordpiece-sweep-seed42/validation_results.md rename to research/configs/trb/wordpiece-sweep-seed42/validation_results.md diff --git a/requirements/benchmarks.txt b/research/environments/benchmarks.txt similarity index 100% rename from requirements/benchmarks.txt rename to research/environments/benchmarks.txt diff --git a/requirements/dev.txt b/research/environments/dev.txt similarity index 100% rename from requirements/dev.txt rename to research/environments/dev.txt diff --git a/requirements/full.txt b/research/environments/full.txt similarity index 100% rename from requirements/full.txt rename to research/environments/full.txt diff --git a/requirements/runtime.txt b/research/environments/runtime.txt similarity index 100% rename from requirements/runtime.txt rename to research/environments/runtime.txt diff --git a/examples/data/sequences.tsv b/research/examples/data/sequences.tsv similarity index 100% rename from examples/data/sequences.tsv rename to research/examples/data/sequences.tsv diff --git a/examples/data/viral_antigen_species_2025_07_30.txt b/research/examples/data/viral_antigen_species_2025_07_30.txt similarity index 100% rename from examples/data/viral_antigen_species_2025_07_30.txt rename to research/examples/data/viral_antigen_species_2025_07_30.txt diff --git a/notebooks/README.md b/research/notebooks/README.md similarity index 100% rename from notebooks/README.md rename to research/notebooks/README.md diff --git a/notebooks/analysis/architecture_comparison_report.ipynb b/research/notebooks/analysis/architecture_comparison_report.ipynb similarity index 100% rename from notebooks/analysis/architecture_comparison_report.ipynb rename to research/notebooks/analysis/architecture_comparison_report.ipynb diff --git a/notebooks/analysis/compare_forward_tokenizers_report.ipynb b/research/notebooks/analysis/compare_forward_tokenizers_report.ipynb similarity index 100% rename from notebooks/analysis/compare_forward_tokenizers_report.ipynb rename to research/notebooks/analysis/compare_forward_tokenizers_report.ipynb diff --git a/notebooks/analysis/convergence_curves_by_epoch_report.ipynb b/research/notebooks/analysis/convergence_curves_by_epoch_report.ipynb similarity index 100% rename from notebooks/analysis/convergence_curves_by_epoch_report.ipynb rename to research/notebooks/analysis/convergence_curves_by_epoch_report.ipynb diff --git a/notebooks/analysis/tokenizer_stats_report.ipynb b/research/notebooks/analysis/tokenizer_stats_report.ipynb similarity index 100% rename from notebooks/analysis/tokenizer_stats_report.ipynb rename to research/notebooks/analysis/tokenizer_stats_report.ipynb diff --git a/notebooks/legacy/example_inverse_run_and_analysis.ipynb b/research/notebooks/legacy/example_inverse_run_and_analysis.ipynb similarity index 100% rename from notebooks/legacy/example_inverse_run_and_analysis.ipynb rename to research/notebooks/legacy/example_inverse_run_and_analysis.ipynb diff --git a/notebooks/legacy/example_run_and_analysis-Copy1.ipynb b/research/notebooks/legacy/example_run_and_analysis-Copy1.ipynb similarity index 100% rename from notebooks/legacy/example_run_and_analysis-Copy1.ipynb rename to research/notebooks/legacy/example_run_and_analysis-Copy1.ipynb diff --git a/notebooks/legacy/example_run_and_analysis.ipynb b/research/notebooks/legacy/example_run_and_analysis.ipynb similarity index 100% rename from notebooks/legacy/example_run_and_analysis.ipynb rename to research/notebooks/legacy/example_run_and_analysis.ipynb diff --git a/notebooks/legacy/forward_background_100k_multichain_analysis.ipynb b/research/notebooks/legacy/forward_background_100k_multichain_analysis.ipynb similarity index 100% rename from notebooks/legacy/forward_background_100k_multichain_analysis.ipynb rename to research/notebooks/legacy/forward_background_100k_multichain_analysis.ipynb diff --git a/notebooks/legacy/generate_datasets.ipynb b/research/notebooks/legacy/generate_datasets.ipynb similarity index 100% rename from notebooks/legacy/generate_datasets.ipynb rename to research/notebooks/legacy/generate_datasets.ipynb diff --git a/notebooks/legacy/inverse_background_100k_multichain_analysis.ipynb b/research/notebooks/legacy/inverse_background_100k_multichain_analysis.ipynb similarity index 100% rename from notebooks/legacy/inverse_background_100k_multichain_analysis.ipynb rename to research/notebooks/legacy/inverse_background_100k_multichain_analysis.ipynb diff --git a/notebooks/legacy/pgen_run_and_analysis.ipynb b/research/notebooks/legacy/pgen_run_and_analysis.ipynb similarity index 100% rename from notebooks/legacy/pgen_run_and_analysis.ipynb rename to research/notebooks/legacy/pgen_run_and_analysis.ipynb diff --git a/notebooks/legacy/trb_1kk.ipynb b/research/notebooks/legacy/trb_1kk.ipynb similarity index 100% rename from notebooks/legacy/trb_1kk.ipynb rename to research/notebooks/legacy/trb_1kk.ipynb diff --git a/results/legacy/dataset_summary.json b/research/results/legacy/dataset_summary.json similarity index 100% rename from results/legacy/dataset_summary.json rename to research/results/legacy/dataset_summary.json diff --git a/results/legacy/pgen/pgen_runs.csv b/research/results/legacy/pgen/pgen_runs.csv similarity index 100% rename from results/legacy/pgen/pgen_runs.csv rename to research/results/legacy/pgen/pgen_runs.csv diff --git a/results/legacy/pgen/pgen_summary.csv b/research/results/legacy/pgen/pgen_summary.csv similarity index 100% rename from results/legacy/pgen/pgen_summary.csv rename to research/results/legacy/pgen/pgen_summary.csv diff --git a/results/legacy/pgen/pgen_summary.md b/research/results/legacy/pgen/pgen_summary.md similarity index 100% rename from results/legacy/pgen/pgen_summary.md rename to research/results/legacy/pgen/pgen_summary.md diff --git a/results/legacy/pgen/pretraining_delta.csv b/research/results/legacy/pgen/pretraining_delta.csv similarity index 100% rename from results/legacy/pgen/pretraining_delta.csv rename to research/results/legacy/pgen/pretraining_delta.csv diff --git a/results/legacy/pgen/speed_end_to_end_cpu.csv b/research/results/legacy/pgen/speed_end_to_end_cpu.csv similarity index 100% rename from results/legacy/pgen/speed_end_to_end_cpu.csv rename to research/results/legacy/pgen/speed_end_to_end_cpu.csv diff --git a/results/legacy/pgen/speed_end_to_end_cuda.csv b/research/results/legacy/pgen/speed_end_to_end_cuda.csv similarity index 100% rename from results/legacy/pgen/speed_end_to_end_cuda.csv rename to research/results/legacy/pgen/speed_end_to_end_cuda.csv diff --git a/results/legacy/pgen_constlr/pgen_runs.csv b/research/results/legacy/pgen_constlr/pgen_runs.csv similarity index 100% rename from results/legacy/pgen_constlr/pgen_runs.csv rename to research/results/legacy/pgen_constlr/pgen_runs.csv diff --git a/results/legacy/pgen_constlr/pgen_summary.csv b/research/results/legacy/pgen_constlr/pgen_summary.csv similarity index 100% rename from results/legacy/pgen_constlr/pgen_summary.csv rename to research/results/legacy/pgen_constlr/pgen_summary.csv diff --git a/results/legacy/pgen_constlr/pgen_summary.md b/research/results/legacy/pgen_constlr/pgen_summary.md similarity index 100% rename from results/legacy/pgen_constlr/pgen_summary.md rename to research/results/legacy/pgen_constlr/pgen_summary.md diff --git a/results/legacy/pgen_constlr/pretraining_delta.csv b/research/results/legacy/pgen_constlr/pretraining_delta.csv similarity index 100% rename from results/legacy/pgen_constlr/pretraining_delta.csv rename to research/results/legacy/pgen_constlr/pretraining_delta.csv diff --git a/results/legacy/reconstruction/reconstruction_runs.csv b/research/results/legacy/reconstruction/reconstruction_runs.csv similarity index 100% rename from results/legacy/reconstruction/reconstruction_runs.csv rename to research/results/legacy/reconstruction/reconstruction_runs.csv diff --git a/results/legacy/reconstruction/reconstruction_summary.csv b/research/results/legacy/reconstruction/reconstruction_summary.csv similarity index 100% rename from results/legacy/reconstruction/reconstruction_summary.csv rename to research/results/legacy/reconstruction/reconstruction_summary.csv diff --git a/results/legacy/reconstruction/reconstruction_summary.md b/research/results/legacy/reconstruction/reconstruction_summary.md similarity index 100% rename from results/legacy/reconstruction/reconstruction_summary.md rename to research/results/legacy/reconstruction/reconstruction_summary.md diff --git a/results/paper/README.md b/research/results/paper/README.md similarity index 100% rename from results/paper/README.md rename to research/results/paper/README.md diff --git a/results/paper/architecture_results.tsv b/research/results/paper/architecture_results.tsv similarity index 100% rename from results/paper/architecture_results.tsv rename to research/results/paper/architecture_results.tsv diff --git a/results/paper/downstream_distribution_summary.tsv b/research/results/paper/downstream_distribution_summary.tsv similarity index 100% rename from results/paper/downstream_distribution_summary.tsv rename to research/results/paper/downstream_distribution_summary.tsv diff --git a/results/paper/downstream_per_epitope_controls.tsv b/research/results/paper/downstream_per_epitope_controls.tsv similarity index 100% rename from results/paper/downstream_per_epitope_controls.tsv rename to research/results/paper/downstream_per_epitope_controls.tsv diff --git a/results/paper/downstream_per_epitope_metrics.tsv b/research/results/paper/downstream_per_epitope_metrics.tsv similarity index 100% rename from results/paper/downstream_per_epitope_metrics.tsv rename to research/results/paper/downstream_per_epitope_metrics.tsv diff --git a/results/paper/downstream_rtp_minus_rp_effects.tsv b/research/results/paper/downstream_rtp_minus_rp_effects.tsv similarity index 100% rename from results/paper/downstream_rtp_minus_rp_effects.tsv rename to research/results/paper/downstream_rtp_minus_rp_effects.tsv diff --git a/results/paper/external_author_global_comparison.md b/research/results/paper/external_author_global_comparison.md similarity index 100% rename from results/paper/external_author_global_comparison.md rename to research/results/paper/external_author_global_comparison.md diff --git a/results/paper/external_author_global_comparison.tsv b/research/results/paper/external_author_global_comparison.tsv similarity index 100% rename from results/paper/external_author_global_comparison.tsv rename to research/results/paper/external_author_global_comparison.tsv diff --git a/results/paper/external_author_global_comparison_manifest.json b/research/results/paper/external_author_global_comparison_manifest.json similarity index 100% rename from results/paper/external_author_global_comparison_manifest.json rename to research/results/paper/external_author_global_comparison_manifest.json diff --git a/results/paper/external_pgen_results.tsv b/research/results/paper/external_pgen_results.tsv similarity index 100% rename from results/paper/external_pgen_results.tsv rename to research/results/paper/external_pgen_results.tsv diff --git a/results/paper/external_pgen_runs.tsv b/research/results/paper/external_pgen_runs.tsv similarity index 100% rename from results/paper/external_pgen_runs.tsv rename to research/results/paper/external_pgen_runs.tsv diff --git a/results/paper/external_reconstruction_results.tsv b/research/results/paper/external_reconstruction_results.tsv similarity index 100% rename from results/paper/external_reconstruction_results.tsv rename to research/results/paper/external_reconstruction_results.tsv diff --git a/results/paper/external_reconstruction_runs.tsv b/research/results/paper/external_reconstruction_runs.tsv similarity index 100% rename from results/paper/external_reconstruction_runs.tsv rename to research/results/paper/external_reconstruction_runs.tsv diff --git a/results/paper/factorial_results.tsv b/research/results/paper/factorial_results.tsv similarity index 100% rename from results/paper/factorial_results.tsv rename to research/results/paper/factorial_results.tsv diff --git a/results/paper/latent_sufficiency_summary.tsv b/research/results/paper/latent_sufficiency_summary.tsv similarity index 100% rename from results/paper/latent_sufficiency_summary.tsv rename to research/results/paper/latent_sufficiency_summary.tsv diff --git a/results/paper/low_label_sequence_summary.tsv b/research/results/paper/low_label_sequence_summary.tsv similarity index 100% rename from results/paper/low_label_sequence_summary.tsv rename to research/results/paper/low_label_sequence_summary.tsv diff --git a/results/paper/provenance_and_hashes.tsv b/research/results/paper/provenance_and_hashes.tsv similarity index 100% rename from results/paper/provenance_and_hashes.tsv rename to research/results/paper/provenance_and_hashes.tsv diff --git a/results/paper/rtp_data_anchor_error_analysis_by_length.tsv b/research/results/paper/rtp_data_anchor_error_analysis_by_length.tsv similarity index 100% rename from results/paper/rtp_data_anchor_error_analysis_by_length.tsv rename to research/results/paper/rtp_data_anchor_error_analysis_by_length.tsv diff --git a/results/paper/rtp_data_anchor_error_rates_by_target_length.tsv b/research/results/paper/rtp_data_anchor_error_rates_by_target_length.tsv similarity index 100% rename from results/paper/rtp_data_anchor_error_rates_by_target_length.tsv rename to research/results/paper/rtp_data_anchor_error_rates_by_target_length.tsv diff --git a/results/paper/rtp_data_anchor_region_error_rates.tsv b/research/results/paper/rtp_data_anchor_region_error_rates.tsv similarity index 100% rename from results/paper/rtp_data_anchor_region_error_rates.tsv rename to research/results/paper/rtp_data_anchor_region_error_rates.tsv diff --git a/results/paper/rtp_data_anchor_substitution_matrix.tsv b/research/results/paper/rtp_data_anchor_substitution_matrix.tsv similarity index 100% rename from results/paper/rtp_data_anchor_substitution_matrix.tsv rename to research/results/paper/rtp_data_anchor_substitution_matrix.tsv diff --git a/results/paper/rtp_data_anchor_substitution_results.json b/research/results/paper/rtp_data_anchor_substitution_results.json similarity index 100% rename from results/paper/rtp_data_anchor_substitution_results.json rename to research/results/paper/rtp_data_anchor_substitution_results.json diff --git a/results/paper/tokenizer_results.tsv b/research/results/paper/tokenizer_results.tsv similarity index 100% rename from results/paper/tokenizer_results.tsv rename to research/results/paper/tokenizer_results.tsv diff --git a/scripts/legacy/run1_default_40epochs.sh b/research/scripts/legacy/run1_default_40epochs.sh similarity index 100% rename from scripts/legacy/run1_default_40epochs.sh rename to research/scripts/legacy/run1_default_40epochs.sh diff --git a/scripts/legacy/run2_maxtokenlen9_40epochs.sh b/research/scripts/legacy/run2_maxtokenlen9_40epochs.sh similarity index 100% rename from scripts/legacy/run2_maxtokenlen9_40epochs.sh rename to research/scripts/legacy/run2_maxtokenlen9_40epochs.sh diff --git a/research/scripts/legacy/run3_all_sequential.sh b/research/scripts/legacy/run3_all_sequential.sh new file mode 100644 index 0000000..45f92bb --- /dev/null +++ b/research/scripts/legacy/run3_all_sequential.sh @@ -0,0 +1,4 @@ +#!/bin/bash +bash research/scripts/legacy/run3a_individual_maxlen.sh +bash research/scripts/legacy/run3b_individual_maxlen_maxtokenlen9.sh +bash research/scripts/legacy/run3c_fixed_maxlen10.sh diff --git a/scripts/legacy/run3a_individual_maxlen.sh b/research/scripts/legacy/run3a_individual_maxlen.sh similarity index 100% rename from scripts/legacy/run3a_individual_maxlen.sh rename to research/scripts/legacy/run3a_individual_maxlen.sh diff --git a/scripts/legacy/run3b_individual_maxlen_maxtokenlen9.sh b/research/scripts/legacy/run3b_individual_maxlen_maxtokenlen9.sh similarity index 100% rename from scripts/legacy/run3b_individual_maxlen_maxtokenlen9.sh rename to research/scripts/legacy/run3b_individual_maxlen_maxtokenlen9.sh diff --git a/scripts/legacy/run3c_fixed_maxlen10.sh b/research/scripts/legacy/run3c_fixed_maxlen10.sh similarity index 100% rename from scripts/legacy/run3c_fixed_maxlen10.sh rename to research/scripts/legacy/run3c_fixed_maxlen10.sh diff --git a/research/scripts/legacy/run4_all_sequential.sh b/research/scripts/legacy/run4_all_sequential.sh new file mode 100644 index 0000000..607207a --- /dev/null +++ b/research/scripts/legacy/run4_all_sequential.sh @@ -0,0 +1,4 @@ +#!/bin/bash +export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}" +bash research/scripts/legacy/run4a_individual_maxlen_maxtokenlen9_anchored.sh +bash research/scripts/legacy/run4b_individual_maxlen_maxtokenlen9_anchored_dropout.sh diff --git a/scripts/legacy/run4a_individual_maxlen_maxtokenlen9_anchored.sh b/research/scripts/legacy/run4a_individual_maxlen_maxtokenlen9_anchored.sh similarity index 100% rename from scripts/legacy/run4a_individual_maxlen_maxtokenlen9_anchored.sh rename to research/scripts/legacy/run4a_individual_maxlen_maxtokenlen9_anchored.sh diff --git a/scripts/legacy/run4b_individual_maxlen_maxtokenlen9_anchored_dropout.sh b/research/scripts/legacy/run4b_individual_maxlen_maxtokenlen9_anchored_dropout.sh similarity index 100% rename from scripts/legacy/run4b_individual_maxlen_maxtokenlen9_anchored_dropout.sh rename to research/scripts/legacy/run4b_individual_maxlen_maxtokenlen9_anchored_dropout.sh diff --git a/research/scripts/legacy/run5_all_sequential.sh b/research/scripts/legacy/run5_all_sequential.sh new file mode 100644 index 0000000..4ffc3b3 --- /dev/null +++ b/research/scripts/legacy/run5_all_sequential.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}" +bash research/scripts/legacy/run5a_hidden128.sh +bash research/scripts/legacy/run5b_blocks3.sh +bash research/scripts/legacy/run5c_hidden128_blocks3.sh +bash research/scripts/legacy/run5d_hidden96_blocks3.sh diff --git a/scripts/legacy/run5a_hidden128.sh b/research/scripts/legacy/run5a_hidden128.sh similarity index 100% rename from scripts/legacy/run5a_hidden128.sh rename to research/scripts/legacy/run5a_hidden128.sh diff --git a/scripts/legacy/run5b_blocks3.sh b/research/scripts/legacy/run5b_blocks3.sh similarity index 100% rename from scripts/legacy/run5b_blocks3.sh rename to research/scripts/legacy/run5b_blocks3.sh diff --git a/scripts/legacy/run5c_hidden128_blocks3.sh b/research/scripts/legacy/run5c_hidden128_blocks3.sh similarity index 100% rename from scripts/legacy/run5c_hidden128_blocks3.sh rename to research/scripts/legacy/run5c_hidden128_blocks3.sh diff --git a/scripts/legacy/run5d_hidden96_blocks3.sh b/research/scripts/legacy/run5d_hidden96_blocks3.sh similarity index 100% rename from scripts/legacy/run5d_hidden96_blocks3.sh rename to research/scripts/legacy/run5d_hidden96_blocks3.sh diff --git a/scripts/legacy/run_both_sequential.sh b/research/scripts/legacy/run_both_sequential.sh similarity index 100% rename from scripts/legacy/run_both_sequential.sh rename to research/scripts/legacy/run_both_sequential.sh diff --git a/scripts/legacy/run_compare_100k.sh b/research/scripts/legacy/run_compare_100k.sh similarity index 100% rename from scripts/legacy/run_compare_100k.sh rename to research/scripts/legacy/run_compare_100k.sh diff --git a/scripts/legacy/run_compare_40epochs_upto30k.sh b/research/scripts/legacy/run_compare_40epochs_upto30k.sh similarity index 100% rename from scripts/legacy/run_compare_40epochs_upto30k.sh rename to research/scripts/legacy/run_compare_40epochs_upto30k.sh diff --git a/scripts/legacy/run_compare_finegrid_maxlen9_40epochs.sh b/research/scripts/legacy/run_compare_finegrid_maxlen9_40epochs.sh similarity index 100% rename from scripts/legacy/run_compare_finegrid_maxlen9_40epochs.sh rename to research/scripts/legacy/run_compare_finegrid_maxlen9_40epochs.sh diff --git a/scripts/legacy/run_compare_finegrid_maxlen9_50epochs.sh b/research/scripts/legacy/run_compare_finegrid_maxlen9_50epochs.sh similarity index 100% rename from scripts/legacy/run_compare_finegrid_maxlen9_50epochs.sh rename to research/scripts/legacy/run_compare_finegrid_maxlen9_50epochs.sh diff --git a/scripts/legacy/train_forward.sh b/research/scripts/legacy/train_forward.sh similarity index 100% rename from scripts/legacy/train_forward.sh rename to research/scripts/legacy/train_forward.sh diff --git a/scripts/legacy/train_inverse.sh b/research/scripts/legacy/train_inverse.sh similarity index 100% rename from scripts/legacy/train_inverse.sh rename to research/scripts/legacy/train_inverse.sh diff --git a/scripts/slurm/data/cache_author_global_embeddings.sbatch b/research/scripts/slurm/data/cache_author_global_embeddings.sbatch similarity index 100% rename from scripts/slurm/data/cache_author_global_embeddings.sbatch rename to research/scripts/slurm/data/cache_author_global_embeddings.sbatch diff --git a/scripts/slurm/data/cache_author_global_sceptr_cdr3.sbatch b/research/scripts/slurm/data/cache_author_global_sceptr_cdr3.sbatch similarity index 100% rename from scripts/slurm/data/cache_author_global_sceptr_cdr3.sbatch rename to research/scripts/slurm/data/cache_author_global_sceptr_cdr3.sbatch diff --git a/scripts/slurm/data/cache_external_model_embeddings.sbatch b/research/scripts/slurm/data/cache_external_model_embeddings.sbatch similarity index 100% rename from scripts/slurm/data/cache_external_model_embeddings.sbatch rename to research/scripts/slurm/data/cache_external_model_embeddings.sbatch diff --git a/scripts/slurm/data/cache_external_residue_embeddings.sbatch b/research/scripts/slurm/data/cache_external_residue_embeddings.sbatch similarity index 100% rename from scripts/slurm/data/cache_external_residue_embeddings.sbatch rename to research/scripts/slurm/data/cache_external_residue_embeddings.sbatch diff --git a/scripts/slurm/data/calc_pgen_1mm.sbatch b/research/scripts/slurm/data/calc_pgen_1mm.sbatch similarity index 98% rename from scripts/slurm/data/calc_pgen_1mm.sbatch rename to research/scripts/slurm/data/calc_pgen_1mm.sbatch index a09a230..e834a0b 100644 --- a/scripts/slurm/data/calc_pgen_1mm.sbatch +++ b/research/scripts/slurm/data/calc_pgen_1mm.sbatch @@ -9,7 +9,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" mkdir -p slurm/logs diff --git a/scripts/slurm/data/calc_pgen_1mm_background_100k_array.sbatch b/research/scripts/slurm/data/calc_pgen_1mm_background_100k_array.sbatch similarity index 98% rename from scripts/slurm/data/calc_pgen_1mm_background_100k_array.sbatch rename to research/scripts/slurm/data/calc_pgen_1mm_background_100k_array.sbatch index 86c4cda..778520c 100644 --- a/scripts/slurm/data/calc_pgen_1mm_background_100k_array.sbatch +++ b/research/scripts/slurm/data/calc_pgen_1mm_background_100k_array.sbatch @@ -12,7 +12,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" CHAINS=(TRB) diff --git a/scripts/slurm/data/calc_pgen_1mm_trb_background_100k.sbatch b/research/scripts/slurm/data/calc_pgen_1mm_trb_background_100k.sbatch similarity index 97% rename from scripts/slurm/data/calc_pgen_1mm_trb_background_100k.sbatch rename to research/scripts/slurm/data/calc_pgen_1mm_trb_background_100k.sbatch index f707c66..ddbf03d 100644 --- a/scripts/slurm/data/calc_pgen_1mm_trb_background_100k.sbatch +++ b/research/scripts/slurm/data/calc_pgen_1mm_trb_background_100k.sbatch @@ -9,7 +9,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" AIRR_PATH="/projects/immunestatus/vdjrearm/airr_format/trb_background_100k.tsv" diff --git a/scripts/slurm/data/fit_author_global_bottleneck.sbatch b/research/scripts/slurm/data/fit_author_global_bottleneck.sbatch similarity index 100% rename from scripts/slurm/data/fit_author_global_bottleneck.sbatch rename to research/scripts/slurm/data/fit_author_global_bottleneck.sbatch diff --git a/scripts/slurm/data/fit_external_model_bottleneck.sbatch b/research/scripts/slurm/data/fit_external_model_bottleneck.sbatch similarity index 100% rename from scripts/slurm/data/fit_external_model_bottleneck.sbatch rename to research/scripts/slurm/data/fit_external_model_bottleneck.sbatch diff --git a/scripts/slurm/data/fit_external_residue_pca128_all.sbatch b/research/scripts/slurm/data/fit_external_residue_pca128_all.sbatch similarity index 100% rename from scripts/slurm/data/fit_external_residue_pca128_all.sbatch rename to research/scripts/slurm/data/fit_external_residue_pca128_all.sbatch diff --git a/scripts/slurm/data/fit_external_residue_pca256.sbatch b/research/scripts/slurm/data/fit_external_residue_pca256.sbatch similarity index 100% rename from scripts/slurm/data/fit_external_residue_pca256.sbatch rename to research/scripts/slurm/data/fit_external_residue_pca256.sbatch diff --git a/scripts/slurm/data/fit_external_sceptr_pca128.sbatch b/research/scripts/slurm/data/fit_external_sceptr_pca128.sbatch similarity index 100% rename from scripts/slurm/data/fit_external_sceptr_pca128.sbatch rename to research/scripts/slurm/data/fit_external_sceptr_pca128.sbatch diff --git a/scripts/slurm/data/install_external_benchmark_runtime.sbatch b/research/scripts/slurm/data/install_external_benchmark_runtime.sbatch similarity index 96% rename from scripts/slurm/data/install_external_benchmark_runtime.sbatch rename to research/scripts/slurm/data/install_external_benchmark_runtime.sbatch index 2fb3089..e4b7e89 100644 --- a/scripts/slurm/data/install_external_benchmark_runtime.sbatch +++ b/research/scripts/slurm/data/install_external_benchmark_runtime.sbatch @@ -104,6 +104,6 @@ print(json.dumps(report, indent=2, sort_keys=True)) PY cd "$REPO" -sha256sum scripts/slurm/data/install_external_benchmark_runtime.sbatch "$REPORT" > "$ROOT/HASHES.sha256" +sha256sum research/scripts/slurm/data/install_external_benchmark_runtime.sbatch "$REPORT" > "$ROOT/HASHES.sha256" echo "status=accepted" echo "runtime=$ROOT" diff --git a/scripts/slurm/data/install_wordpiece_dependency.sbatch b/research/scripts/slurm/data/install_wordpiece_dependency.sbatch similarity index 100% rename from scripts/slurm/data/install_wordpiece_dependency.sbatch rename to research/scripts/slurm/data/install_wordpiece_dependency.sbatch diff --git a/scripts/slurm/data/prepare_anchored_tokenizers.sbatch b/research/scripts/slurm/data/prepare_anchored_tokenizers.sbatch similarity index 95% rename from scripts/slurm/data/prepare_anchored_tokenizers.sbatch rename to research/scripts/slurm/data/prepare_anchored_tokenizers.sbatch index 3d99fca..8533004 100644 --- a/scripts/slurm/data/prepare_anchored_tokenizers.sbatch +++ b/research/scripts/slurm/data/prepare_anchored_tokenizers.sbatch @@ -24,7 +24,7 @@ cd "$ROOT_DIR" --data-dir "$DATA_DIR" \ --output-root "$TOKENIZER_ROOT" \ --external-corpus "$SOURCE_ROOT/sample/TRB_1e7.tsv.gz" \ - --generation-script "$SOURCE_ROOT/scripts/sample_murugan.sh" \ + --generation-script "$SOURCE_ROOT/research/scripts/sample_murugan.sh" \ --olga-model-dir "$SOURCE_ROOT/model/Homo+sapiens/TRB_orig" \ --external-rows 500000 --seed 42 "$PYTHON_BIN" -m rtp_codec.experiments.preflight.preflight_anchored_tokenizers \ diff --git a/scripts/slurm/data/prepare_external_model_cohort.sbatch b/research/scripts/slurm/data/prepare_external_model_cohort.sbatch similarity index 95% rename from scripts/slurm/data/prepare_external_model_cohort.sbatch rename to research/scripts/slurm/data/prepare_external_model_cohort.sbatch index 6b0b655..da44c0d 100644 --- a/scripts/slurm/data/prepare_external_model_cohort.sbatch +++ b/research/scripts/slurm/data/prepare_external_model_cohort.sbatch @@ -34,7 +34,7 @@ cd "$REPO" --device cpu \ --threads "${SLURM_CPUS_PER_TASK:-16}" -"$PYTHON" -m pytest tests/test_external_model_benchmark.py -q +"$PYTHON" -m pytest src/tests/test_external_model_benchmark.py -q sha256sum \ src/rtp_codec/benchmarks/datasets/prepare_external_model_cohort.py \ src/rtp_codec/benchmarks/representations/cache_external_model_embeddings.py \ diff --git a/scripts/slurm/data/prepare_multitask_benchmark.sbatch b/research/scripts/slurm/data/prepare_multitask_benchmark.sbatch similarity index 97% rename from scripts/slurm/data/prepare_multitask_benchmark.sbatch rename to research/scripts/slurm/data/prepare_multitask_benchmark.sbatch index 6e97585..79c7116 100644 --- a/scripts/slurm/data/prepare_multitask_benchmark.sbatch +++ b/research/scripts/slurm/data/prepare_multitask_benchmark.sbatch @@ -9,7 +9,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" : "${AIRR_PATH:?Set AIRR_PATH to the source TRB AIRR table}" : "${EMBEDDINGS_PATH:?Set EMBEDDINGS_PATH to the aligned TCRemP Parquet file}" diff --git a/scripts/slurm/data/prepare_single_aa_challenge.sbatch b/research/scripts/slurm/data/prepare_single_aa_challenge.sbatch similarity index 100% rename from scripts/slurm/data/prepare_single_aa_challenge.sbatch rename to research/scripts/slurm/data/prepare_single_aa_challenge.sbatch diff --git a/scripts/slurm/data/prepare_trb_joint.sbatch b/research/scripts/slurm/data/prepare_trb_joint.sbatch similarity index 100% rename from scripts/slurm/data/prepare_trb_joint.sbatch rename to research/scripts/slurm/data/prepare_trb_joint.sbatch diff --git a/scripts/slurm/data/prepare_vdjdb_redcea_clonotypes.sbatch b/research/scripts/slurm/data/prepare_vdjdb_redcea_clonotypes.sbatch similarity index 77% rename from scripts/slurm/data/prepare_vdjdb_redcea_clonotypes.sbatch rename to research/scripts/slurm/data/prepare_vdjdb_redcea_clonotypes.sbatch index 37ed973..0e3b6a5 100644 --- a/scripts/slurm/data/prepare_vdjdb_redcea_clonotypes.sbatch +++ b/research/scripts/slurm/data/prepare_vdjdb_redcea_clonotypes.sbatch @@ -16,7 +16,7 @@ SOURCE="$OUTPUT/cluster_members_TRB.txt" PYTHON="${RTP_CODEC_PYTHON:-python}" COMMIT="77961e2bec255311176d5168b4b8534fdbee24e4" BLOB="904320e903c646dc266639eb570461893d29aa2d" -URL="https://raw.githubusercontent.com/antigenomics/vdjdb-motifs/${COMMIT}/results/redcea/cluster_members_TRB.txt" +URL="https://raw.githubusercontent.com/antigenomics/vdjdb-motifs/${COMMIT}/research/results/redcea/cluster_members_TRB.txt" test -x "$PYTHON" test -f "$ROOT/data/benchmark/trb/READY.json" @@ -26,8 +26,8 @@ cd "$ROOT" "$PYTHON" -m compileall -q \ src/rtp_codec/benchmarks/datasets/prepare_vdjdb_redcea_clonotypes.py \ src/rtp_codec/benchmarks/downstream/evaluate_vdjdb_redcea_clonotypes.py -"$PYTHON" -c "import runpy; m=runpy.run_path('tests/test_vdjdb_redcea_clonotypes.py'); m['test_preparation_deduplicates_removes_ambiguity_overlap_and_applies_support']()" -"$PYTHON" -c "import runpy; m=runpy.run_path('tests/test_vdjdb_redcea_evaluation.py'); m['test_perfect_epitope_geometry_scores_perfect_retrieval']()" +"$PYTHON" -c "import runpy; m=runpy.run_path('src/tests/test_vdjdb_redcea_clonotypes.py'); m['test_preparation_deduplicates_removes_ambiguity_overlap_and_applies_support']()" +"$PYTHON" -c "import runpy; m=runpy.run_path('src/tests/test_vdjdb_redcea_evaluation.py'); m['test_perfect_epitope_geometry_scores_perfect_retrieval']()" curl --fail --location --retry 3 --output "$SOURCE" "$URL" ACTUAL_BLOB="$(git hash-object "$SOURCE")" test "$ACTUAL_BLOB" = "$BLOB" diff --git a/scripts/slurm/data/prepare_vdjdb_viral_motif_top10.sbatch b/research/scripts/slurm/data/prepare_vdjdb_viral_motif_top10.sbatch similarity index 94% rename from scripts/slurm/data/prepare_vdjdb_viral_motif_top10.sbatch rename to research/scripts/slurm/data/prepare_vdjdb_viral_motif_top10.sbatch index 994e5b5..0118139 100644 --- a/scripts/slurm/data/prepare_vdjdb_viral_motif_top10.sbatch +++ b/research/scripts/slurm/data/prepare_vdjdb_viral_motif_top10.sbatch @@ -13,7 +13,7 @@ MODE="${1:-prepare}" ROOT="${RTP_CODEC_ROOT:-${SLURM_SUBMIT_DIR:-$PWD}}" SNAPSHOT="/projects/immunestatus/vdjdb/vdjdb-2025-07-30" OUTPUT="$ROOT/experiments/trb/vdjdb-viral-motif-top10/${MODE}-${SLURM_JOB_ID}" -SPECIES="$ROOT/examples/data/viral_antigen_species_2025_07_30.txt" +SPECIES="$ROOT/research/examples/data/viral_antigen_species_2025_07_30.txt" PYTHON="${RTP_CODEC_PYTHON:-python}" mkdir -p "$ROOT/experiments/trb/vdjdb-viral-motif-top10" cd "$ROOT" diff --git a/scripts/slurm/data/prepare_vdjdb_ylq.sbatch b/research/scripts/slurm/data/prepare_vdjdb_ylq.sbatch similarity index 100% rename from scripts/slurm/data/prepare_vdjdb_ylq.sbatch rename to research/scripts/slurm/data/prepare_vdjdb_ylq.sbatch diff --git a/scripts/slurm/data/prepare_vdjdb_ylq_motif_pooled.sbatch b/research/scripts/slurm/data/prepare_vdjdb_ylq_motif_pooled.sbatch similarity index 100% rename from scripts/slurm/data/prepare_vdjdb_ylq_motif_pooled.sbatch rename to research/scripts/slurm/data/prepare_vdjdb_ylq_motif_pooled.sbatch diff --git a/scripts/slurm/data/prepare_wordpiece_rq4.sbatch b/research/scripts/slurm/data/prepare_wordpiece_rq4.sbatch similarity index 100% rename from scripts/slurm/data/prepare_wordpiece_rq4.sbatch rename to research/scripts/slurm/data/prepare_wordpiece_rq4.sbatch diff --git a/scripts/slurm/data/prepare_wordpiece_sweep.sbatch b/research/scripts/slurm/data/prepare_wordpiece_sweep.sbatch similarity index 100% rename from scripts/slurm/data/prepare_wordpiece_sweep.sbatch rename to research/scripts/slurm/data/prepare_wordpiece_sweep.sbatch diff --git a/scripts/slurm/data/validate_external_model_cohort.sbatch b/research/scripts/slurm/data/validate_external_model_cohort.sbatch similarity index 100% rename from scripts/slurm/data/validate_external_model_cohort.sbatch rename to research/scripts/slurm/data/validate_external_model_cohort.sbatch diff --git a/scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu.sbatch b/research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu.sbatch similarity index 100% rename from scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu.sbatch rename to research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu.sbatch diff --git a/scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu_fixed.sbatch b/research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu_fixed.sbatch similarity index 100% rename from scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu_fixed.sbatch rename to research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_cpu_fixed.sbatch diff --git a/scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu.sbatch b/research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu.sbatch similarity index 100% rename from scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu.sbatch rename to research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu.sbatch diff --git a/scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu_fixed.sbatch b/research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu_fixed.sbatch similarity index 100% rename from scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu_fixed.sbatch rename to research/scripts/slurm/evaluation/benchmark_vdjdb_irrm_gpu_fixed.sbatch diff --git a/scripts/slurm/evaluation/benchmark_vdjdb_tcremp_runtime.sbatch b/research/scripts/slurm/evaluation/benchmark_vdjdb_tcremp_runtime.sbatch similarity index 100% rename from scripts/slurm/evaluation/benchmark_vdjdb_tcremp_runtime.sbatch rename to research/scripts/slurm/evaluation/benchmark_vdjdb_tcremp_runtime.sbatch diff --git a/scripts/slurm/evaluation/diagnose_vdjdb_decoded_tcremp_geometry.sbatch b/research/scripts/slurm/evaluation/diagnose_vdjdb_decoded_tcremp_geometry.sbatch similarity index 100% rename from scripts/slurm/evaluation/diagnose_vdjdb_decoded_tcremp_geometry.sbatch rename to research/scripts/slurm/evaluation/diagnose_vdjdb_decoded_tcremp_geometry.sbatch diff --git a/scripts/slurm/evaluation/evaluate_latent_secondary.sbatch b/research/scripts/slurm/evaluation/evaluate_latent_secondary.sbatch similarity index 95% rename from scripts/slurm/evaluation/evaluate_latent_secondary.sbatch rename to research/scripts/slurm/evaluation/evaluate_latent_secondary.sbatch index e635831..a912731 100644 --- a/scripts/slurm/evaluation/evaluate_latent_secondary.sbatch +++ b/research/scripts/slurm/evaluation/evaluate_latent_secondary.sbatch @@ -43,10 +43,10 @@ COMMON=( ) if [[ "$MODE" == "preflight" ]]; then - "$PYTHON" -m compileall -q src/rtp_codec/benchmarks/analysis/evaluate_latent_secondary.py tests/test_latent_secondary.py + "$PYTHON" -m compileall -q src/rtp_codec/benchmarks/analysis/evaluate_latent_secondary.py src/tests/test_latent_secondary.py "$PYTHON" - <<'PY' import runpy -namespace = runpy.run_path('tests/test_latent_secondary.py') +namespace = runpy.run_path('src/tests/test_latent_secondary.py') for name, value in sorted(namespace.items()): if name.startswith('test_') and callable(value): value() diff --git a/scripts/slurm/evaluation/evaluate_latent_sufficiency.sbatch b/research/scripts/slurm/evaluation/evaluate_latent_sufficiency.sbatch similarity index 94% rename from scripts/slurm/evaluation/evaluate_latent_sufficiency.sbatch rename to research/scripts/slurm/evaluation/evaluate_latent_sufficiency.sbatch index 6011263..6d65400 100644 --- a/scripts/slurm/evaluation/evaluate_latent_sufficiency.sbatch +++ b/research/scripts/slurm/evaluation/evaluate_latent_sufficiency.sbatch @@ -26,10 +26,10 @@ test ! -e "$OUTPUT" mkdir -p "$BASE" cd "$ROOT" -"$PYTHON" -m compileall -q src/rtp_codec/benchmarks/analysis/evaluate_latent_sufficiency.py tests/test_latent_sufficiency.py +"$PYTHON" -m compileall -q src/rtp_codec/benchmarks/analysis/evaluate_latent_sufficiency.py src/tests/test_latent_sufficiency.py "$PYTHON" - <<'PY' import runpy -scope = runpy.run_path("tests/test_latent_sufficiency.py") +scope = runpy.run_path("src/tests/test_latent_sufficiency.py") for name in sorted(scope): if name.startswith("test_"): scope[name]() diff --git a/scripts/slurm/evaluation/evaluate_rtp_data_anchor_length_errors.sbatch b/research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_length_errors.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_rtp_data_anchor_length_errors.sbatch rename to research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_length_errors.sbatch diff --git a/scripts/slurm/evaluation/evaluate_rtp_data_anchor_position_errors.sbatch b/research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_position_errors.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_rtp_data_anchor_position_errors.sbatch rename to research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_position_errors.sbatch diff --git a/scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions.sbatch b/research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions.sbatch rename to research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions.sbatch diff --git a/scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions_v2.sbatch b/research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions_v2.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions_v2.sbatch rename to research/scripts/slurm/evaluation/evaluate_rtp_data_anchor_substitutions_v2.sbatch diff --git a/scripts/slurm/evaluation/evaluate_rtp_error_analysis.sbatch b/research/scripts/slurm/evaluation/evaluate_rtp_error_analysis.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_rtp_error_analysis.sbatch rename to research/scripts/slurm/evaluation/evaluate_rtp_error_analysis.sbatch diff --git a/scripts/slurm/evaluation/evaluate_single_aa_challenge.sbatch b/research/scripts/slurm/evaluation/evaluate_single_aa_challenge.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_single_aa_challenge.sbatch rename to research/scripts/slurm/evaluation/evaluate_single_aa_challenge.sbatch diff --git a/scripts/slurm/evaluation/evaluate_tcremp_geometry_biology.sbatch b/research/scripts/slurm/evaluation/evaluate_tcremp_geometry_biology.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_tcremp_geometry_biology.sbatch rename to research/scripts/slurm/evaluation/evaluate_tcremp_geometry_biology.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_author_global.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_author_global.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_author_global.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_author_global.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_decoded_tcremp.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_decoded_tcremp.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_decoded_tcremp.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_decoded_tcremp.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_epitope_prediction.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_epitope_prediction.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_epitope_prediction.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_epitope_prediction.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_frozen.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_frozen.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_frozen.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_frozen.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_redcea_clonotypes.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_redcea_clonotypes.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_redcea_clonotypes.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_redcea_clonotypes.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_tonly_decoded_tcremp.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_tonly_decoded_tcremp.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_tonly_decoded_tcremp.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_tonly_decoded_tcremp.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp_pca128.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp_pca128.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp_pca128.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_uniform100_tcremp_pca128.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_viral_motif_top10.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_viral_motif_top10.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_viral_motif_top10.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_viral_motif_top10.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_ylq_frozen.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_ylq_frozen.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_ylq_frozen.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_ylq_frozen.sbatch diff --git a/scripts/slurm/evaluation/evaluate_vdjdb_ylq_motif_pooled.sbatch b/research/scripts/slurm/evaluation/evaluate_vdjdb_ylq_motif_pooled.sbatch similarity index 100% rename from scripts/slurm/evaluation/evaluate_vdjdb_ylq_motif_pooled.sbatch rename to research/scripts/slurm/evaluation/evaluate_vdjdb_ylq_motif_pooled.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_tcremp_umap.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_tcremp_umap.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_tcremp_umap.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_tcremp_umap.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_umap_candidates.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_umap_candidates.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_umap_candidates.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_umap_candidates.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_umap_candidates_runtime.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_umap_candidates_runtime.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_umap_candidates_runtime.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_umap_candidates_runtime.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_uniform100.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_uniform100.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_uniform100.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_uniform100.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_uniform100_direct.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_uniform100_direct.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_uniform100_direct.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_uniform100_direct.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_uniform100_separation.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_uniform100_separation.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_uniform100_separation.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_uniform100_separation.sbatch diff --git a/scripts/slurm/evaluation/run_vdjdb_whole_umap.sbatch b/research/scripts/slurm/evaluation/run_vdjdb_whole_umap.sbatch similarity index 100% rename from scripts/slurm/evaluation/run_vdjdb_whole_umap.sbatch rename to research/scripts/slurm/evaluation/run_vdjdb_whole_umap.sbatch diff --git a/scripts/slurm/legacy/forward_encoder.sbatch b/research/scripts/slurm/legacy/forward_encoder.sbatch similarity index 100% rename from scripts/slurm/legacy/forward_encoder.sbatch rename to research/scripts/slurm/legacy/forward_encoder.sbatch diff --git a/scripts/slurm/legacy/pgen_array.sbatch b/research/scripts/slurm/legacy/pgen_array.sbatch similarity index 98% rename from scripts/slurm/legacy/pgen_array.sbatch rename to research/scripts/slurm/legacy/pgen_array.sbatch index 4dd4faf..850d101 100644 --- a/scripts/slurm/legacy/pgen_array.sbatch +++ b/research/scripts/slurm/legacy/pgen_array.sbatch @@ -9,7 +9,7 @@ # script body runs, so a missing directory kills the job immediately. # # mkdir -p /mnt/tank/scratch/mpodsytnik/irrm-codec/logs -# sbatch scripts/slurm/legacy/pgen_array.sbatch +# sbatch research/scripts/slurm/legacy/pgen_array.sbatch # # tfidf_ridge does not need a GPU, but it finishes in seconds, so keeping one array is # simpler than splitting it onto the CPU partition. diff --git a/scripts/slurm/legacy/pgen_seeds_array.sbatch b/research/scripts/slurm/legacy/pgen_seeds_array.sbatch similarity index 95% rename from scripts/slurm/legacy/pgen_seeds_array.sbatch rename to research/scripts/slurm/legacy/pgen_seeds_array.sbatch index 3221026..3592507 100644 --- a/scripts/slurm/legacy/pgen_seeds_array.sbatch +++ b/research/scripts/slurm/legacy/pgen_seeds_array.sbatch @@ -12,10 +12,10 @@ # output directory, so collect_pgen picks them up with no changes. # # mkdir -p /mnt/tank/scratch/mpodsytnik/irrm-codec/logs -# sbatch scripts/slurm/legacy/pgen_seeds_array.sbatch +# sbatch research/scripts/slurm/legacy/pgen_seeds_array.sbatch # # To repeat only some of them, override SUBSETS: -# sbatch --export=ALL,SUBSETS="1k 10k" scripts/slurm/legacy/pgen_seeds_array.sbatch +# sbatch --export=ALL,SUBSETS="1k 10k" research/scripts/slurm/legacy/pgen_seeds_array.sbatch #SBATCH --job-name=irrm-pgen-seeds #SBATCH --partition=gpu diff --git a/scripts/slurm/legacy/reconstruction_array.sbatch b/research/scripts/slurm/legacy/reconstruction_array.sbatch similarity index 96% rename from scripts/slurm/legacy/reconstruction_array.sbatch rename to research/scripts/slurm/legacy/reconstruction_array.sbatch index e9df3b9..7cb1a71 100644 --- a/scripts/slurm/legacy/reconstruction_array.sbatch +++ b/research/scripts/slurm/legacy/reconstruction_array.sbatch @@ -9,11 +9,11 @@ # # Submit from the repository root: # mkdir -p /mnt/tank/scratch/mpodsytnik/irrm-codec/logs -# sbatch scripts/slurm/legacy/reconstruction_array.sbatch +# sbatch research/scripts/slurm/legacy/reconstruction_array.sbatch # # Override anything without editing the file: # sbatch --export=ALL,BOTTLENECK_DIM=32,TRAIN_SUBSET=10k \ -# scripts/slurm/legacy/reconstruction_array.sbatch +# research/scripts/slurm/legacy/reconstruction_array.sbatch #SBATCH --job-name=irrm-recon #SBATCH --partition=gpu diff --git a/scripts/slurm/legacy/submit_pgen_all.sh b/research/scripts/slurm/legacy/submit_pgen_all.sh similarity index 81% rename from scripts/slurm/legacy/submit_pgen_all.sh rename to research/scripts/slurm/legacy/submit_pgen_all.sh index ce012fb..0ec70bd 100644 --- a/scripts/slurm/legacy/submit_pgen_all.sh +++ b/research/scripts/slurm/legacy/submit_pgen_all.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Submit the whole Pgen benchmark as one dependency chain, so it can be started and left. # -# bash scripts/slurm/legacy/submit_pgen_all.sh +# bash research/scripts/slurm/legacy/submit_pgen_all.sh # # Stages, each waiting for the previous one to succeed: # 1. pretrain the sequence-to-TCRemP encoder (~10 min) @@ -31,16 +31,16 @@ done cd "$REPO" -forward_id=$(sbatch --parsable scripts/slurm/legacy/forward_encoder.sbatch) +forward_id=$(sbatch --parsable research/scripts/slurm/legacy/forward_encoder.sbatch) echo "1/3 forward encoder : $forward_id" -main_id=$(sbatch --parsable --dependency=afterok:"$forward_id" scripts/slurm/legacy/pgen_array.sbatch) +main_id=$(sbatch --parsable --dependency=afterok:"$forward_id" research/scripts/slurm/legacy/pgen_array.sbatch) echo "2/3 main sweep : $main_id (after $forward_id)" # The extra seeds only cover 1k and 10k here; the main sweep already supplies three seeds # per cell, and SUBSETS controls which sizes get topped up to ten. seeds_id=$(sbatch --parsable --dependency=afterok:"$main_id" \ - --export=ALL,SUBSETS="1k 10k all" --array=0-83%2 scripts/slurm/legacy/pgen_seeds_array.sbatch) + --export=ALL,SUBSETS="1k 10k all" --array=0-83%2 research/scripts/slurm/legacy/pgen_seeds_array.sbatch) echo "3/3 extra seeds : $seeds_id (after $main_id)" echo diff --git a/scripts/slurm/preflight/preflight_author_global_embeddings.sbatch b/research/scripts/slurm/preflight/preflight_author_global_embeddings.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_author_global_embeddings.sbatch rename to research/scripts/slurm/preflight/preflight_author_global_embeddings.sbatch diff --git a/scripts/slurm/preflight/preflight_data_anchor_factorial.sbatch b/research/scripts/slurm/preflight/preflight_data_anchor_factorial.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_data_anchor_factorial.sbatch rename to research/scripts/slurm/preflight/preflight_data_anchor_factorial.sbatch diff --git a/scripts/slurm/preflight/preflight_data_anchor_objectives.sbatch b/research/scripts/slurm/preflight/preflight_data_anchor_objectives.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_data_anchor_objectives.sbatch rename to research/scripts/slurm/preflight/preflight_data_anchor_objectives.sbatch diff --git a/scripts/slurm/preflight/preflight_external_model_benchmark.sbatch b/research/scripts/slurm/preflight/preflight_external_model_benchmark.sbatch similarity index 92% rename from scripts/slurm/preflight/preflight_external_model_benchmark.sbatch rename to research/scripts/slurm/preflight/preflight_external_model_benchmark.sbatch index cfabecf..35f2d86 100644 --- a/scripts/slurm/preflight/preflight_external_model_benchmark.sbatch +++ b/research/scripts/slurm/preflight/preflight_external_model_benchmark.sbatch @@ -25,7 +25,7 @@ cd "$REPO" sha256sum \ src/rtp_codec/benchmarks/representations/preflight_external_model_benchmark.py \ - scripts/slurm/preflight/preflight_external_model_benchmark.sbatch \ + research/scripts/slurm/preflight/preflight_external_model_benchmark.sbatch \ "$OUT/PREFLIGHT.json" > "$OUT/HASHES.sha256" echo "status=accepted" diff --git a/scripts/slurm/preflight/preflight_external_residue_benchmark.sbatch b/research/scripts/slurm/preflight/preflight_external_residue_benchmark.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_external_residue_benchmark.sbatch rename to research/scripts/slurm/preflight/preflight_external_residue_benchmark.sbatch diff --git a/scripts/slurm/preflight/preflight_external_residue_pca128_all.sbatch b/research/scripts/slurm/preflight/preflight_external_residue_pca128_all.sbatch similarity index 79% rename from scripts/slurm/preflight/preflight_external_residue_pca128_all.sbatch rename to research/scripts/slurm/preflight/preflight_external_residue_pca128_all.sbatch index 11199bd..4f69d1e 100644 --- a/scripts/slurm/preflight/preflight_external_residue_pca128_all.sbatch +++ b/research/scripts/slurm/preflight/preflight_external_residue_pca128_all.sbatch @@ -25,8 +25,8 @@ cd "$REPO" "$PYTHON" -m rtp_codec.benchmarks.representations.audit_external_residue_alignment \ --dataset-dir "$BASE/cohort" --residue-dir "$BASE/residue-v1/representations" \ --output "$ROOT/RESIDUE_AUDIT.json" --seed 42 -bash -n scripts/slurm/data/fit_external_residue_pca128_all.sbatch \ - scripts/slurm/reports/finalize_external_residue_pca128_all.sbatch \ - scripts/slurm/training/train_external_residue_pca128_remaining.sbatch \ - scripts/slurm/reports/collect_external_residue_pca128_all.sbatch +bash -n research/scripts/slurm/data/fit_external_residue_pca128_all.sbatch \ + research/scripts/slurm/reports/finalize_external_residue_pca128_all.sbatch \ + research/scripts/slurm/training/train_external_residue_pca128_remaining.sbatch \ + research/scripts/slurm/reports/collect_external_residue_pca128_all.sbatch echo status=accepted diff --git a/scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch b/research/scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch similarity index 88% rename from scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch rename to research/scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch index 47c9016..5dfc5ee 100644 --- a/scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch +++ b/research/scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch @@ -23,8 +23,8 @@ cd "$REPO" src/rtp_codec/benchmarks/reconstruction/train_external_model_decoder.py \ src/rtp_codec/benchmarks/reconstruction/collect_external_reconstruction.py bash -n \ - scripts/slurm/training/train_external_rtp128_reconstruction.sbatch \ - scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch + research/scripts/slurm/training/train_external_rtp128_reconstruction.sbatch \ + research/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch "$PYTHON" - "$SOURCE" "$BASE/cohort" "$ROOT" <<'PY' import hashlib @@ -93,8 +93,8 @@ PY sha256sum \ src/rtp_codec/benchmarks/reconstruction/train_external_model_decoder.py \ src/rtp_codec/benchmarks/reconstruction/collect_external_reconstruction.py \ - scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch \ - scripts/slurm/training/train_external_rtp128_reconstruction.sbatch \ - scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch \ + research/scripts/slurm/preflight/preflight_external_rtp128_reconstruction.sbatch \ + research/scripts/slurm/training/train_external_rtp128_reconstruction.sbatch \ + research/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch \ "$ROOT/PREFLIGHT.json" > "$ROOT/PREFLIGHT_HASHES.sha256" echo status=accepted diff --git a/scripts/slurm/preflight/preflight_external_sceptr_pca128.sbatch b/research/scripts/slurm/preflight/preflight_external_sceptr_pca128.sbatch similarity index 81% rename from scripts/slurm/preflight/preflight_external_sceptr_pca128.sbatch rename to research/scripts/slurm/preflight/preflight_external_sceptr_pca128.sbatch index 4928dcb..af35d97 100644 --- a/scripts/slurm/preflight/preflight_external_sceptr_pca128.sbatch +++ b/research/scripts/slurm/preflight/preflight_external_sceptr_pca128.sbatch @@ -29,8 +29,8 @@ test -f "$BASE/residue-v1/representations/sceptr_residue.npy" --residue-dir "$BASE/residue-v1/representations" \ --output "$ROOT/PREFLIGHT.json" bash -n \ - scripts/slurm/data/fit_external_sceptr_pca128.sbatch \ - scripts/slurm/reports/finalize_external_sceptr_pca128.sbatch \ - scripts/slurm/training/train_external_sceptr_pca128_heads.sbatch \ - scripts/slurm/reports/collect_external_sceptr_pca128.sbatch + research/scripts/slurm/data/fit_external_sceptr_pca128.sbatch \ + research/scripts/slurm/reports/finalize_external_sceptr_pca128.sbatch \ + research/scripts/slurm/training/train_external_sceptr_pca128_heads.sbatch \ + research/scripts/slurm/reports/collect_external_sceptr_pca128.sbatch echo status=accepted diff --git a/scripts/slurm/preflight/preflight_phase1_rq1.sbatch b/research/scripts/slurm/preflight/preflight_phase1_rq1.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_phase1_rq1.sbatch rename to research/scripts/slurm/preflight/preflight_phase1_rq1.sbatch diff --git a/scripts/slurm/preflight/preflight_rq5_depths.sbatch b/research/scripts/slurm/preflight/preflight_rq5_depths.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_rq5_depths.sbatch rename to research/scripts/slurm/preflight/preflight_rq5_depths.sbatch diff --git a/scripts/slurm/preflight/preflight_rq5_widths.sbatch b/research/scripts/slurm/preflight/preflight_rq5_widths.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_rq5_widths.sbatch rename to research/scripts/slurm/preflight/preflight_rq5_widths.sbatch diff --git a/scripts/slurm/preflight/preflight_single_aa_challenge.sbatch b/research/scripts/slurm/preflight/preflight_single_aa_challenge.sbatch similarity index 94% rename from scripts/slurm/preflight/preflight_single_aa_challenge.sbatch rename to research/scripts/slurm/preflight/preflight_single_aa_challenge.sbatch index 55edf40..fab3577 100644 --- a/scripts/slurm/preflight/preflight_single_aa_challenge.sbatch +++ b/research/scripts/slurm/preflight/preflight_single_aa_challenge.sbatch @@ -25,7 +25,7 @@ test "$(sha256sum "$PROTOTYPES" | cut -d' ' -f1)" = 38cbb5e75d900ef61476bf3af2ed grep -q 468ddae2107da212bb0db9497a3dc9cc44b00eaf "$MIRPY_PROVENANCE" cd "$ROOT" "$PYTHON" -m compileall -q src/rtp_codec/benchmarks/datasets/prepare_single_aa_challenge.py src/rtp_codec/benchmarks/datasets/validate_single_aa_targets.py src/rtp_codec/benchmarks/analysis/evaluate_single_aa_challenge.py -"$PYTHON" -c "import runpy; ns=runpy.run_path('tests/test_single_aa_challenge.py'); ns['test_mutants_are_unique_one_substitution_and_parent_split_is_disjoint']()" +"$PYTHON" -c "import runpy; ns=runpy.run_path('src/tests/test_single_aa_challenge.py'); ns['test_mutants_are_unique_one_substitution_and_parent_split_is_disjoint']()" PYTHONPATH="$TCREMP_ROOT:$ROOT" "$TCREMP_PYTHON" -c "from tcremp.tcremp_run import main; from mir.embedding.prototype_embedding import PrototypeEmbedding; print('tcremp_import_ok')" "$PYTHON" -m rtp_codec.benchmarks.datasets.prepare_single_aa_challenge \ --data-dir "$ROOT/data/benchmark/trb" --output-dir "$OUT/prepared" \ diff --git a/scripts/slurm/preflight/preflight_vdjdb_epitope.sbatch b/research/scripts/slurm/preflight/preflight_vdjdb_epitope.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_vdjdb_epitope.sbatch rename to research/scripts/slurm/preflight/preflight_vdjdb_epitope.sbatch diff --git a/scripts/slurm/preflight/preflight_vdjdb_evaluation.sbatch b/research/scripts/slurm/preflight/preflight_vdjdb_evaluation.sbatch similarity index 100% rename from scripts/slurm/preflight/preflight_vdjdb_evaluation.sbatch rename to research/scripts/slurm/preflight/preflight_vdjdb_evaluation.sbatch diff --git a/scripts/slurm/reports/collect_author_global_comparison.sbatch b/research/scripts/slurm/reports/collect_author_global_comparison.sbatch similarity index 63% rename from scripts/slurm/reports/collect_author_global_comparison.sbatch rename to research/scripts/slurm/reports/collect_author_global_comparison.sbatch index 599db7c..e0fcbad 100644 --- a/scripts/slurm/reports/collect_author_global_comparison.sbatch +++ b/research/scripts/slurm/reports/collect_author_global_comparison.sbatch @@ -20,6 +20,6 @@ export PYTHONUNBUFFERED=1 mkdir -p "$BASE/logs" cd "$REPO" -"$PYTHON" -m rtp_codec.benchmarks.reporting.collect_author_global_comparison --old-reconstruction-summary "$OLD/results/legacy/reconstruction/reconstruction_summary.csv" --old-pgen-summary "$OLD/results/legacy/pgen/pgen_summary.csv" --new-reconstruction-dir "$BASE/reconstruction" --new-pgen-dir "$BASE/pgen" --control-pgen-dir "$BASE/pgen-onehot-fixed" --reference-vdjdb-metrics "$REPO/experiments/trb/vdjdb-redcea-clonotypes/evaluation-1426728/metrics.json" --external-vdjdb-summary "$VDJDB_EVAL/external_retrieval_summary.tsv" --output-dir "$OUT" +"$PYTHON" -m rtp_codec.benchmarks.reporting.collect_author_global_comparison --old-reconstruction-summary "$OLD/research/results/legacy/reconstruction/reconstruction_summary.csv" --old-pgen-summary "$OLD/research/results/legacy/pgen/pgen_summary.csv" --new-reconstruction-dir "$BASE/reconstruction" --new-pgen-dir "$BASE/pgen" --control-pgen-dir "$BASE/pgen-onehot-fixed" --reference-vdjdb-metrics "$REPO/experiments/trb/vdjdb-redcea-clonotypes/evaluation-1426728/metrics.json" --external-vdjdb-summary "$VDJDB_EVAL/external_retrieval_summary.tsv" --output-dir "$OUT" sha256sum "$OUT/final_author_global_comparison.tsv" "$OUT/final_author_global_comparison.md" "$OUT/MANIFEST.json" > "$OUT/HASHES.sha256" echo "status=complete output=$OUT" diff --git a/scripts/slurm/reports/collect_external_model_benchmark.sbatch b/research/scripts/slurm/reports/collect_external_model_benchmark.sbatch similarity index 74% rename from scripts/slurm/reports/collect_external_model_benchmark.sbatch rename to research/scripts/slurm/reports/collect_external_model_benchmark.sbatch index a49e8c8..f39899e 100644 --- a/scripts/slurm/reports/collect_external_model_benchmark.sbatch +++ b/research/scripts/slurm/reports/collect_external_model_benchmark.sbatch @@ -13,17 +13,17 @@ PYTHON="${RTP_CODEC_PYTHON:-python}" ROOT="$REPO/experiments/trb/external-model-benchmark" export PYTHONPATH="$REPO/src${PYTHONPATH:+:$PYTHONPATH}" export PYTHONUNBUFFERED=1 -mkdir -p "$ROOT/logs" "$ROOT/results/reconstruction" "$ROOT/results/pgen" +mkdir -p "$ROOT/logs" "$ROOT/research/results/reconstruction" "$ROOT/research/results/pgen" cd "$REPO" "$PYTHON" -m rtp_codec.benchmarks.reconstruction.collect_external_reconstruction \ --runs-dir "$ROOT/reconstruction" \ --bottleneck-dir "$ROOT/bottleneck" \ --bottleneck-dim 64 \ - --output-dir "$ROOT/results/reconstruction" + --output-dir "$ROOT/research/results/reconstruction" "$PYTHON" -m rtp_codec.benchmarks.pgen.collect_external_pgen \ --runs-dir "$ROOT/pgen" \ - --output-dir "$ROOT/results/pgen" -find "$ROOT/results" -type f ! -name HASHES.sha256 ! -name HASHES.sha256.tmp -print0 | sort -z | xargs -0 sha256sum > "$ROOT/results/HASHES.sha256.tmp" -mv "$ROOT/results/HASHES.sha256.tmp" "$ROOT/results/HASHES.sha256" + --output-dir "$ROOT/research/results/pgen" +find "$ROOT/results" -type f ! -name HASHES.sha256 ! -name HASHES.sha256.tmp -print0 | sort -z | xargs -0 sha256sum > "$ROOT/research/results/HASHES.sha256.tmp" +mv "$ROOT/research/results/HASHES.sha256.tmp" "$ROOT/research/results/HASHES.sha256" echo "status=accepted" diff --git a/scripts/slurm/reports/collect_external_pca256_pgen.sbatch b/research/scripts/slurm/reports/collect_external_pca256_pgen.sbatch similarity index 74% rename from scripts/slurm/reports/collect_external_pca256_pgen.sbatch rename to research/scripts/slurm/reports/collect_external_pca256_pgen.sbatch index 7dce419..92f3e6d 100644 --- a/scripts/slurm/reports/collect_external_pca256_pgen.sbatch +++ b/research/scripts/slurm/reports/collect_external_pca256_pgen.sbatch @@ -12,8 +12,8 @@ REPO="${RTP_CODEC_ROOT:-${SLURM_SUBMIT_DIR:-$PWD}}" PYTHON="${RTP_CODEC_PYTHON:-python}" ROOT="$REPO/experiments/trb/external-model-benchmark/residue-pca256-v1" export PYTHONPATH="$REPO/src${PYTHONPATH:+:$PYTHONPATH}" -mkdir -p "$ROOT/results/pgen" +mkdir -p "$ROOT/research/results/pgen" cd "$REPO" -"$PYTHON" -m rtp_codec.benchmarks.pgen.collect_external_pgen --runs-dir "$ROOT/pgen" --output-dir "$ROOT/results/pgen" -sha256sum "$ROOT/results/pgen"/* > "$ROOT/results/pgen/HASHES.sha256" +"$PYTHON" -m rtp_codec.benchmarks.pgen.collect_external_pgen --runs-dir "$ROOT/pgen" --output-dir "$ROOT/research/results/pgen" +sha256sum "$ROOT/research/results/pgen"/* > "$ROOT/research/results/pgen/HASHES.sha256" echo status=accepted diff --git a/scripts/slurm/reports/collect_external_pca256_reconstruction.sbatch b/research/scripts/slurm/reports/collect_external_pca256_reconstruction.sbatch similarity index 71% rename from scripts/slurm/reports/collect_external_pca256_reconstruction.sbatch rename to research/scripts/slurm/reports/collect_external_pca256_reconstruction.sbatch index bd814a8..68962b4 100644 --- a/scripts/slurm/reports/collect_external_pca256_reconstruction.sbatch +++ b/research/scripts/slurm/reports/collect_external_pca256_reconstruction.sbatch @@ -12,10 +12,10 @@ REPO="${RTP_CODEC_ROOT:-${SLURM_SUBMIT_DIR:-$PWD}}" PYTHON="${RTP_CODEC_PYTHON:-python}" ROOT="$REPO/experiments/trb/external-model-benchmark/residue-pca256-v1" export PYTHONPATH="$REPO/src${PYTHONPATH:+:$PYTHONPATH}" -mkdir -p "$ROOT/results/reconstruction" +mkdir -p "$ROOT/research/results/reconstruction" cd "$REPO" "$PYTHON" -m rtp_codec.benchmarks.reconstruction.collect_external_reconstruction \ - --runs-dir "$ROOT/reconstruction" --output-dir "$ROOT/results/reconstruction" \ + --runs-dir "$ROOT/reconstruction" --output-dir "$ROOT/research/results/reconstruction" \ --bottleneck-dir "$ROOT/bottleneck" --bottleneck-dim 256 -sha256sum "$ROOT/results/reconstruction"/* > "$ROOT/results/reconstruction/HASHES.sha256" +sha256sum "$ROOT/research/results/reconstruction"/* > "$ROOT/research/results/reconstruction/HASHES.sha256" echo status=accepted diff --git a/scripts/slurm/reports/collect_external_residue_benchmark.sbatch b/research/scripts/slurm/reports/collect_external_residue_benchmark.sbatch similarity index 86% rename from scripts/slurm/reports/collect_external_residue_benchmark.sbatch rename to research/scripts/slurm/reports/collect_external_residue_benchmark.sbatch index c5d0ff1..ef02012 100644 --- a/scripts/slurm/reports/collect_external_residue_benchmark.sbatch +++ b/research/scripts/slurm/reports/collect_external_residue_benchmark.sbatch @@ -20,6 +20,6 @@ cd "$REPO" --reconstruction-dir "$ROOT/reconstruction" \ --pgen-dir "$ROOT/pgen" \ --output-dir "$ROOT/results" -find "$ROOT/results" -maxdepth 1 -type f ! -name HASHES.sha256 -print0 | sort -z | xargs -0 sha256sum > "$ROOT/results/HASHES.sha256" -cat "$ROOT/results/HASHES.sha256" +find "$ROOT/results" -maxdepth 1 -type f ! -name HASHES.sha256 -print0 | sort -z | xargs -0 sha256sum > "$ROOT/research/results/HASHES.sha256" +cat "$ROOT/research/results/HASHES.sha256" echo "status=complete" diff --git a/scripts/slurm/reports/collect_external_residue_pca128_all.sbatch b/research/scripts/slurm/reports/collect_external_residue_pca128_all.sbatch similarity index 68% rename from scripts/slurm/reports/collect_external_residue_pca128_all.sbatch rename to research/scripts/slurm/reports/collect_external_residue_pca128_all.sbatch index d316695..89590c4 100644 --- a/scripts/slurm/reports/collect_external_residue_pca128_all.sbatch +++ b/research/scripts/slurm/reports/collect_external_residue_pca128_all.sbatch @@ -14,15 +14,15 @@ BASE="$REPO/experiments/trb/external-model-benchmark" ROOT="$BASE/residue-pca128-v1" SCEPTR_ROOT="$BASE/residue-pca128-sceptr-v1" export PYTHONPATH="$REPO/src${PYTHONPATH:+:$PYTHONPATH}" -mkdir -p "$ROOT/results/reconstruction" "$ROOT/results/pgen" +mkdir -p "$ROOT/research/results/reconstruction" "$ROOT/research/results/pgen" cd "$REPO" "$PYTHON" -m rtp_codec.benchmarks.reconstruction.collect_external_reconstruction \ - --runs-dir "$ROOT/reconstruction" --output-dir "$ROOT/results/reconstruction" \ + --runs-dir "$ROOT/reconstruction" --output-dir "$ROOT/research/results/reconstruction" \ --bottleneck-dir "$ROOT/bottleneck" --bottleneck-dim 128 "$PYTHON" -m rtp_codec.benchmarks.pgen.collect_external_pgen \ - --runs-dir "$ROOT/pgen" --output-dir "$ROOT/results/pgen" + --runs-dir "$ROOT/pgen" --output-dir "$ROOT/research/results/pgen" "$PYTHON" -m rtp_codec.benchmarks.reporting.combine_external_pca128_results \ --main-root "$ROOT" --sceptr-root "$SCEPTR_ROOT" -sha256sum "$ROOT/results/reconstruction"/* "$ROOT/results/pgen"/* \ - "$ROOT/results/all_baselines"/* > "$ROOT/results/HASHES.sha256" +sha256sum "$ROOT/research/results/reconstruction"/* "$ROOT/research/results/pgen"/* \ + "$ROOT/research/results/all_baselines"/* > "$ROOT/research/results/HASHES.sha256" echo status=accepted diff --git a/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch b/research/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch similarity index 80% rename from scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch rename to research/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch index f01053c..84d0ebe 100644 --- a/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch +++ b/research/scripts/slurm/reports/collect_external_rtp128_reconstruction.sbatch @@ -14,12 +14,12 @@ PYTHON="${RTP_CODEC_PYTHON:-python}" BASE="$REPO/experiments/trb/external-model-benchmark" ROOT="$BASE/native-rtp128-v1" export PYTHONPATH="$REPO/src${PYTHONPATH:+:$PYTHONPATH}" -mkdir -p "$ROOT/results/reconstruction" +mkdir -p "$ROOT/research/results/reconstruction" cd "$REPO" "$PYTHON" -m rtp_codec.benchmarks.reconstruction.collect_external_reconstruction \ --runs-dir "$ROOT/reconstruction" \ - --output-dir "$ROOT/results/reconstruction" \ + --output-dir "$ROOT/research/results/reconstruction" \ --bottleneck-dir "$ROOT/bottleneck" \ --bottleneck-dim 128 @@ -32,8 +32,8 @@ from pathlib import Path import pandas as pd root = Path(sys.argv[1]) -runs = pd.read_csv(root / "results/legacy/reconstruction/reconstruction_runs.csv") -summary = pd.read_csv(root / "results/legacy/reconstruction/reconstruction_summary.csv") +runs = pd.read_csv(root / "research/results/legacy/reconstruction/reconstruction_runs.csv") +summary = pd.read_csv(root / "research/results/legacy/reconstruction/reconstruction_summary.csv") assert len(runs) == 3 and set(runs.seed) == {42, 43, 44} assert runs.representation.eq("rtp").all() and runs.bottleneck_dim.eq(128).all() assert len(summary) == 1 and summary.loc[0, "representation"] == "rtp" @@ -43,7 +43,7 @@ def sha256(path): return hashlib.sha256(path.read_bytes()).hexdigest() artifacts = {} -for path in sorted((root / "results/reconstruction").glob("*")): +for path in sorted((root / "research/results/reconstruction").glob("*")): if path.is_file(): artifacts[str(path)] = sha256(path) for path in sorted((root / "reconstruction").glob("*/metrics.json")): @@ -64,7 +64,7 @@ report = { print(json.dumps(report, indent=2)) PY -sha256sum "$ROOT/RESULTS.json" "$ROOT/results/reconstruction"/* > "$ROOT/RESULT_HASHES.sha256" +sha256sum "$ROOT/RESULTS.json" "$ROOT/research/results/reconstruction"/* > "$ROOT/RESULT_HASHES.sha256" if grep -R -E -i 'traceback|out of memory|nan|inf' "$ROOT/logs"/*.err; then echo "error/nonfinite signature found" >&2 exit 1 diff --git a/scripts/slurm/reports/collect_external_sceptr_pca128.sbatch b/research/scripts/slurm/reports/collect_external_sceptr_pca128.sbatch similarity index 65% rename from scripts/slurm/reports/collect_external_sceptr_pca128.sbatch rename to research/scripts/slurm/reports/collect_external_sceptr_pca128.sbatch index 8e287ef..25697a1 100644 --- a/scripts/slurm/reports/collect_external_sceptr_pca128.sbatch +++ b/research/scripts/slurm/reports/collect_external_sceptr_pca128.sbatch @@ -12,13 +12,13 @@ REPO="${RTP_CODEC_ROOT:-${SLURM_SUBMIT_DIR:-$PWD}}" PYTHON="${RTP_CODEC_PYTHON:-python}" ROOT="$REPO/experiments/trb/external-model-benchmark/residue-pca128-sceptr-v1" export PYTHONPATH="$REPO/src${PYTHONPATH:+:$PYTHONPATH}" -mkdir -p "$ROOT/results/reconstruction" "$ROOT/results/pgen" +mkdir -p "$ROOT/research/results/reconstruction" "$ROOT/research/results/pgen" cd "$REPO" "$PYTHON" -m rtp_codec.benchmarks.reconstruction.collect_external_reconstruction \ - --runs-dir "$ROOT/reconstruction" --output-dir "$ROOT/results/reconstruction" \ + --runs-dir "$ROOT/reconstruction" --output-dir "$ROOT/research/results/reconstruction" \ --bottleneck-dir "$ROOT/bottleneck" --bottleneck-dim 128 "$PYTHON" -m rtp_codec.benchmarks.pgen.collect_external_pgen \ - --runs-dir "$ROOT/pgen" --output-dir "$ROOT/results/pgen" -sha256sum "$ROOT/results/reconstruction"/* "$ROOT/results/pgen"/* \ - > "$ROOT/results/HASHES.sha256" + --runs-dir "$ROOT/pgen" --output-dir "$ROOT/research/results/pgen" +sha256sum "$ROOT/research/results/reconstruction"/* "$ROOT/research/results/pgen"/* \ + > "$ROOT/research/results/HASHES.sha256" echo status=accepted diff --git a/scripts/slurm/reports/finalize_external_residue_pca128_all.sbatch b/research/scripts/slurm/reports/finalize_external_residue_pca128_all.sbatch similarity index 100% rename from scripts/slurm/reports/finalize_external_residue_pca128_all.sbatch rename to research/scripts/slurm/reports/finalize_external_residue_pca128_all.sbatch diff --git a/scripts/slurm/reports/finalize_external_residue_pca256.sbatch b/research/scripts/slurm/reports/finalize_external_residue_pca256.sbatch similarity index 100% rename from scripts/slurm/reports/finalize_external_residue_pca256.sbatch rename to research/scripts/slurm/reports/finalize_external_residue_pca256.sbatch diff --git a/scripts/slurm/reports/finalize_external_sceptr_pca128.sbatch b/research/scripts/slurm/reports/finalize_external_sceptr_pca128.sbatch similarity index 100% rename from scripts/slurm/reports/finalize_external_sceptr_pca128.sbatch rename to research/scripts/slurm/reports/finalize_external_sceptr_pca128.sbatch diff --git a/scripts/slurm/reports/finalize_vdjdb_epitope_prediction.sbatch b/research/scripts/slurm/reports/finalize_vdjdb_epitope_prediction.sbatch similarity index 100% rename from scripts/slurm/reports/finalize_vdjdb_epitope_prediction.sbatch rename to research/scripts/slurm/reports/finalize_vdjdb_epitope_prediction.sbatch diff --git a/scripts/slurm/training/paper.sbatch b/research/scripts/slurm/training/paper.sbatch similarity index 90% rename from scripts/slurm/training/paper.sbatch rename to research/scripts/slurm/training/paper.sbatch index c3bdace..056afd5 100644 --- a/scripts/slurm/training/paper.sbatch +++ b/research/scripts/slurm/training/paper.sbatch @@ -14,7 +14,7 @@ PYTHON="${RTP_CODEC_PYTHON:-python}" : "${DATA_DIR:?Set DATA_DIR to the locked prepared benchmark}" : "${TOKENIZER_PATH:?Set TOKENIZER_PATH to the DATA-ANCHOR bundle}" cd "$ROOT" -"$PYTHON" -m rtp_codec train --config "configs/paper/$ARM.json" \ +"$PYTHON" -m rtp_codec train --config "research/configs/paper/$ARM.json" \ --data-dir "$DATA_DIR" --tokenizer-path "$TOKENIZER_PATH" \ --output-dir "${OUTPUT_DIR:-artifacts/paper/$ARM-seed42}" \ --device cuda --num-workers "${SLURM_CPUS_PER_TASK:-8}" diff --git a/scripts/slurm/training/smoke_tcremp_geometry_loss.sbatch b/research/scripts/slurm/training/smoke_tcremp_geometry_loss.sbatch similarity index 94% rename from scripts/slurm/training/smoke_tcremp_geometry_loss.sbatch rename to research/scripts/slurm/training/smoke_tcremp_geometry_loss.sbatch index ce9d803..102b5d1 100644 --- a/scripts/slurm/training/smoke_tcremp_geometry_loss.sbatch +++ b/research/scripts/slurm/training/smoke_tcremp_geometry_loss.sbatch @@ -13,7 +13,7 @@ ROOT="${RTP_CODEC_ROOT:-${SLURM_SUBMIT_DIR:-$PWD}}" OUT="$ROOT/experiments/trb/tcremp-geometry-smoke-${SLURM_JOB_ID}" PYTHON="${RTP_CODEC_PYTHON:-python}" cd "$ROOT" -PYTHONPATH="$ROOT/src${PYTHONPATH:+:$PYTHONPATH}" "$PYTHON" tests/test_tcremp_geometry_loss.py +PYTHONPATH="$ROOT/src${PYTHONPATH:+:$PYTHONPATH}" "$PYTHON" src/tests/test_tcremp_geometry_loss.py PYTHONPATH="$ROOT/src${PYTHONPATH:+:$PYTHONPATH}" "$PYTHON" -m rtp_codec.training.multitask \ --data-dir "$ROOT/data/benchmark/trb" --standardizer-path "$ROOT/data/benchmark/trb/target_standardizer.npz" \ --output-dir "$OUT" --train-subset all --pgen-target log10_pgen_1mm \ diff --git a/scripts/slurm/training/train_anchored_tokenizer.sbatch b/research/scripts/slurm/training/train_anchored_tokenizer.sbatch similarity index 100% rename from scripts/slurm/training/train_anchored_tokenizer.sbatch rename to research/scripts/slurm/training/train_anchored_tokenizer.sbatch diff --git a/scripts/slurm/training/train_author_global_onehot_fixed.sbatch b/research/scripts/slurm/training/train_author_global_onehot_fixed.sbatch similarity index 100% rename from scripts/slurm/training/train_author_global_onehot_fixed.sbatch rename to research/scripts/slurm/training/train_author_global_onehot_fixed.sbatch diff --git a/scripts/slurm/training/train_author_global_pgen.sbatch b/research/scripts/slurm/training/train_author_global_pgen.sbatch similarity index 100% rename from scripts/slurm/training/train_author_global_pgen.sbatch rename to research/scripts/slurm/training/train_author_global_pgen.sbatch diff --git a/scripts/slurm/training/train_author_global_pgen_controls.sbatch b/research/scripts/slurm/training/train_author_global_pgen_controls.sbatch similarity index 100% rename from scripts/slurm/training/train_author_global_pgen_controls.sbatch rename to research/scripts/slurm/training/train_author_global_pgen_controls.sbatch diff --git a/scripts/slurm/training/train_author_global_reconstruction.sbatch b/research/scripts/slurm/training/train_author_global_reconstruction.sbatch similarity index 100% rename from scripts/slurm/training/train_author_global_reconstruction.sbatch rename to research/scripts/slurm/training/train_author_global_reconstruction.sbatch diff --git a/scripts/slurm/training/train_data_anchor_objective.sbatch b/research/scripts/slurm/training/train_data_anchor_objective.sbatch similarity index 97% rename from scripts/slurm/training/train_data_anchor_objective.sbatch rename to research/scripts/slurm/training/train_data_anchor_objective.sbatch index 99fd823..075a362 100644 --- a/scripts/slurm/training/train_data_anchor_objective.sbatch +++ b/research/scripts/slurm/training/train_data_anchor_objective.sbatch @@ -23,7 +23,7 @@ DATA_DIR="$ROOT_DIR/data/benchmark/trb" TOKENIZER="$ROOT_DIR/experiments/trb/tokenizers/anchored-seed42/data_anchor/anchored_tokenizer.json" MATRIX_ROOT="$ROOT_DIR/experiments/trb/data-anchor-full-factorial-gate" PREFLIGHT="$MATRIX_ROOT/PREFLIGHT.json" -CONDITION_CONFIG="$MATRIX_ROOT/configs/$CONDITION.json" +CONDITION_CONFIG="$MATRIX_ROOT/research/configs/$CONDITION.json" OUTPUT_DIR="$ROOT_DIR/experiments/trb/data-anchor-$CONDITION-seed42" PYTHON_BIN="${RTP_CODEC_PYTHON:-$(command -v python)}" diff --git a/scripts/slurm/training/train_external_pca256_pgen.sbatch b/research/scripts/slurm/training/train_external_pca256_pgen.sbatch similarity index 100% rename from scripts/slurm/training/train_external_pca256_pgen.sbatch rename to research/scripts/slurm/training/train_external_pca256_pgen.sbatch diff --git a/scripts/slurm/training/train_external_pca256_reconstruction.sbatch b/research/scripts/slurm/training/train_external_pca256_reconstruction.sbatch similarity index 100% rename from scripts/slurm/training/train_external_pca256_reconstruction.sbatch rename to research/scripts/slurm/training/train_external_pca256_reconstruction.sbatch diff --git a/scripts/slurm/training/train_external_pca256_sceptr_reconstruction.sbatch b/research/scripts/slurm/training/train_external_pca256_sceptr_reconstruction.sbatch similarity index 100% rename from scripts/slurm/training/train_external_pca256_sceptr_reconstruction.sbatch rename to research/scripts/slurm/training/train_external_pca256_sceptr_reconstruction.sbatch diff --git a/scripts/slurm/training/train_external_pgen.sbatch b/research/scripts/slurm/training/train_external_pgen.sbatch similarity index 100% rename from scripts/slurm/training/train_external_pgen.sbatch rename to research/scripts/slurm/training/train_external_pgen.sbatch diff --git a/scripts/slurm/training/train_external_pgen_tfidf.sbatch b/research/scripts/slurm/training/train_external_pgen_tfidf.sbatch similarity index 100% rename from scripts/slurm/training/train_external_pgen_tfidf.sbatch rename to research/scripts/slurm/training/train_external_pgen_tfidf.sbatch diff --git a/scripts/slurm/training/train_external_reconstruction.sbatch b/research/scripts/slurm/training/train_external_reconstruction.sbatch similarity index 100% rename from scripts/slurm/training/train_external_reconstruction.sbatch rename to research/scripts/slurm/training/train_external_reconstruction.sbatch diff --git a/scripts/slurm/training/train_external_residue_pca128_remaining.sbatch b/research/scripts/slurm/training/train_external_residue_pca128_remaining.sbatch similarity index 100% rename from scripts/slurm/training/train_external_residue_pca128_remaining.sbatch rename to research/scripts/slurm/training/train_external_residue_pca128_remaining.sbatch diff --git a/scripts/slurm/training/train_external_residue_pgen.sbatch b/research/scripts/slurm/training/train_external_residue_pgen.sbatch similarity index 100% rename from scripts/slurm/training/train_external_residue_pgen.sbatch rename to research/scripts/slurm/training/train_external_residue_pgen.sbatch diff --git a/scripts/slurm/training/train_external_residue_reconstruction.sbatch b/research/scripts/slurm/training/train_external_residue_reconstruction.sbatch similarity index 100% rename from scripts/slurm/training/train_external_residue_reconstruction.sbatch rename to research/scripts/slurm/training/train_external_residue_reconstruction.sbatch diff --git a/scripts/slurm/training/train_external_rtp128_reconstruction.sbatch b/research/scripts/slurm/training/train_external_rtp128_reconstruction.sbatch similarity index 100% rename from scripts/slurm/training/train_external_rtp128_reconstruction.sbatch rename to research/scripts/slurm/training/train_external_rtp128_reconstruction.sbatch diff --git a/scripts/slurm/training/train_external_sceptr_pca128_heads.sbatch b/research/scripts/slurm/training/train_external_sceptr_pca128_heads.sbatch similarity index 100% rename from scripts/slurm/training/train_external_sceptr_pca128_heads.sbatch rename to research/scripts/slurm/training/train_external_sceptr_pca128_heads.sbatch diff --git a/scripts/slurm/training/train_forward.sbatch b/research/scripts/slurm/training/train_forward.sbatch similarity index 98% rename from scripts/slurm/training/train_forward.sbatch rename to research/scripts/slurm/training/train_forward.sbatch index 574afa7..8a39bb6 100644 --- a/scripts/slurm/training/train_forward.sbatch +++ b/research/scripts/slurm/training/train_forward.sbatch @@ -10,7 +10,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" mkdir -p slurm/logs diff --git a/scripts/slurm/training/train_forward_wandb_grid.sbatch b/research/scripts/slurm/training/train_forward_wandb_grid.sbatch similarity index 100% rename from scripts/slurm/training/train_forward_wandb_grid.sbatch rename to research/scripts/slurm/training/train_forward_wandb_grid.sbatch diff --git a/scripts/slurm/training/train_inverse_wandb_grid.sbatch b/research/scripts/slurm/training/train_inverse_wandb_grid.sbatch similarity index 100% rename from scripts/slurm/training/train_inverse_wandb_grid.sbatch rename to research/scripts/slurm/training/train_inverse_wandb_grid.sbatch diff --git a/scripts/slurm/training/train_multitask.sbatch b/research/scripts/slurm/training/train_multitask.sbatch similarity index 85% rename from scripts/slurm/training/train_multitask.sbatch rename to research/scripts/slurm/training/train_multitask.sbatch index 6b2a9b7..36f1dac 100644 --- a/scripts/slurm/training/train_multitask.sbatch +++ b/research/scripts/slurm/training/train_multitask.sbatch @@ -11,7 +11,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" export DATA_DIR="${DATA_DIR:-data/benchmark/trb}" export OUTPUT_DIR="${OUTPUT_DIR:-artifacts/multitask/char}" @@ -22,4 +22,4 @@ export BATCH_SIZE="${BATCH_SIZE:-64}" export EPOCHS="${EPOCHS:-40}" export SEED="${SEED:-42}" -bash scripts/training/train_multitask.sh --num-workers "${SLURM_CPUS_PER_TASK:-8}" +bash research/scripts/training/train_multitask.sh --num-workers "${SLURM_CPUS_PER_TASK:-8}" diff --git a/scripts/slurm/training/train_pgen_background_100k_array.sbatch b/research/scripts/slurm/training/train_pgen_background_100k_array.sbatch similarity index 98% rename from scripts/slurm/training/train_pgen_background_100k_array.sbatch rename to research/scripts/slurm/training/train_pgen_background_100k_array.sbatch index bcc8960..958bd6f 100644 --- a/scripts/slurm/training/train_pgen_background_100k_array.sbatch +++ b/research/scripts/slurm/training/train_pgen_background_100k_array.sbatch @@ -12,7 +12,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" CHAINS=(TRB TRA TRG TRD IGH IGK IGL) diff --git a/scripts/slurm/training/train_pgen_trb_background_100k.sbatch b/research/scripts/slurm/training/train_pgen_trb_background_100k.sbatch similarity index 98% rename from scripts/slurm/training/train_pgen_trb_background_100k.sbatch rename to research/scripts/slurm/training/train_pgen_trb_background_100k.sbatch index e642ecb..aece17f 100644 --- a/scripts/slurm/training/train_pgen_trb_background_100k.sbatch +++ b/research/scripts/slurm/training/train_pgen_trb_background_100k.sbatch @@ -11,7 +11,7 @@ set -euo pipefail -ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}" +ROOT_DIR="${SLURM_SUBMIT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)}" cd "$ROOT_DIR" AIRR_PATH="/projects/immunestatus/vdjrearm/pgen_1mm_background_100k/trb_background_100k_pgen.tsv" diff --git a/scripts/slurm/training/train_phase1_rq1_char.sbatch b/research/scripts/slurm/training/train_phase1_rq1_char.sbatch similarity index 100% rename from scripts/slurm/training/train_phase1_rq1_char.sbatch rename to research/scripts/slurm/training/train_phase1_rq1_char.sbatch diff --git a/scripts/slurm/training/train_phase2_rq23_char.sbatch b/research/scripts/slurm/training/train_phase2_rq23_char.sbatch similarity index 100% rename from scripts/slurm/training/train_phase2_rq23_char.sbatch rename to research/scripts/slurm/training/train_phase2_rq23_char.sbatch diff --git a/scripts/slurm/training/train_rq4_wordpiece.sbatch b/research/scripts/slurm/training/train_rq4_wordpiece.sbatch similarity index 100% rename from scripts/slurm/training/train_rq4_wordpiece.sbatch rename to research/scripts/slurm/training/train_rq4_wordpiece.sbatch diff --git a/scripts/slurm/training/train_rq5_depth.sbatch b/research/scripts/slurm/training/train_rq5_depth.sbatch similarity index 100% rename from scripts/slurm/training/train_rq5_depth.sbatch rename to research/scripts/slurm/training/train_rq5_depth.sbatch diff --git a/scripts/slurm/training/train_rq5_width.sbatch b/research/scripts/slurm/training/train_rq5_width.sbatch similarity index 100% rename from scripts/slurm/training/train_rq5_width.sbatch rename to research/scripts/slurm/training/train_rq5_width.sbatch diff --git a/scripts/slurm/training/train_tcremp_geometry_ablation.sbatch b/research/scripts/slurm/training/train_tcremp_geometry_ablation.sbatch similarity index 100% rename from scripts/slurm/training/train_tcremp_geometry_ablation.sbatch rename to research/scripts/slurm/training/train_tcremp_geometry_ablation.sbatch diff --git a/scripts/slurm/training/train_wordpiece_sweep.sbatch b/research/scripts/slurm/training/train_wordpiece_sweep.sbatch similarity index 100% rename from scripts/slurm/training/train_wordpiece_sweep.sbatch rename to research/scripts/slurm/training/train_wordpiece_sweep.sbatch diff --git a/scripts/training/calc_pgen_1mm.sh b/research/scripts/training/calc_pgen_1mm.sh similarity index 96% rename from scripts/training/calc_pgen_1mm.sh rename to research/scripts/training/calc_pgen_1mm.sh index bcb326c..947e951 100644 --- a/scripts/training/calc_pgen_1mm.sh +++ b/research/scripts/training/calc_pgen_1mm.sh @@ -2,7 +2,7 @@ set -euo pipefail -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" cd "$ROOT_DIR" AIRR_PATH="${AIRR_PATH:-}" diff --git a/scripts/training/tcremp_launch.sh b/research/scripts/training/tcremp_launch.sh similarity index 100% rename from scripts/training/tcremp_launch.sh rename to research/scripts/training/tcremp_launch.sh diff --git a/scripts/training/train_multitask.sh b/research/scripts/training/train_multitask.sh similarity index 100% rename from scripts/training/train_multitask.sh rename to research/scripts/training/train_multitask.sh diff --git a/scripts/training/train_pgen.sh b/research/scripts/training/train_pgen.sh similarity index 97% rename from scripts/training/train_pgen.sh rename to research/scripts/training/train_pgen.sh index 40f5336..6f6f5d9 100644 --- a/scripts/training/train_pgen.sh +++ b/research/scripts/training/train_pgen.sh @@ -2,7 +2,7 @@ set -euo pipefail -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" cd "$ROOT_DIR" AIRR_PATH="${AIRR_PATH:-}" diff --git a/scripts/legacy/run3_all_sequential.sh b/scripts/legacy/run3_all_sequential.sh deleted file mode 100644 index e1b862f..0000000 --- a/scripts/legacy/run3_all_sequential.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -bash scripts/legacy/run3a_individual_maxlen.sh -bash scripts/legacy/run3b_individual_maxlen_maxtokenlen9.sh -bash scripts/legacy/run3c_fixed_maxlen10.sh diff --git a/scripts/legacy/run4_all_sequential.sh b/scripts/legacy/run4_all_sequential.sh deleted file mode 100644 index a6ddc21..0000000 --- a/scripts/legacy/run4_all_sequential.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}" -bash scripts/legacy/run4a_individual_maxlen_maxtokenlen9_anchored.sh -bash scripts/legacy/run4b_individual_maxlen_maxtokenlen9_anchored_dropout.sh diff --git a/scripts/legacy/run5_all_sequential.sh b/scripts/legacy/run5_all_sequential.sh deleted file mode 100644 index 7b64970..0000000 --- a/scripts/legacy/run5_all_sequential.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -export PYTHONPATH="$PWD/src${PYTHONPATH:+:$PYTHONPATH}" -bash scripts/legacy/run5a_hidden128.sh -bash scripts/legacy/run5b_blocks3.sh -bash scripts/legacy/run5c_hidden128_blocks3.sh -bash scripts/legacy/run5d_hidden96_blocks3.sh diff --git a/src/rtp_codec/benchmarks/datasets/prepare_vdjdb_redcea_clonotypes.py b/src/rtp_codec/benchmarks/datasets/prepare_vdjdb_redcea_clonotypes.py index f982c64..60f982c 100644 --- a/src/rtp_codec/benchmarks/datasets/prepare_vdjdb_redcea_clonotypes.py +++ b/src/rtp_codec/benchmarks/datasets/prepare_vdjdb_redcea_clonotypes.py @@ -180,7 +180,7 @@ def main() -> None: "sha256": sha256(args.cluster_members), "git_commit": args.source_git_commit, "git_blob": args.source_git_blob, - "expected_repository_path": "results/redcea/cluster_members_TRB.txt", + "expected_repository_path": "research/results/redcea/cluster_members_TRB.txt", }, "cohort": { "path": str(cohort_path), "sha256": sha256(cohort_path), diff --git a/src/rtp_codec/benchmarks/pgen/collect_external_pgen.py b/src/rtp_codec/benchmarks/pgen/collect_external_pgen.py index 6c686a5..5fb4d49 100644 --- a/src/rtp_codec/benchmarks/pgen/collect_external_pgen.py +++ b/src/rtp_codec/benchmarks/pgen/collect_external_pgen.py @@ -24,7 +24,7 @@ def parse_args(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument("--runs-dir", default="artifacts/benchmark/pgen") - p.add_argument("--output-dir", default="results/pgen") + p.add_argument("--output-dir", default="research/results/pgen") return p.parse_args() diff --git a/src/rtp_codec/benchmarks/pgen/collect_pgen.py b/src/rtp_codec/benchmarks/pgen/collect_pgen.py index 0daaa40..d26ad7d 100644 --- a/src/rtp_codec/benchmarks/pgen/collect_pgen.py +++ b/src/rtp_codec/benchmarks/pgen/collect_pgen.py @@ -24,7 +24,7 @@ def parse_args(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument("--runs-dir", default="artifacts/benchmark/pgen") - p.add_argument("--output-dir", default="results/pgen") + p.add_argument("--output-dir", default="research/results/pgen") return p.parse_args() diff --git a/src/rtp_codec/benchmarks/reconstruction/collect_external_reconstruction.py b/src/rtp_codec/benchmarks/reconstruction/collect_external_reconstruction.py index fd6207c..8442903 100644 --- a/src/rtp_codec/benchmarks/reconstruction/collect_external_reconstruction.py +++ b/src/rtp_codec/benchmarks/reconstruction/collect_external_reconstruction.py @@ -29,7 +29,7 @@ def parse_args(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument("--runs-dir", default="artifacts/benchmark/reconstruction") p.add_argument("--bottleneck-dir", default="data/benchmark/trb/bottleneck") - p.add_argument("--output-dir", default="results/reconstruction") + p.add_argument("--output-dir", default="research/results/reconstruction") p.add_argument("--bottleneck-dim", type=int, default=64) return p.parse_args() diff --git a/src/rtp_codec/benchmarks/reconstruction/collect_reconstruction.py b/src/rtp_codec/benchmarks/reconstruction/collect_reconstruction.py index fd6207c..8442903 100644 --- a/src/rtp_codec/benchmarks/reconstruction/collect_reconstruction.py +++ b/src/rtp_codec/benchmarks/reconstruction/collect_reconstruction.py @@ -29,7 +29,7 @@ def parse_args(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument("--runs-dir", default="artifacts/benchmark/reconstruction") p.add_argument("--bottleneck-dir", default="data/benchmark/trb/bottleneck") - p.add_argument("--output-dir", default="results/reconstruction") + p.add_argument("--output-dir", default="research/results/reconstruction") p.add_argument("--bottleneck-dim", type=int, default=64) return p.parse_args() diff --git a/src/rtp_codec/benchmarks/runtime/benchmark_speed.py b/src/rtp_codec/benchmarks/runtime/benchmark_speed.py index 6c853ba..87134ef 100644 --- a/src/rtp_codec/benchmarks/runtime/benchmark_speed.py +++ b/src/rtp_codec/benchmarks/runtime/benchmark_speed.py @@ -30,7 +30,7 @@ def parse_args(): p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument("--dataset-dir", default="data/benchmark/trb") - p.add_argument("--output-dir", default="results/pgen") + p.add_argument("--output-dir", default="research/results/pgen") p.add_argument("--device", default="auto", choices=("auto", "cpu", "cuda")) p.add_argument("--n-sequences", type=int, default=5000) p.add_argument("--batch-size", type=int, default=256) diff --git a/src/rtp_codec/experiments/sweeps/submit_wandb_grid.py b/src/rtp_codec/experiments/sweeps/submit_wandb_grid.py index bf60755..0e1b2a2 100644 --- a/src/rtp_codec/experiments/sweeps/submit_wandb_grid.py +++ b/src/rtp_codec/experiments/sweeps/submit_wandb_grid.py @@ -161,14 +161,14 @@ def main(): args, "forward", FORWARD_GRID, - scripts_root / "scripts" / "slurm" / "training" / "train_forward_wandb_grid.sbatch", + scripts_root / "research" / "scripts" / "slurm" / "training" / "train_forward_wandb_grid.sbatch", ) if args.model in {"inverse", "both"}: total += submit_model( args, "inverse", INVERSE_GRID, - scripts_root / "scripts" / "slurm" / "training" / "train_inverse_wandb_grid.sbatch", + scripts_root / "research" / "scripts" / "slurm" / "training" / "train_inverse_wandb_grid.sbatch", ) print(f"submitted_jobs={total}") diff --git a/src/rtp_codec/paths.py b/src/rtp_codec/paths.py index f6d27cb..553bbbe 100644 --- a/src/rtp_codec/paths.py +++ b/src/rtp_codec/paths.py @@ -10,6 +10,6 @@ def repository_root() -> Path: raise FileNotFoundError(f"RTP_CODEC_ROOT is not a repository checkout: {root}") return root for root in Path(__file__).resolve().parents: - if (root / "pyproject.toml").is_file() and (root / "scripts").is_dir(): + if (root / "pyproject.toml").is_file() and (root / "research" / "scripts").is_dir(): return root raise FileNotFoundError("This launcher requires a source checkout; set RTP_CODEC_ROOT.") diff --git a/tests/test_anchored_tokenization.py b/src/tests/test_anchored_tokenization.py similarity index 100% rename from tests/test_anchored_tokenization.py rename to src/tests/test_anchored_tokenization.py diff --git a/tests/test_author_global_embeddings.py b/src/tests/test_author_global_embeddings.py similarity index 100% rename from tests/test_author_global_embeddings.py rename to src/tests/test_author_global_embeddings.py diff --git a/tests/test_data_anchor_factorial.py b/src/tests/test_data_anchor_factorial.py similarity index 100% rename from tests/test_data_anchor_factorial.py rename to src/tests/test_data_anchor_factorial.py diff --git a/tests/test_external_model_benchmark.py b/src/tests/test_external_model_benchmark.py similarity index 100% rename from tests/test_external_model_benchmark.py rename to src/tests/test_external_model_benchmark.py diff --git a/tests/test_external_residue_benchmark.py b/src/tests/test_external_residue_benchmark.py similarity index 100% rename from tests/test_external_residue_benchmark.py rename to src/tests/test_external_residue_benchmark.py diff --git a/tests/test_integration_compatibility.py b/src/tests/test_integration_compatibility.py similarity index 100% rename from tests/test_integration_compatibility.py rename to src/tests/test_integration_compatibility.py diff --git a/tests/test_latent_secondary.py b/src/tests/test_latent_secondary.py similarity index 100% rename from tests/test_latent_secondary.py rename to src/tests/test_latent_secondary.py diff --git a/tests/test_latent_sufficiency.py b/src/tests/test_latent_sufficiency.py similarity index 100% rename from tests/test_latent_sufficiency.py rename to src/tests/test_latent_sufficiency.py diff --git a/tests/test_multitask_baselines.py b/src/tests/test_multitask_baselines.py similarity index 96% rename from tests/test_multitask_baselines.py rename to src/tests/test_multitask_baselines.py index 2005687..5d400de 100644 --- a/tests/test_multitask_baselines.py +++ b/src/tests/test_multitask_baselines.py @@ -118,12 +118,12 @@ def test_tiny_locked_benchmark_trains_and_writes_terminal_artifacts(self): logging.shutdown() def test_phase1_configs_are_matched_except_condition_and_weights(self): - root = Path(__file__).resolve().parents[1] + root = Path(__file__).resolve().parents[2] r = json.loads( - (root / "configs/trb/rq1-char-r-seed42/experiment_config.json").read_text() + (root / "research/configs/trb/rq1-char-r-seed42/experiment_config.json").read_text() ) rtp = json.loads( - (root / "configs/trb/rq1-char-rtp-seed42/experiment_config.json").read_text() + (root / "research/configs/trb/rq1-char-rtp-seed42/experiment_config.json").read_text() ) for key in ( "base_git_revision", diff --git a/tests/test_multitask_pipeline.py b/src/tests/test_multitask_pipeline.py similarity index 100% rename from tests/test_multitask_pipeline.py rename to src/tests/test_multitask_pipeline.py diff --git a/tests/test_prepare_trb_joint.py b/src/tests/test_prepare_trb_joint.py similarity index 100% rename from tests/test_prepare_trb_joint.py rename to src/tests/test_prepare_trb_joint.py diff --git a/tests/test_public_inference.py b/src/tests/test_public_inference.py similarity index 97% rename from tests/test_public_inference.py rename to src/tests/test_public_inference.py index 75b578a..a5c14b5 100644 --- a/tests/test_public_inference.py +++ b/src/tests/test_public_inference.py @@ -65,8 +65,8 @@ def test_tsv_cli_writes_matrix_and_metadata(checkpoint, tmp_path): def test_paper_preset_accepts_explicit_overrides(): - root = Path(__file__).resolve().parents[1] - path = root / "configs/paper/rtp.json" + root = Path(__file__).resolve().parents[2] + path = root / "research/configs/paper/rtp.json" arguments = training_arguments(["--config", str(path), "--epochs", "1", "--device", "cpu"]) from rtp_codec.training.multitask import parse_args with patch("sys.argv", ["train", *arguments]): diff --git a/tests/test_single_aa_challenge.py b/src/tests/test_single_aa_challenge.py similarity index 100% rename from tests/test_single_aa_challenge.py rename to src/tests/test_single_aa_challenge.py diff --git a/tests/test_single_aa_evaluation.py b/src/tests/test_single_aa_evaluation.py similarity index 100% rename from tests/test_single_aa_evaluation.py rename to src/tests/test_single_aa_evaluation.py diff --git a/tests/test_tcremp_geometry_loss.py b/src/tests/test_tcremp_geometry_loss.py similarity index 100% rename from tests/test_tcremp_geometry_loss.py rename to src/tests/test_tcremp_geometry_loss.py diff --git a/tests/test_vdjdb_cohort.py b/src/tests/test_vdjdb_cohort.py similarity index 100% rename from tests/test_vdjdb_cohort.py rename to src/tests/test_vdjdb_cohort.py diff --git a/tests/test_vdjdb_epitope_prediction.py b/src/tests/test_vdjdb_epitope_prediction.py similarity index 100% rename from tests/test_vdjdb_epitope_prediction.py rename to src/tests/test_vdjdb_epitope_prediction.py diff --git a/tests/test_vdjdb_redcea_clonotypes.py b/src/tests/test_vdjdb_redcea_clonotypes.py similarity index 100% rename from tests/test_vdjdb_redcea_clonotypes.py rename to src/tests/test_vdjdb_redcea_clonotypes.py diff --git a/tests/test_vdjdb_redcea_evaluation.py b/src/tests/test_vdjdb_redcea_evaluation.py similarity index 100% rename from tests/test_vdjdb_redcea_evaluation.py rename to src/tests/test_vdjdb_redcea_evaluation.py diff --git a/tests/test_vdjdb_viral_motif_top10.py b/src/tests/test_vdjdb_viral_motif_top10.py similarity index 100% rename from tests/test_vdjdb_viral_motif_top10.py rename to src/tests/test_vdjdb_viral_motif_top10.py diff --git a/tests/test_vdjdb_ylq.py b/src/tests/test_vdjdb_ylq.py similarity index 100% rename from tests/test_vdjdb_ylq.py rename to src/tests/test_vdjdb_ylq.py diff --git a/tests/test_vdjdb_ylq_motif_pooled.py b/src/tests/test_vdjdb_ylq_motif_pooled.py similarity index 100% rename from tests/test_vdjdb_ylq_motif_pooled.py rename to src/tests/test_vdjdb_ylq_motif_pooled.py diff --git a/tests/test_wordpiece_sweep.py b/src/tests/test_wordpiece_sweep.py similarity index 100% rename from tests/test_wordpiece_sweep.py rename to src/tests/test_wordpiece_sweep.py