peptide-spectrum-match v2.1.0
peptide-spectrum-match
This is a helper class for dealing with peptide spectrum matches. It is essentially a template for an object with a few useful functions thrown in.
This module is still a work in progress. The idea is for this class to be a standard way of dealing with PSMs from X! tandem, mzIdentML, pepXML, and csv files. Anything is subject to change while all the various parsers are written, but things should be in a fairly stable state from here on out.
Rather than try to choose which score should be reported as the score and which as the expect value, I am adding in fields for all the various types of scores (hyperscore, xcorr, etc.). Not all of them are added in yet and the example below is out of date. Don't build anything that depends on the structure of this class yet.
Usage
Quickstart
var peptideSpectrumMatch = require('peptide-spectrum-match');
let psm = {
'sequence': 'ELVISLIVESK',
'sequence_pre': 'R',
'sequence_post': 'L',
'missed_cleavages': 0,
'protein': 'Unknown protein',
'charge': 2,
'retention_time': 5.0,
'precursor_mass': 1228.73,
'mass_err': 0.0022,
'theoretical_mass': 1228.7278,
'modifications': [{'residue':'S', 'position':4, 'mass':23.1}],
'filename': 'spectra.mgf',
'scan_title': '3.3.1',
'scan_id': '3',
'score': 78.6,
'expect': 3e-10,
'is_decoy': false,
'rank': 1,
'search_engine': 'tandem'
};
var psmObj = new peptideSpectrumMatch(psm);If you want to save your PSMs as a csv, there are a couple helper functions to do so.
getHeader(delimiter=",")
This function will return a header string for a csv file with the specified delimiter. The returned string does not have a newline character at the end of it.
getDelimited(delimiter=",")
This function will return all the fields of the peptide-spectrum-match object as a delimited string. The values will be in the same order as what is indicated by the header. Once again there is no newline character at the end of the string.
The fields of each peptide-spectrum-match object are:
sequencewhich is the sequence of the matched peptidesequence_prewhich is the residue immediately before thesequencesequence_postwhich is the residue immediately after thesequencemissed_cleavagesis the reported number of missed cleavagesproteinis the FASTA entry against which this spectrum was matchedchargeis the charge of the spectrumretention_timeis the retention time in minutesprecursor_massis the observed precursor neutral massmass_erris the deviation of the observed mass from the theoretical. It is the precursor_mass - theoretical_masstheoretical_massis the calculated neutral mass of the peptidemodificationsis a list of objects which specify theresidue,position(0-based), andmassof the modificationfilenameis the filename of the file from which the spectrum camescan_titleis the title of the spectrumscan_idis the ID of the spectrumscoreis the score assigned by the search engineexpectis the expectation value assigned by the search engineis_decoyis a boolean specifying whether or not the match is to a decoy sequencerankis the rank of the matchsearch_engineis the name of the engine used to make the match
Tests
You can run npm test to run the tests after installing the development dependencies.
Future functionality
The name may be added in to the entries of the modifications array once a method is developed for handling cases where the modification doesn't come with a name.
License
This software is released under the MIT license.
