| title | emoji | colorFrom | colorTo | sdk | app_file | pinned | short_description | python_version |
|---|---|---|---|---|---|---|---|---|
MVP |
🏆 |
blue |
pink |
streamlit |
app.py |
false |
msms annotation tool |
3.11.7 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
This repository provides the implementation of MultiView Projection (MVP). MVP can be used to rank a set of molecular candidates given a spectrum.
- [Install & setup]
- [Data prep]
- [MassSpecGym data download]
- [Use our pretrained model]
- [Training from scratch]
- [References]
- Clone the repository: git clone <REPO_link>
- Install evironment or only key packages:
conda env create -f environment.yml
- python
- dgl
- pytorch
- rdkit
- pytorch-geometric
- numpy
- scikit-learn
- scipy
- massspecgym
- lightning
We provide sample spectra data and candidates in data/sample.
For preprocessing:
- If using formSpec, compute subformula labels
- Run our preprocess code to obatain fingerprints and consensus spectra files
# If using formSpec
python subformula_assign/assign_subformulae.py --spec-files ../data/sample/data.tsv --output-dir ../data/sample/subformulae_default --max-formulae 60 --labels-file ../data/sample/data.tsv
python data_preprocess.py --spec_type formSpec --dataset_pth ../data/sample/data.tsv --candidates_pth ../data/sample/candidates_mass.json --subformula_dir_pth ../data/sample/subformulae_default/ --output_dir ../data/sample/
# If using binnedSpec
python data_preprocess.py --spec_type binnedSpec --dataset_pth ../data/sample/data.tsv --candidates_pth ../data/sample/candidates_mass.json --output_dir ../data/sample/
We include sample subformula, fingerprint, and consensus spectra data in ../data/sample/.
You can use our pretrained model (on MassSpecGym) to rank molecular candidates by providing the spectra data and a list of candidates.
After prepping your data, modify the params_binnedSpec.yaml or params_formSpec.yaml with your dataset paths:
# If using formSpec
python test.py --param_pth params_formSpec.yaml
# If using binnedSpec
python test.py --param_pth params_binnedSpec.yaml
We provide a notebook showing sample result files in notebooks/demo.ipynb
Our model is trained on MassSpecGym dataset. Follow their instruction to download the spectra and candidate dataset.
You can preprocess the MassSpecGym dataset as descirbed in the above section or download the preprocessed files as follows:
mkdir data/msgym/
cd data/msgym
wget
wget
To train a model from scratch:
- Prepare data as described in the data prep section
- Modify the configuration in params file as necessary
- Train using the following
# If using formSpec
python train.py --param_pth params_formSpec.yaml
# If using binnedSpec
python train.py --param_pth params_binnedSpec.yaml