npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js_mzml

v1.1.5

Published

An mzML parser

Downloads

9

Readme

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)

Support this project!

Support this project on Patreon!