nmr-processing
Advanced tools
Comparing version 1.3.0 to 1.4.0
# Changelog | ||
## [1.4.0](https://www.github.com/cheminfo/nmr-processing/compare/v1.3.0...v1.4.0) (2021-05-18) | ||
### Features | ||
* add multiplicity when join signals from prediction ([#61](https://www.github.com/cheminfo/nmr-processing/issues/61)) ([e938688](https://www.github.com/cheminfo/nmr-processing/commit/e938688fe6fceaea725b129b602602a7eab37695)) | ||
* add san plot as an option to determine the noise level of 1D spectrum. ([#59](https://www.github.com/cheminfo/nmr-processing/issues/59)) ([0f20e1f](https://www.github.com/cheminfo/nmr-processing/commit/0f20e1f50824747c76f96c832bbb6c89888c7750)) | ||
## [1.3.0](https://www.github.com/cheminfo/nmr-processing/compare/v1.2.0...v1.3.0) (2021-05-11) | ||
@@ -4,0 +12,0 @@ |
{ | ||
"name": "nmr-processing", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "", | ||
@@ -16,2 +16,4 @@ "main": "lib/index.js", | ||
"prepublishOnly": "rollup -c", | ||
"prettier": "prettier --check src", | ||
"prettier-write": "prettier --write src", | ||
"test": "npm run test-coverage && npm run eslint", | ||
@@ -18,0 +20,0 @@ "test-coverage": "jest --coverage", |
@@ -71,7 +71,13 @@ import mean from 'ml-array-mean'; | ||
newSignals = newSignals | ||
.map((signal) => | ||
signalNormalize(signalJoinCouplings(signal, { tolerance })), | ||
) | ||
.map((signal) => { | ||
signal = signalNormalize(signalJoinCouplings(signal, { tolerance })); | ||
if (signal.j) { | ||
signal.multiplicity = signal.j.reduce((multiplicity, jCoupling) => { | ||
return `${multiplicity}${jCoupling.multiplicity}`; | ||
}, ''); | ||
} | ||
return signal; | ||
}) | ||
.sort((a, b) => a.delta - b.delta); | ||
return newSignals; | ||
} |
import { gsd, joinBroadPeaks, optimizePeaks } from 'ml-gsd'; | ||
import { xAbsoluteMedian, xyExtract } from 'ml-spectra-processing'; | ||
import { | ||
xyExtract, | ||
xNoiseSanPlot, | ||
xAbsoluteMedian, | ||
} from 'ml-spectra-processing'; | ||
/** | ||
@@ -30,4 +34,7 @@ * Implementation of the peak picking method described by Cobas in: | ||
to, | ||
minMaxRatio = 0.01, | ||
noiseLevel, | ||
thresholdFactor = 3, | ||
minMaxRatio = 0.05, | ||
broadRatio = 0.00025, | ||
useSanPlot = false, | ||
smoothY = true, | ||
@@ -41,3 +48,2 @@ optimize = false, | ||
lookNegative = false, | ||
noiseLevel = xAbsoluteMedian(data.y) * (options.thresholdFactor || 3), | ||
sgOptions = { windowSize: 9, polynomial: 3 }, | ||
@@ -50,2 +56,4 @@ } = options; | ||
const cutOff = getCutOff(data.y, { noiseLevel, useSanPlot, thresholdFactor }); | ||
let getPeakOptions = { | ||
@@ -59,3 +67,3 @@ shape, | ||
broadRatio, | ||
noiseLevel, | ||
noiseLevel: cutOff.positive, | ||
smoothY, | ||
@@ -66,6 +74,10 @@ optimization, | ||
let result = getPeakList(data, getPeakOptions); | ||
return lookNegative | ||
? result.concat(getNegativePeaks(data, getPeakOptions)) | ||
: result; | ||
let peaks = getPeakList(data, getPeakOptions); | ||
if (lookNegative) { | ||
getPeakOptions.noiseLevel = cutOff.negative; | ||
peaks.push(...getNegativePeaks(data, getPeakOptions)); | ||
} | ||
return peaks; | ||
} | ||
@@ -130,1 +142,18 @@ | ||
} | ||
function getCutOff(data, options = {}) { | ||
const { noiseLevel, useSanPlot, thresholdFactor } = options; | ||
const formatResult = (noiseLevel) => | ||
typeof noiseLevel === 'number' | ||
? { positive: noiseLevel, negative: -noiseLevel } | ||
: noiseLevel; | ||
if (noiseLevel) { | ||
return formatResult(noiseLevel); | ||
} else { | ||
return useSanPlot | ||
? xNoiseSanPlot(data, { factorStd: thresholdFactor }) | ||
: formatResult(xAbsoluteMedian(data) * thresholdFactor); | ||
} | ||
} |
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
330188
12361