Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js_mzml

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js_mzml

An mzML parser

  • 1.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by16.67%
Maintainers
1
Weekly downloads
 
Created
Source

js-mzml

js-mzML is a node module for parsing mzML files used in mass spectrometry.

This module is based off of cheminfo-js/mzML found here, but some changes have been made. Notably:

  • Both 32-bit and 64-bit compression is supported
  • With or without zlib compression is supported
  • The MS level can be specified
  • The beginning and ending retention time can be specified

General information on how to decode mzML files also comes from here.

Usage

js-mzML is installed with npm install -s js-mzml

To use:

var jsmzml = require('js-mzml');

filename = 'your-file-name-here.mzML';
var mzml = new jsmzml(filename);

var options = {
    'level': 'Both',
    'rtBegin': 0,
    'rtEnd': 0.005
};

var spectra = mzml.retrieve(options, function() {
    console.log(mzml.spectra);
});

The spectra will be of this form:

 {'1':
    {
        id: 'controllerType=0 controllerNumber=1 scan=1',
        msLevel: '1',
        time: 0.004935,
        mass:
            Float32Array [
                data ...
            ],
        intensity:
            Float32Array [
                data ...
            ]
    }
}

There is also an example.js that you can modify to test things out.

js-mzML uses file streams under the hood which means that it is memory efficient and asynchronous-ish. Each js-mzML object has two variables associated with it, spectra (as discussed above) and isFinished. The variable isFinished changes to false when the retrive method is called. This value will change to true once the file stream is finished and then the callback will be called.

Options

The options that can be passed to js-mzML are:

  • level: Either '1', '2', or 'Both'. '1' gives you MS data, '2' gives you MS/MS data, and 'Both' gives you both types. The default is 'Both'.
  • rtBegin: This is the earliest retention time you want to return data from. The default is 0.
  • rtEnd: This is the latest retention time you want to return data from. The default is 9999999999.

There is currently to way to declare the units of the retention time, so you will have to make sure those match the units of the files you are processing.

Development

Tests can be run with npm run test There are spectra in the test folder from http://psidev.info/index.php?q=node/257

No breaking changes are expected in future versions, but this module was created to be part of a larger project, so changes may occur.

Future Development

  • Ability to specify minutes/seconds for retention time
  • More MS levels (e.g. MS/MS/MS)
  • Returning the data using a generator function (my knowledge is lacking as to how to do this in an async function so this is on hold indefinitely)

Keywords

FAQs

Package last updated on 08 Jun 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc