nmr-processing
Advanced tools
Comparing version 1.0.1 to 1.1.0
# Changelog | ||
## [1.1.0](https://www.github.com/cheminfo/nmr-processing/compare/v1.0.1...v1.1.0) (2021-04-02) | ||
### Features | ||
* splitSystem as independent function ([#53](https://www.github.com/cheminfo/nmr-processing/issues/53)) ([1054423](https://www.github.com/cheminfo/nmr-processing/commit/10544234125147b57e4171458ae5882c0d60c021)) | ||
### Bug Fixes | ||
* signalJoinCouplings assignment join ([2fce7cb](https://www.github.com/cheminfo/nmr-processing/commit/2fce7cb749d86dceccbddd355a66fcc2ac9b4a05)) | ||
### [1.0.1](https://www.github.com/cheminfo/nmr-processing/compare/v1.0.0...v1.0.1) (2021-03-24) | ||
@@ -4,0 +16,0 @@ |
{ | ||
"name": "nmr-processing", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -63,3 +63,3 @@ "main": "lib/index.js", | ||
"ml-gsd": "^6.6.1", | ||
"ml-hclust": "^3.0.0", | ||
"ml-hclust": "^1.3.0", | ||
"ml-levenberg-marquardt": "^3.1.1", | ||
@@ -72,3 +72,3 @@ "ml-matrix": "^6.7.0", | ||
"ml-sparse-matrix": "^2.1.0", | ||
"ml-spectra-processing": "^5.8.0", | ||
"ml-spectra-processing": "^5.9.0", | ||
"node-fetch": "^2.6.1", | ||
@@ -75,0 +75,0 @@ "openchemlib-utils": "^1.0.0", |
@@ -0,0 +0,0 @@ # nmr-processing |
@@ -0,0 +0,0 @@ export const couplingPatterns = [ |
@@ -0,0 +0,0 @@ // sources: |
@@ -0,0 +0,0 @@ /* eslint-disable camelcase */ |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { impurities } from '../constants/impurities'; |
@@ -0,0 +0,0 @@ // import { Ranges } from 'spectra-data-ranges'; |
@@ -0,0 +0,0 @@ import LM from 'ml-levenberg-marquardt'; |
@@ -0,0 +0,0 @@ export function getKernel(options = {}) { |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ export function joinRanges(ranges) { |
@@ -0,0 +0,0 @@ let diagonalError = 0.05; |
@@ -0,0 +0,0 @@ import FormData from 'form-data'; |
@@ -0,0 +0,0 @@ import { signalJoinCouplings } from '../signal/signalJoinCouplings'; |
import { couplingPatterns } from '../constants/couplingPatterns'; | ||
const getNbAssignments = (assignment) => | ||
Array.isArray(assignment) ? assignment.length : 1; | ||
const getArrayOfMembers = (assignment, key) => | ||
Array.isArray(assignment[key]) ? assignment[key] : [assignment[key]]; | ||
/** | ||
@@ -15,6 +21,6 @@ * Join couplings smaller than a define tolerance. | ||
signal = JSON.parse(JSON.stringify(signal)); | ||
let cont = couplings[0].assignment ? couplings[0].assignment.length : 1; | ||
let cont = getNbAssignments(couplings[0].assignment); | ||
let newNmrJs = []; | ||
let diaIDs = []; | ||
let atoms = []; | ||
let assignment = []; | ||
couplings.sort(function (a, b) { | ||
@@ -24,6 +30,6 @@ return b.coupling - a.coupling; | ||
if (couplings[0].diaID) { | ||
diaIDs = [couplings[0].diaID]; | ||
diaIDs = getArrayOfMembers(couplings[0], 'diaID'); | ||
} | ||
if (couplings[0].assignment) { | ||
atoms = [couplings[0].assignment]; | ||
assignment = getArrayOfMembers(couplings[0], 'assignment'); | ||
} | ||
@@ -34,8 +40,8 @@ for (let i = 0; i < couplings.length - 1; i++) { | ||
) { | ||
cont += couplings[i + 1].assignment | ||
? couplings[i + 1].assignment.length | ||
: 1; | ||
if (couplings[i + 1].diaID) diaIDs.push(couplings[i + 1].diaID); | ||
cont += getNbAssignments(couplings[i + 1].assignment); | ||
if (couplings[i + 1].diaID) { | ||
diaIDs.push(...getArrayOfMembers(couplings[i + 1], 'diaID')); | ||
} | ||
if (couplings[i + 1].assignment) { | ||
atoms.push(couplings[i + 1].assignment); | ||
assignment.push(...getArrayOfMembers(couplings[i + 1], 'assignment')); | ||
} | ||
@@ -50,4 +56,4 @@ } else { | ||
} | ||
if (atoms.length > 0) { | ||
jTemp.assignment = atoms; | ||
if (assignment.length > 0) { | ||
jTemp.assignment = assignment; | ||
} | ||
@@ -58,12 +64,11 @@ | ||
if (couplings[i + 1].diaID) { | ||
diaIDs = [couplings[i + 1].diaID]; | ||
diaIDs = getArrayOfMembers(couplings[i + 1], 'diaID'); | ||
} | ||
if (couplings[i + 1].assignment) { | ||
atoms = [couplings[i + 1].assignment]; | ||
assignment = getArrayOfMembers(couplings[i + 1], 'assignment'); | ||
} | ||
cont = couplings[i + 1].assignment | ||
? couplings[i + 1].assignment.length | ||
: 1; | ||
cont = getNbAssignments(couplings[i + 1].assignment); | ||
} | ||
} | ||
let jTemp = { | ||
@@ -76,4 +81,4 @@ coupling: Math.abs(couplings[couplings.length - 1].coupling), | ||
} | ||
if (atoms.length > 0) { | ||
jTemp.assignment = atoms; | ||
if (assignment.length > 0) { | ||
jTemp.assignment = assignment; | ||
} | ||
@@ -84,3 +89,4 @@ newNmrJs.push(jTemp); | ||
} | ||
return signal; | ||
} |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ export function signalsToRanges(signals, options = {}) { |
@@ -5,2 +5,3 @@ import rescale from 'ml-array-rescale'; | ||
import simulate1D from './simulation/simulate1D'; | ||
import { splitSpinSystem } from './simulation/splitSpinSystem'; | ||
@@ -32,4 +33,9 @@ /** | ||
let spinSystem = signalsToSpinSystem(signals, { frequency, maxClusterSize }); | ||
let spinSystem = signalsToSpinSystem(signals); | ||
spinSystem.clusters = splitSpinSystem(spinSystem, { | ||
frequency, | ||
maxClusterSize, | ||
}); | ||
let spectrum = simulate1D(spinSystem, { | ||
@@ -36,0 +42,0 @@ frequency, |
@@ -0,0 +0,0 @@ import { SparseMatrix } from 'ml-sparse-matrix'; |
import Matrix from 'ml-matrix'; | ||
import simpleClustering from 'ml-simple-clustering'; | ||
import { ensureClusterSize } from './ensureClusterSize'; | ||
export function signalsToSpinSystem(signals, options = {}) { | ||
let { frequency = 400, maxClusterSize = 8 } = options; | ||
export function signalsToSpinSystem(signals) { | ||
const nSpins = signals.length; | ||
@@ -46,3 +43,3 @@ const chemicalShifts = new Array(nSpins); | ||
let spinSystem = { | ||
return { | ||
clusters, | ||
@@ -54,9 +51,2 @@ couplingConstants, | ||
}; | ||
spinSystem.clusters = ensureClusterSize(spinSystem, { | ||
frequency, | ||
maxClusterSize, | ||
}); | ||
return spinSystem; | ||
} |
@@ -42,2 +42,3 @@ import binarySearch from 'binary-search'; | ||
let peakWidth = lineWidth / frequencyMHz; | ||
shapeOptions.peakWidthFct = () => peakWidth; | ||
@@ -44,0 +45,0 @@ let spectrumGenerator = new SpectrumGenerator(shapeOptions); |
@@ -0,0 +0,0 @@ import { gsd, joinBroadPeaks, optimizePeaks } from 'ml-gsd'; |
@@ -0,0 +0,0 @@ import { peaksFilterImpurities } from '../peaks/peaksFilterImpurities'; |
@@ -0,0 +0,0 @@ import { Matrix } from 'ml-matrix'; |
@@ -0,0 +0,0 @@ import assignDeep from 'assign-deep'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
317691
+ Addedml-distance-euclidean@1.0.0(transitive)
+ Addedml-distance-matrix@1.0.0(transitive)
+ Addedml-hclust@1.3.0(transitive)
- Removedml-distance-euclidean@2.0.0(transitive)
- Removedml-distance-matrix@2.0.1(transitive)
- Removedml-hclust@3.1.0(transitive)
Updatedml-hclust@^1.3.0
Updatedml-spectra-processing@^5.9.0