nmr-processing
Advanced tools
Comparing version 0.8.0 to 0.9.0
# Changelog | ||
## [0.9.0](https://www.github.com/cheminfo/nmr-processing/compare/v0.8.0...v0.9.0) (2021-02-09) | ||
### Features | ||
* change nH to integrationSum ([#33](https://www.github.com/cheminfo/nmr-processing/issues/33)) ([801960a](https://www.github.com/cheminfo/nmr-processing/commit/801960a8fa765d3b3bbc9ec555496a9b505827e7)) | ||
## [0.8.0](https://www.github.com/cheminfo/nmr-processing/compare/v0.7.0...v0.8.0) (2021-02-09) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "nmr-processing", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,14 +7,2 @@ // import { Ranges } from 'spectra-data-ranges'; | ||
const defaultOptions = { | ||
nH: 100, | ||
clean: 0.5, | ||
thresholdFactor: 1, | ||
compile: true, | ||
integralType: 'sum', | ||
optimize: true, | ||
joinOverlapRanges: true, | ||
frequencyCluster: 16, | ||
keepPeaks: false, | ||
}; | ||
/** | ||
@@ -25,10 +13,10 @@ * This function clustering peaks and calculate the integral value for each range from the peak list returned from extractPeaks function. | ||
* @param {Object} [options={}] - options object with some parameter for GSD, detectSignal functions. | ||
* @param {Number} [options.integrationSum = 100] - Number of hydrogens or some number to normalize the integral data. If it's zero return the absolute integral value | ||
* @param {String} [options.integralType = 'sum'] - option to chose between approx area with peaks or the sum of the points of given range ('sum', 'peaks') | ||
* @param {Number} [options.frequencyCluster = 16] - distance limit to clustering peaks. | ||
* @param {Number} [options.integrationSum=100] - Number of hydrogens or some number to normalize the integral data. If it's zero return the absolute integral value | ||
* @param {String} [options.integralType='sum'] - option to chose between approx area with peaks or the sum of the points of given range ('sum', 'peaks') | ||
* @param {Number} [options.frequencyCluster=16] - distance limit to clustering peaks. | ||
* @param {Number} [options.clean=0.4] - If exits it remove all the signals with integration < clean value | ||
* @param {Boolean} [options.compile = true] - If true, the Janalyzer function is run over signals to compile the patterns. | ||
* @param {Boolean} [options.keepPeaks = false] - If true each signal will contain an array of peaks. | ||
* @param {String} [options.nucleus = '1H'] - Nucleus | ||
* @param {String} [options.frequency = 400] - Observed frequency | ||
* @param {Boolean} [options.compile=true] - If true, the Janalyzer function is run over signals to compile the patterns. | ||
* @param {Boolean} [options.keepPeaks=false] - If true each signal will contain an array of peaks. | ||
* @param {String} [options.nucleus='1H'] - Nucleus | ||
* @param {String} [options.frequency=400] - Observed frequency | ||
* @returns {Array} | ||
@@ -38,10 +26,28 @@ */ | ||
export function peaksToRanges(data, peakList, options = {}) { | ||
options = Object.assign({}, defaultOptions, options); | ||
let { | ||
integrationSum = 100, | ||
joinOverlapRanges, | ||
joinOverlapRanges = true, | ||
clean = 0.4, | ||
compile, | ||
compile = true, | ||
integralType = 'sum', | ||
frequency = 400, | ||
frequencyCluster = 16, | ||
keepPeaks = false, | ||
nucleus = '1H', | ||
} = options; | ||
let signals = detectSignals(data, peakList, options); | ||
let signalOptions = { | ||
integrationSum, | ||
integralType, | ||
frequencyCluster, | ||
frequency, | ||
nucleus, | ||
}; | ||
if (data.x[0] > data.x[1]) { | ||
data.x = data.x.reverse(); | ||
data.y = data.y.reverse(); | ||
} | ||
let signals = detectSignals(data, peakList, signalOptions); | ||
if (clean) { | ||
@@ -88,4 +94,4 @@ for (let i = 0; i < signals.length; i++) { | ||
} | ||
options.nH = Math.abs(nHi); | ||
let ranges = detectSignals(data, peaks1, options); | ||
signalOptions.integrationSum = Math.abs(nHi); | ||
let ranges = detectSignals(data, peaks1, signalOptions); | ||
@@ -138,3 +144,3 @@ for (let j = 0; j < ranges.length; j++) { | ||
}; | ||
if (options.keepPeaks) { | ||
if (keepPeaks) { | ||
ranges[i].signal[0].peak = signal.peaks; | ||
@@ -158,9 +164,11 @@ } | ||
* @param {object} data - spectra data | ||
* @param {object} peakList - nmr signals | ||
* @param {object} options | ||
* @param {...number} options.nH - Number of hydrogens or some number to normalize the integral data, If it's zero return the absolute integral value | ||
* @param {String} options.integralType - option to chose between approx area with peaks or the sum of the points of given range | ||
* @param {...number} options.frequencyCluster - distance limit to clustering the peaks. | ||
* @param {array} peakList - nmr signals | ||
* @param {object} [options = {}] | ||
* @param {number} [options.integrationSum='100'] - Number of hydrogens or some number to normalize the integration data, If it's zero return the absolute integral value | ||
* @param {string} [options.integralType='sum'] - option to chose between approx area with peaks or the sum of the points of given range | ||
* @param {number} [options.frequencyCluster=16] - distance limit to clustering the peaks. | ||
* range = frequencyCluster / observeFrequency -> Peaks withing this range are considered to belongs to the same signal1D | ||
* @return {Array} nmr signals | ||
* @param {string} [options.nucleus='1H'] - - Nucleus | ||
* @param {String} [options.frequency = 400] - Observed frequency | ||
* @return {array} nmr signals | ||
* @private | ||
@@ -170,3 +178,3 @@ */ | ||
let { | ||
nH = 100, | ||
integrationSum = 100, | ||
integralType = 'sum', | ||
@@ -255,4 +263,4 @@ frequencyCluster = 16, | ||
if (nH > 0) { | ||
let integralFactor = nH / spectrumIntegral; | ||
if (integrationSum > 0) { | ||
let integralFactor = integrationSum / spectrumIntegral; | ||
for (let i = 0; i < signals.length; i++) { | ||
@@ -259,0 +267,0 @@ let integral = signals[i].integralData; |
@@ -13,2 +13,3 @@ import { gsd, joinBroadPeaks, optimizePeaks } from 'ml-gsd'; | ||
* @param {number} [options.broadWidth = 0.25] - Threshold to determine if some peak is candidate to clustering into range. | ||
* @param {number} [options.thresholdFactor=3] - the factor that multiplies the noise level to set up a threshold to select peaks with respect to the intensity. | ||
* @param {number} [options.noiseLevel = median(data.y) * (options.thresholdFactor || 3)] - Noise threshold in spectrum y units. Default is three/thresholdFactor times the absolute median of data.y. | ||
@@ -21,3 +22,2 @@ * @param {number} [options.factorWidth = 4] - factor to determine the width at the moment to group the peaks in signals in 'GSD.optimizePeaks' function. | ||
* @param {object} [options.optimization.options = {}] - options for the specific kind of algorithm. | ||
* @param {Boolean} [options.compile = true] - If true, the Janalyzer function is run over signals to compile the patterns. | ||
* @param {Boolean} [options.smoothY = true] - Select the peak intensities from a smoothed version of the independent variables? | ||
@@ -24,0 +24,0 @@ * @param {Boolean} [options.optimize = true] - if it's true adjust an train of gaussian or lorentzian shapes to spectrum. |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259496
10497