Skip to main content

Python package for converting msp to database

Project description

Version Py versions Git Build Status (Travis) Build Status (AppVeyor) License RTD doc codecov

Python package to create an SQLite database from a collection of MSP mass spectromertry spectra files. Currently works with MSP files formated as MassBank records or as MoNA records.

The resulting SQLite database can be used for spectral matching with msPurity Bioconductor R package, see vigenette.


$ pip install .

Command line

$ msp2db --msp_pth [msp file or directory of msp files] --source [name of source of msp e.g. massbank] --out_pth [out dir]
$ msp2db --help

usage: PROG [-h] -m MSP_PTH -s SOURCE [-o OUT_PTH] [-t TYPE] [-d] [-l MSLEVEL]
        [-c CHUNK] [-x SCHEMA]

Convert msp to SQLite or MySQL database

optional arguments:
    -h, --help            show this help message and exit
    -m MSP_PTH, --msp_pth MSP_PTH
                            path to the MSP file (or directory of msp files)
    -s SOURCE, --source SOURCE
                            Name of data source (e.g. MassBank, LipidBlast)
    -o OUT_PTH, --out_pth OUT_PTH
                            file path for SQLite database
    -t TYPE, --db_type TYPE
                            database type [mysql, sqlite]
    -d, --delete_tables   delete tables
    -l MSLEVEL, --mslevel MSLEVEL
                            ms level of fragmentation if not detailed in msp file
    -c CHUNK, --chunk CHUNK
                            Chunks of spectra to parse data (useful to control
                            memory usage)
    -x SCHEMA, --schema SCHEMA
                            Type of schema used (by default is "mona" msp style
                            but can use "massbank" style)



db_pth = 'spectral_library_07112018v1.db'
create_db(file_pth=db_pth, db_type='sqlite', db_name='spectra')
libdata = LibraryData(msp_pth='MoNA-export-FAHFA.msp',

Developers & Contributors

Tom Lawson:


Released under the GNU General Public License v3.0 (see LICENSE file)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for msp2db, version 0.0.9
Filename, size File type Python version Upload date Hashes
Filename, size msp2db-0.0.9-py3-none-any.whl (31.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size msp2db-0.0.9.tar.gz (30.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page