
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Provides an intermediate layer between mass spec data and ML applications, such as encoding.
Documentation site: https://jspaezp.github.io/ms2ml/main/
GitHub: https://github.com/jspaezp/ms2ml
This package is in early development, I am actively taking ideas and requests
The idea of this package is to have an intermeiate layer between the pyteomics package and ML applications.
Since ML applications do not take MS data as input directly, it is necessary to convert/encode it. This package is meant to handle that aspect.
This project is meant to be opinionated but not arbitrary. By that I mean that it should attempt to enforce the "better way" of doing things (not give flexibility to do everything every way) but all design decisions are open to discussion (ideally though github).
pip install ms2ml
from ms2ml.config import Config
from ms2ml.data.adapters import MSPAdapter
# From proteometools
my_file = "FTMS_HCD_20_annotated_2019-11-12.msp"
def post_hook(spec):
return {
"aa": spec.precursor_peptide.aa_to_onehot(),
"mods": spec.precursor_peptide.mod_to_vector(),
}
my_adapter = MSPAdapter(file=my_file, config=Config(), out_hook=post_hook)
bundled = my_adapter.bundle(my_adapter.parse())
print({k: f"{type(v): of shape: {v.shape}}" for k, v in bundled.items()})
# {'aa': "<class 'numpy.ndarray'>: of shape: (N, 42, 29)",
# 'mods': "<class 'numpy.ndarray'>: of shape: (N, 42)"}
(subject to change...)
[f(spec) for spec in file]
within reason._sample
static method that gives a sample of that object, and its docstring shoudl include an example on how to generate it.People who want to train ML models from peptide/proteomics data instead of figuring out ways to encode their tensors and write parsers.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryBorderColor': '#666666', 'primaryColor': '#ffffff', 'edgeLabelBackground':'#ffffff', 'tertiaryColor': '#666666'}}}%%
flowchart TB
raw["Raw Data: .raw"]
mzml["Converted Data: .mzML"]
pepxml["Searched Data: .pep.xml"]
pout["FDR controlled Data: .pep.xml .pout"]
speclib["Spectral library: .ms2 .blib .sptxt .msp"]
tensor["Encoded Spectra: np.array torch.tensor"]
tensorcache["Tensor Cache: .hdf5 .csv .feather"]
mlmodel["ML model: torch.nn.Module tf.keras.nn"]
randomscript["Self-implemented script .py .R"]
msconvert[MSConvert]
searchengine[Search Engine: comet,msfragger...]
fdrvalidator[FDR validator: peptideprophet, Percolator, Mokapot]
speclibbuilder[Spectral Library Builder]
ms2ml[MS2ML]
raw --> msconvert
msconvert --> mzml
raw --> searchengine
searchengine --> pepxml
mzml --> searchengine
pepxml --> fdrvalidator
fdrvalidator --> pout
pout --> speclibbuilder
speclibbuilder --> speclib
pout --> randomscript
randomscript --> tensor
speclib --> randomscript
tensor --> mlmodel
tensor --> tensorcache
tensorcache --> mlmodel
tensorcache --> randomscript
randomscript --> mlmodel
speclib --> ms2ml
ms2ml --> mlmodel
linkStyle 10,11,12,13,14,15,16 stroke:#db7093,stroke-width:5px;
linkStyle 17,18 stroke:#008000,stroke-width:5px;
style msconvert stroke:#00ffff,stroke-width:4px
style searchengine stroke:#00ffff,stroke-width:4px
style fdrvalidator stroke:#00ffff,stroke-width:4px
style speclibbuilder stroke:#00ffff,stroke-width:4px
style raw fill:#cccccc,stroke-width:2px
style mzml fill:#cccccc,stroke-width:2px
style pepxml fill:#cccccc,stroke-width:2px
style pout fill:#cccccc,stroke-width:2px
style speclib fill:#cccccc,stroke-width:2px
style ms2ml fill:#ee82ee,stroke:#b882ee,stroke-width:4px
When possible I will attempt to allow 'Proforma' based sequence annotations.
Check:
https://matchms.readthedocs.io/en/latest/:
https://gitlab.com/roettgerlab/ms2ai:
https://github.com/wilhelm-lab/dlomix
https://github.com/wfondrie/depthcharge
https://github.com/bittremieux/spectrum_utils
Right not this is a proof of concept package, I would be happy to make it something more stable if there is interest. Feel free to open an issue and we can discuss what you need out of it!! (and decide who can implement it)
FAQs
Provides an intermediate layer between mass spec data and ML applications, such as encoding.
We found that ms2ml demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.