Test the similarity with predictions for many experiments and return data computed on the matchIndexes
(string)
path to the experiments JSON file
(string)
path to the predictions JSON file
(object
= {})
| Name | Description |
|---|---|
options.numExperiments number
(default undefined)
|
Number of experiments for which the similarity should be computed (
slice
of the input experimental data). Should be
undefined
if all data must be used.
|
options.loadData object
(default {})
|
|
options.loadData.mergeSpan number
(default 0.05)
|
How close consecutive x values of a spectrum must be to be merged |
options.loadData.pathType string
(default "relative")
|
Allows to define wether the path to the JSON is "relative" or "absolute" |
options.loadData.norm bool
(default true)
|
If
true
, the spectra data are normalized before merging too close x values.
|
options.numberMaxPeaks number
(default undefined)
|
If not undefined, defines the number of max. intensity peaks to keep. This removes some of the spectrum noise. |
options.similarity object
(default {})
|
|
options.similarity.algorithm function
(default intersection)
|
Algorithm used to calculate the similarity between the spectra. Default is cosine similarity. |
options.similarity.alignDelta number
(default 0.05)
|
Two values of a experiment and prediction which difference is smaller than
alignDelta
will be put in the same X slot (considered as common).
|
options.similarity.minCommon number
(default 6)
|
Minimal number of values that must remain in the spectra after alignment. |
options.similarity.norm bool
(default false)
|
If
true
, the spectra data are normalized before being sent to the similarity algorithm.
|
options.similarity.massWeight function
(default defaultMassWeight)
|
Function that weights a y value by a function of x. |
options.bestMatch object
(default {})
|
|
options.bestMatch.threshold number
(default 0)
|
Similarity threshold for predicted spectra to be returned |
options.bestMatch.numberBestMatch number
(default 10)
|
Number of best matching predicted spectra to return in the result (
NaN
to return all)
|
options.bestMatch.massFilter number
(default 0.05)
|
If defined, the predictions are filtered based on PEPMASS before computing any similarity. If the mass difference is over
massFilter
,
similarity
and
common
are set to 0.
|
Stats:
Stats computed on the array of matchIndex
Keeps options.numberMaxPeaks values of each spectrum with highest intensities
(Data)
Parsed json containing spectra to filter
Data:
Input data with spectra filtered
Makes a weighted merge of the x values of each spectrum too close to each other using ml-array-xy-weighted-merge
(Data)
Parsed json containing spectra to merge
Data:
Input data with X values of spectra merged
Default function used to weight the experimental and predicted spectra: y=y*x^3. The y values are a function of the x values.
number:
weighted y value
Type: object
Returns a structure with the predicted spectra the most similar to an experimental spectrum
(Entry)
Experimental spectrum
(Data)
Predicted spectra database
(object
= {})
| Name | Description |
|---|---|
options.massFilter number
(default 0.05)
|
If defined, the predictions are filtered based on PEPMASS before computing any similarity. If the mass difference is over
massFilter
,
similarity
and
common
are set to 0.
|
options.threshold number
(default 0)
|
Similarity threshold for predicted spectra to be returned |
options.numberBestMatch number
(default 10)
|
Number of best matching predicted spectra to return in the result (
undefined
to return all)
|
(object
= {})
| Name | Description |
|---|---|
similarity.algorithm function
(default intersection)
|
Algorithm used to calculate the similarity between the spectra. Default is cosine similarity. |
similarity.alignDelta number
(default 0.05)
|
Two values of a experiment and prediction which difference is smaller than
alignDelta
will be put in the same X slot (considered as common).
|
similarity.minCommon number
(default 6)
|
Minimal number of values that must remain in the spectra after alignment. |
similarity.norm bool
(default false)
|
If
true
, the spectra data are normalized before being sent to the similarity algorithm.
|
similarity.massWeight function
(default defaultMassWeight)
|
Function that weights a y value by a function of x. |
Result:
Best matching predicted spectra and meta information
Loads, parses a JSON file. Then makes a weighted merge of the x values of each spectrum too close to each other using ml-array-xy-weighted-merge
(string)
Relative path to json file
(object
= {})
| Name | Description |
|---|---|
options.numberMaxPeaks number
(default 30)
|
If not undefined, defines the number of max. intensity peaks to keep. This removes some of the spectrum noise. |
options.mergeSpan number
(default 0.05)
|
How close consecutive x values of a spectrum must be to be merged |
options.pathType string
(default "relative")
|
Allows to define wether the path to the JSON is "relative" or "absolute" |
options.norm bool
(default true)
|
If
true
, the spectra data are normalized before merging too close x values.
|
Data:
Data loaded, parsed and merged
Type: Object
Type: Object
(Entry)
: The experiment data
(number)
: The index of the correct match for exp in matches. It is
NaN
if the similarity between the experiment and its correct match is zero.
(number)
: Number of values considered common between exp and its correct math by the align algorith
(number)
: Number of exp/pred couples that have sufficient common values after aligning (default less than 6)
Returns the similarity between two spectra
(Entry)
First spectrum
(Entry)
Second spectrum
(object
= {})
| Name | Description |
|---|---|
options.algorithm function
(default intersection)
|
Algorithm used to calculate the similarity between the spectra. Default is cosine similarity. |
options.alignDelta number
(default 0.05)
|
Two values of a experiment and prediction which difference is smaller than
alignDelta
will be put in the same X slot (considered as common).
|
options.minCommon number
(default 6)
|
Minimal number of values that must remain in the spectra after alignment. |
options.norm bool
(default false)
|
If
true
, the spectra data are normalized before being sent to the similarity algorithm.
|
options.massWeight function
(default defaultMassWeight)
|
Function that weights a y value by a function of x. |
SimStats:
Information on the similarity between the 2 spectra
Type: object
Type: object
Type: object