Skip to content

Commit ed7a2b8

Browse files
committed
fix acs formater
Related to #65
1 parent 8029896 commit ed7a2b8

File tree

12 files changed

+34
-23
lines changed

12 files changed

+34
-23
lines changed

Diff for: src/NMR.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class NMR extends SD {
1919

2020
/**
2121
* This function creates a SD instance from the given 1D prediction
22-
* @param prediction
23-
* @param options
24-
* @returns {SD}
22+
* @param {Array} prediction
23+
* @param {object} options
24+
* @return {SD}
2525
*/
2626
static fromPrediction(prediction, options) {
2727
const spinSystem = simulator.SpinSystem.fromPrediction(prediction);

Diff for: src/NMR2D.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class NMR2D extends SD {
1616

1717
/**
1818
* This function creates a SD instance from the given 2D prediction
19-
* @param prediction
20-
* @param options
21-
* @returns {SD}
19+
* @param {Array} prediction
20+
* @param {object} options
21+
* @return {SD}
2222
*/
2323
static fromPrediction(prediction, options) {
2424
var data = simule2DNmrSpectrum(prediction, options);
@@ -58,8 +58,9 @@ class NMR2D extends SD {
5858
/**
5959
* This function creates a 2D spectrum from a matrix containing the independent values of the spectrum and a set
6060
* of options...
61-
* @param data
62-
* @param options
61+
* @param {Array} data
62+
* @param {object} options
63+
* @return {*}
6364
*/
6465
static fromMatrix(data, options) {
6566
var result = {};

Diff for: src/filters/rotate.js

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ function rotate(array, shift) {
4343
}
4444
}
4545
/**
46+
* Put a new value in the range
47+
* @param {number} value
48+
* @param {number} nbPoints
49+
* @return {*}
4650
* @private
4751
*/
4852
function putInRange(value, nbPoints) {

Diff for: src/jcampEncoder/JcampCreator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class JcampCreator {
2424
* @param {string} [options.encode = 'DIFDUP']
2525
* @param {number} [options.yFactor = 1]
2626
* @param {string} [options.type = 'SIMPLE']
27-
* @param {array} [options.keep = [] ]
27+
* @param {Array} [options.keep = [] ]
2828
* @return {string}
2929
*/
3030
convert(spectraData, options) {

Diff for: src/peakPicking/jAnalyzer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function getNextCombination(ranges, value) {
303303
/**
304304
* This function generates the possible values that each peak can contribute
305305
* to the multiplet.
306-
* @param {Array} Array of objects with peaks information {intensity}
306+
* @param {Array} peaks Array of objects with peaks information {intensity}
307307
* @return {{values: Array, currentIndex: Array, active: number}}
308308
*/
309309
function getRanges(peaks) {

Diff for: src/peakPicking/peakPicking.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @param {boolean} [options.optimize = true] - if it's true adjust an train of gaussian or lorentzian shapes to spectrum.
1616
* @param {string} [options.functionType = 'gaussian'] - This option allows us choose between 'gaussian' or 'lorentzian' function when options.optimize is true.
1717
* @param {number} [options.broadWidth = 0.25] - Threshold to determine if some peak is candidate to clustering into range.
18-
* @returns {Array}
18+
* @return {Array}
1919
*/
2020
const GSD = require('ml-gsd');
2121
//var extend = require("extend");
@@ -61,7 +61,7 @@ function extractPeaks(spectrum, optionsEx) {
6161
* this function remove the peaks with an intensity lower to threshold
6262
* @param {object} peakList - peaks
6363
* @param {number} threshold
64-
* @returns {object} the clean peakList
64+
* @return {object} the clean peakList
6565
* @private
6666
*/
6767
function clearList(peakList, threshold) {

Diff for: src/peakPicking/peakPicking2D.js

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function getZones(spectraData, thresholdFactor) {
5757
//Remove peaks with less than 3% of the intensity of the highest peak
5858
return createSignals2D(PeakOptimizer.clean(peaksMC1, 0.05), spectraData, 24);
5959
}
60-
6160
}
6261

6362

Diff for: src/range/Ranges.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class Ranges extends Array {
185185

186186
/**
187187
* This function return the peak list as a object with x and y arrays
188-
* @param {object} options - See the options parameter in {@link #peak2vector} function documentation
188+
* @param {bject} options - See the options parameter in {@link #peak2vector} function documentation
189189
* @return {object} - {x: Array, y: Array}
190190
*/
191191
getVector(options) {
@@ -224,7 +224,7 @@ class Ranges extends Array {
224224

225225
/**
226226
* Return an array of deltas and multiplicity for an index database
227-
* @options {Array} options
227+
* @param {object} options - options object for toIndex function
228228
* @return {Array} [{delta, multiplicity},...]
229229
*/
230230
toIndex(options) {

Diff for: src/range/acs/__tests__/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ describe('ACS tests: formating and parsing', function () {
1818
it('format ACS', function () {
1919
var inputRange = new Ranges(ranges);
2020
var acs = ACS(inputRange, {nbDecimal: 2, nucleus: '1H', frequencyObserved: 400, solvent: 'C6D6', format: 'IMJA'});
21-
acs.should.equal('<sup>1</sup>H NMR (C<sub>6</sub>D<sub>6</sub>, 400 MHz): δ 3.35 (1H, t, <i>J</i> = 4.5 Hz), 2.96 (3H, dd, <i>J</i> = 2.7, 9.2 Hz, COCH<sub>3</sub>), ' +
22-
'3.35 (3H, d, <i>J</i> = 5.2 Hz, CH<sub>3</sub>OH), 4.09-4.34 (3H, 4.23 (d, <i>J</i> = 5.2 Hz), 4.15 (t, <i>J</i> = 5.2, 5.5 Hz)), 4.80 (3H, d, <i>J</i> = 5.2 Hz, D<sub>2</sub>O), ' +
23-
'5.42-5.64 (3H, 5.46 (d, <i>J</i> = 5.2 Hz), 5.55 (dd, <i>J</i> = 5.2, 5.5 Hz)), 6.26-7.27 (8H, m).');
21+
acs.should.equal('<sup>1</sup>H NMR (C<sub>6</sub>D<sub>6</sub>, 400 MHz): δ 3.35 (1H, t, <i>J</i> = 4.5 Hz), 2.96 (3H, dd, <i>J</i> = 9.2, 2.7 Hz, COCH<sub>3</sub>), ' +
22+
'3.35 (3H, d, <i>J</i> = 5.2 Hz, CH<sub>3</sub>OH), 4.09-4.34 (3H, 4.23 (d, <i>J</i> = 5.2 Hz), 4.15 (t, <i>J</i> = 5.5, 5.2 Hz)), 4.80 (3H, d, <i>J</i> = 5.2 Hz, D<sub>2</sub>O), ' +
23+
'5.42-5.64 (3H, 5.46 (d, <i>J</i> = 5.2 Hz), 5.55 (dd, <i>J</i> = 5.5, 5.2 Hz)), 6.26-7.27 (8H, m).');
2424
});
2525
});

Diff for: src/range/acs/acs.js

+4
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ function formatAssignment(assignment) {
201201

202202
function pushCoupling(signal, parenthesis, options) {
203203
if (Array.isArray(signal.j) && signal.j.length > 0) {
204+
signal.j.sort(function (a, b) {
205+
return b.coupling - a.coupling;
206+
});
207+
204208
var values = [];
205209
for (let j of signal.j) {
206210
if (j.coupling !== undefined) {

Diff for: src/range/getMultiplicityFromSignal.js

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ function getMultiplicityFromSignal(signal) {
77
} else if (signal.multiplicity) {
88
multiplicity = signal.multiplicity;
99
} else if (Array.isArray(signal.j) && signal.j.length > 0) {
10+
signal.j.sort(function (a, b) {
11+
return b.coupling - a.coupling;
12+
});
1013
var couplings = signal.j;
1114
var addSpace = false;
1215
for (let coupling of couplings) {

Diff for: src/zone/Zones.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class Zones extends Array {
2121

2222
/**
2323
* This function return a Range instance from predictions
24-
* @param {Object} predictions - predictions of a spin system
25-
* @param {Object} options - options object
24+
* @param {object} predictions - predictions of a spin system
25+
* @param {object} options - options Object
2626
* @param {number} [options.lineWidth] - spectral line width
2727
* @param {number} [options.frequency] - frequency to determine the [from, to] of a range
28-
* @returns {Ranges}
28+
* @return {Ranges}
2929
*/
3030
static fromPrediction(predictions, options) {
3131
/*
@@ -109,8 +109,8 @@ class Zones extends Array {
109109
/**
110110
* This function return Ranges instance from a SD instance
111111
* @param {SD} spectrum - SD instance
112-
* @param {Object} opt - options object to extractPeaks function
113-
* @returns {Ranges}
112+
* @param {object} opt - options object to extractPeaks function
113+
* @return {Ranges}
114114
*/
115115
static fromSpectrum(spectrum, opt) {
116116
this.options = Object.assign({}, {}, opt);

0 commit comments

Comments
 (0)