3.6.7
Class dealing with mass spectra and peak picking
(any
= defaultData
)
(object
= {}
)
This is a very intensive function so better to calculate it on a selection of peaks
Remove an integer number of time the specifiedd monoisotopic mass Mass remainder analysis (MARA): https://doi.org/10.1021/acs.analchem.7b04730
(any)
(any
= {}
)
Filter the array of peaks
(array)
array of all the peaks
(string)
Molecular formula of the parent molecule
(object
= {}
)
Name | Description |
---|---|
options.from number?
|
min X value of the window to consider |
options.to number?
|
max X value of the window to consider |
options.threshold number
(default 0.01 )
|
minimal intensity compare to base peak |
options.limit number
(default undefined )
|
maximal number of peaks (based on intensity) |
options.ionizations string?
|
|
options.precision number?
|
array
:
copy of peaks with 'close' annotation
Remove an integer number of time the specifiedd monoisotopic mass Mass remainder analysis (MARA): https://doi.org/10.1021/acs.analchem.7b04730
Type: number
(object
= {}
)
Name | Description |
---|---|
options.minCharge number
(default 1 )
|
|
options.maxCharge number
(default 10 )
|
|
options.similarity object
(default {} )
|
|
options.similarity.widthBottom number?
|
|
options.similarity.widthTop number?
|
|
options.similarity.widthFunction object?
|
function called with mass that should return an object width containing top and bottom |
options.similarity.zone object
(default {} )
|
|
options.similarity.zone.low number
(default -0.5 )
|
window shift based on observed monoisotopic mass |
options.similarity.zone.high number
(default 2.5 )
|
to value for the comparison window |
options.similarity.common string?
|
When a spectrum is continous ?
Filter the array of peaks
(any)
array
:
Filter the array of peaks
(array)
array of all the peaks
(object
= {}
)
Name | Description |
---|---|
options.from number?
|
min X value of the window to consider |
options.to number?
|
max X value of the window to consider |
options.threshold number
(default 0.01 )
|
minimal intensity compare to base peak |
options.limit number
(default undefined )
|
maximal number of peaks (based on intensity) |
options.sumValue number?
|
// if sumValue is defined, maxValue is ignored |
array
:
copy of peaks with 'close' annotation
Filter the array by taking the higher peaks and only
keep one per slot.
There are 2 different slots, the smallest one will have the
extra annotation close
to true
(array)
array of all the peaks
(object
= {}
)
Name | Description |
---|---|
options.from number?
|
min X value of the window to consider |
options.to number?
|
max X value of the window to consider |
options.searchMonoisotopicRatio number
(default 0 )
|
search previous peaks with at least ratio height |
options.limit number
(default 20 )
|
max number of peaks |
options.threshold number
(default 0.01 )
|
minimal intensity compare to base peak |
options.numberSlots number
(default 10 )
|
define the number of slots and indirectly the slot width |
options.numberCloseSlots number
(default 50 )
|
array
:
copy of peaks with 'close' annotation
Create a class that will be able to get the similarity between 2 spectra The similarity is based on 'cosine' similarity. The goal is 2 prepare 2 vectors on which the similarity is calculated. The vectors are created by taking the mass and the intensity of the peaks.
(object
= {}
)
Name | Description |
---|---|
options.nbPeaks number?
|
Before comparing spectra how many peaks should be kept |
options.minNbCommonPeaks number?
|
Minimum number of peaks in common to consider any similarity |
options.minIntensity number?
|
What is the minimal relative intensity to keep a peak |
options.massPower number
(default 3 )
|
High power will give more weight to the mass. If you would prefer to observe fragments you should use a number less than 1 |
options.intensityPower number
(default 0.6 )
|
How important is the intensity. By default we don't give to much importance to it |
options.selectedMasses Array<number>?
|
List of allowed masses. |
options.delta (number | Function)
(default 0.1 )
|
Tolerance in Da (u) to consider 2 peaks as aligned. If a function is provided it will be called with the mass of the peak |
Get the similarity between a spectrum and a list of masses. The main issue is that we don't have the intensity of the peaks. So we will use the intensity of the closest peak.
(any)
(any)
Returns the average of cosine distances between vectors a and b Copied from https://github.com/mljs/distance/blob/0b15acd6476413f4111cb4852ca1bec9edaa2805/src/similarities/cosine.ts
(any)
{import('cheminfo-types').NumberArray} - first vector
(any)
{import('cheminfo-types').NumberArray} - second vector
number
:
cosine similarity
(array)
(object
= {}
)
Name | Description |
---|---|
options.numberDigits number
(default 5 )
|
|
options.numberMFs number
(default 0 )
|
|
options.showMF boolean
(default false )
|
|
options.mfColors array
(default {} )
|
|
options.charge number
(default 1 )
|
|
options.shift number
(default 0 )
|
|
options.mfPrefs object?
|
|
options.displayCharge number
(default true )
|
|
options.displayProperties number
(default [] )
|
Array of properties name to display |
Promise
: