bilalsm commited on
Commit
df370c5
·
0 Parent(s):

Super-squash branch 'main' using huggingface_hub

Browse files
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ SpectraVision-PeakViT filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-nd-4.0
3
+ tags:
4
+ - spectravision
5
+ - msms
6
+ - proteomics
7
+ - vision
8
+ ---
9
+
10
+ # SpectraVision
11
+ The paper is under review.
12
+
13
+ [[Github Repo](https://github.com/pcdslab/SpectraVision)] | [[Model Collection](https://huggingface.co/collections/SaeedLab/SpectraVision)] | [[Dataset](https://huggingface.co/datasets/SaeedLab/SpectraVision-Data)]
14
+
15
+ ## Abstract
16
+
17
+ Converting irregularly spaced mass spectrometry (MS/MS) data into computable representation is a foundational architectural choice that sets the upper bound for both computational efficiency and model accuracy. Existing MS/MS representations for machine-learning (ML) models can be divided into two parts: (1) fine-grained binned vectors that preserve spectra resolution but are sparse; (2) transformer-sequence encoders that can avoid sparse binning but must process variable-length inputs with continuous, shift-sensitive m/z coordinates. Critically, both strategies trade computational efficiency for representation quality, creating significant time and memory bottlenecks. In this paper, we present SpectraVision, which encodes MS/MS spectra into compact image-tensors, preserves high-resolution m/z information and supports efficient learning. Efficacy of these image-tensors to extract spatial features from the spectrum image is demonstrated with a CNN model and a Vision Transformer to validate the ability of image-tensors to preserve long-range spectral dependencies. Both CNN and ViT models then exhibit superior Top-k peptide-retrieval accuracy when compared with binned-Vector and transformer-sequence encoders. An added advantage of SpectraVision based models, necessary for training large models, is usage of 87% fewer parameters (~6.4M versus 51.8M) than binned-vector approach. Zero-shot evaluation on multiple species, non-tryptic peptides, and immunopeptides showcases the robustness of vision-based models to extend and improve ML models for MS-based proteomics.
18
+
19
+
20
+ ## Peptide retrieval search
21
+
22
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then clone the repository and search an MGF against a peptide FASTA:
23
+
24
+ ```bash
25
+ git clone https://github.com/pcdslab/SpectraVision.git
26
+ cd SpectraVision
27
+ uv sync
28
+ uv run python retrieval_search/run_search.py \
29
+ --mgf retrieval_search/sample_data/sample_data.mgf \
30
+ --fasta retrieval_search/sample_data/sample_fasta.fasta \
31
+ --output-dir outputs/search \
32
+ --ppm-tolerance 100 \
33
+ --download_weight=true
34
+ ```
35
+
36
+ The command downloads the default `SpectraVision-3C-CNN` safetensors weights and saves assigned peptides to `outputs/search/matches.csv`. The search considers peptides within 100 ppm of the spectrum's precursor m/z. Select another checkpoint with `--model SpectraVision-1C-CNN` or `--model SpectraVision-PeakViT`.
37
+
38
+ ## Cite
39
+ The paper is under review. As soon as it is accepted, we will update this section.
40
+
41
+ ## License
42
+
43
+ This model and associated code are released under the CC-BY-NC-ND 4.0 license and may only be used for non-commercial, academic research purposes with proper attribution. Any commercial use, sale, or other monetization of this model and its derivatives, which include models trained on outputs from the model or datasets created from the model, is prohibited and requires prior approval. Downloading the model requires prior registration on Hugging Face and agreeing to the terms of use. By downloading this model, you agree not to distribute, publish or reproduce a copy of the model. If another user within your organization wishes to use the model, they must register as an individual user and agree to comply with the terms of use. Users may not attempt to re-identify the deidentified data used to develop the underlying model. If you are a commercial entity, please contact the corresponding author.
44
+
45
+ ## Contact
46
+
47
+ For any additional questions or comments, contact Fahad Saeed (fsaeed@fiu.edu).
SpectraVision-1C-CNN.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:811b22547c347032c6654fb7208bcdef9813418b2dbdd79e6703e1c9b79e82ae
3
+ size 25697472
SpectraVision-3C-CNN.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfcc657f70b4f5ed1c8206ff0e3d27b251ab7e77ec43fe1cebbbc58b1b92f75a
3
+ size 25711528
SpectraVision-PeakViT.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06fd0eae52c8e4ca3667eb870ba503390d2e0890738e305338202411a79b055a
3
+ size 26879240
config.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "evaluation": {
3
+ "batch_size": 1024,
4
+ "num_workers": 8,
5
+ "device": "auto",
6
+ "forward_batch_size": 64,
7
+ "cuda_autocast": true,
8
+ "cudnn_enabled": true,
9
+ "cudnn_benchmark": true,
10
+ "cudnn_deterministic": false
11
+ },
12
+ "loss": {
13
+ "name": "multi_positive_info_nce_with_decoy",
14
+ "temperature": 0.07,
15
+ "threshold": 0.99,
16
+ "decoy_weight": 1.0
17
+ },
18
+ "models": {
19
+ "SpectraVision-1C-CNN": {
20
+ "encoding": "SpectraVision-1C",
21
+ "encoding_params": {
22
+ "max_mz": 5000,
23
+ "num_peaks": 200,
24
+ "bin_multiply_factor": 10
25
+ },
26
+ "model_params": {
27
+ "img_size": [224, 224]
28
+ },
29
+ "weights": "weights/SpectraVision-1C-CNN.safetensors"
30
+ },
31
+ "SpectraVision-3C-CNN": {
32
+ "encoding": "SpectraVision-3C",
33
+ "encoding_params": {
34
+ "max_mz": 5000,
35
+ "num_peaks": 200,
36
+ "bin_multiply_factor": 10
37
+ },
38
+ "model_params": {
39
+ "img_size": [224, 224]
40
+ },
41
+ "weights": "weights/SpectraVision-3C-CNN.safetensors"
42
+ },
43
+ "SpectraVision-PeakViT": {
44
+ "encoding": "SpectraVision-1C",
45
+ "encoding_params": {
46
+ "max_mz": 5000,
47
+ "num_peaks": 200,
48
+ "bin_multiply_factor": 10
49
+ },
50
+ "model_params": {
51
+ "img_size": [224, 224],
52
+ "patch_size": 16,
53
+ "in_channels": 1,
54
+ "d_model": 512,
55
+ "embedding_dim": 256,
56
+ "num_layers": 2,
57
+ "nhead": 8,
58
+ "position_encoding": "learned",
59
+ "mask_empty_patches": true,
60
+ "bin_multiply_factor": 10,
61
+ "max_mz": 5000,
62
+ "intensity_channel": 0,
63
+ "min_mz_wavelength": 0.2,
64
+ "max_mz_wavelength": 1000
65
+ },
66
+ "weights": "weights/SpectraVision-PeakViT.safetensors"
67
+ }
68
+ }
69
+ }