diff --git a/dist/components/multi_jcamps_viewer.js b/dist/components/multi_jcamps_viewer.js index 66619a9b..25b34668 100644 --- a/dist/components/multi_jcamps_viewer.js +++ b/dist/components/multi_jcamps_viewer.js @@ -56,7 +56,8 @@ class MultiJcampsViewer extends _react.default.Component { operations, entityFileNames, entities, - userManualLink + userManualLink, + molSvg } = this.props; if (!entities || entities.length === 0) return /*#__PURE__*/_react.default.createElement("div", null); const seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit'); @@ -66,8 +67,7 @@ class MultiJcampsViewer extends _react.default.Component { const entity = entities[curveIdx]; const { feature, - topic, - molSvg + topic } = entity; return /*#__PURE__*/_react.default.createElement("div", { className: classes.root diff --git a/dist/components/panel/cyclic_voltamery_data.js b/dist/components/panel/cyclic_voltamery_data.js index e121cd1c..f02c351d 100644 --- a/dist/components/panel/cyclic_voltamery_data.js +++ b/dist/components/panel/cyclic_voltamery_data.js @@ -137,18 +137,18 @@ const CyclicVoltammetryPanel = _ref => { } }; const getDelta = data => { - return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x).toFixed(5) : 'undefined'; + return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x).toFixed(3) : 'undefined'; }; const getRatio = (feature, data) => { const featureData = feature.data[0]; const idx = featureData.x.indexOf(feature.maxX); const y_pecker = data.pecker ? data.pecker.y : featureData.y[idx]; - return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(5) : 'undefined'; + return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(3) : 'undefined'; }; const rows = list.map((o, idx) => ({ idx, - max: o.max ? `x:${parseFloat(o.max.x)}, y:${parseFloat(o.max.y).toExponential(2)}` : 'undefined', - min: o.min ? `x:${parseFloat(o.min.x)}, y:${parseFloat(o.min.y).toExponential(2)}` : 'undefined', + max: o.max ? `x:${parseFloat(o.max.x).toFixed(3)}, y:${parseFloat(o.max.y).toExponential(2)}` : 'undefined', + min: o.min ? `x:${parseFloat(o.min.x).toFixed(3)}, y:${parseFloat(o.min.y).toExponential(2)}` : 'undefined', pecker: o.pecker ? `${parseFloat(o.pecker.y).toExponential(2)}` : 'undefined', delta: getDelta(o), ratio: getRatio(feature, o), diff --git a/dist/constants/list_shift.js b/dist/constants/list_shift.js index 43490507..900d66ab 100644 --- a/dist/constants/list_shift.js +++ b/dist/constants/list_shift.js @@ -24,37 +24,37 @@ const cActicAcidD4S = { }; const cAcetoneD6Sep = { name: 'Acetone-d6 (sep)', - value: 29.920, + value: 29.640, label: 'Acetone-d6', nsdb: 'Acetone-D6 ((CD3)2CO)' }; const cAcetoneD6Broad = { name: 'Acetone-d6 (broad)', - value: 206.68, + value: 206.260, label: 'Acetone-d6', nsdb: 'Acetone-D6 ((CD3)2CO)' }; const cAcetonitrileD3Sep = { name: 'Acetonitrile-d3 (sep)', - value: 1.39, + value: 1.32, label: 'Acetonitrile-d3', nsdb: 'Acetonitrile-D3(CD3CN)' }; const cAcetonitrileD3S = { name: 'Acetonitrile-d3 (s)', - value: 118.69, + value: 118.26, label: 'Acetonitrile-d3', nsdb: 'Acetonitrile-D3(CD3CN)' }; const cBenzeneT = { name: 'Benzene (t)', - value: 128.390, + value: 128.060, label: 'Benzene-d6', nsdb: 'Benzene-D6 (C6D6)' }; const cChloroformDT = { name: 'Chloroform-d (t)', - value: 77.00, + value: 77.16, label: 'CDCl$3', nsdb: 'Chloroform-D1 (CDCl3)' }; @@ -65,7 +65,7 @@ const cCyclohexaneD12Quin = { }; const cDichloromethaneD2Quin = { name: 'Dichloromethane-d2 (quin)', - value: 54.0, + value: 53.84, label: 'CD$2Cl$2' }; const cDmfD7Sep1 = { @@ -90,7 +90,7 @@ const cDioxaneD8Quin = { }; const cDmsoD6 = { name: 'DMSO-d6', - value: 39.51, + value: 39.52, label: 'DMSO-d6', nsdb: 'Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)' }; @@ -106,7 +106,7 @@ const cEthanolD6Quin = { }; const cMethanolD4Sep = { name: 'Methanol-d4 (sep)', - value: 49.15, + value: 49.00, label: 'Methanol-d4', nsdb: 'Methanol-D4 (CD3OD)' }; @@ -182,15 +182,35 @@ const cTfaDQ2 = { }; const cTrifluoroethanolD3Quin = { name: 'Trifluoroethanol-d3 (quin)', - value: 61.50, + value: 61.80, label: 'Trifluoroethanol-d3' }; const cTrifluoroethanolD3Broad = { name: 'Trifluoroethanol-d3 (broad)', - value: 126.3, + value: 126.28, label: 'Trifluoroethanol-d3' }; -const LIST_SHIFT_13C = [noReference, cActicAcidD4Sept, cActicAcidD4S, cAcetoneD6Sep, cAcetoneD6Broad, cAcetonitrileD3Sep, cAcetonitrileD3S, cBenzeneT, cChloroformDT, cCyclohexaneD12Quin, cDichloromethaneD2Quin, cDmfD7Sep1, cDmfD7Sep2, cDmfD7T3, cDioxaneD8Quin, cDmsoD6, cEthanolD6Sep, cEthanolD6Quin, cMethanolD4Sep, cPyridineD5T1, cPyridineD5T2, cPyridineD5T3, cThfD8Quin1, cThfD8Quin2, cTmsS, cTolueneD8Sep1, cTolueneD8T2, cTolueneD8T3, cTolueneD8T4, cTolueneD8T5, cTfaDQ1, cTfaDQ2, cTrifluoroethanolD3Quin, cTrifluoroethanolD3Broad]; +const cC6D5Cl1 = { + name: 'C6D5Cl (sep)-1', + value: 134.19, + label: 'C6D5Cl' +}; +const cC6D5Cl2 = { + name: 'C6D5Cl (sep)-2', + value: 129.26, + label: 'C6D5Cl' +}; +const cC6D5Cl3 = { + name: 'C6D5Cl (sep)-2', + value: 128.25, + label: 'C6D5Cl' +}; +const cC6D5Cl4 = { + name: 'C6D5Cl (sep)-4', + value: 125.96, + label: 'C6D5Cl' +}; +const LIST_SHIFT_13C = [noReference, cActicAcidD4Sept, cActicAcidD4S, cAcetoneD6Sep, cAcetoneD6Broad, cAcetonitrileD3Sep, cAcetonitrileD3S, cBenzeneT, cChloroformDT, cCyclohexaneD12Quin, cDichloromethaneD2Quin, cDmfD7Sep1, cDmfD7Sep2, cDmfD7T3, cDioxaneD8Quin, cDmsoD6, cEthanolD6Sep, cEthanolD6Quin, cMethanolD4Sep, cPyridineD5T1, cPyridineD5T2, cPyridineD5T3, cThfD8Quin1, cThfD8Quin2, cTmsS, cTolueneD8Sep1, cTolueneD8T2, cTolueneD8T3, cTolueneD8T4, cTolueneD8T5, cTfaDQ1, cTfaDQ2, cTrifluoroethanolD3Quin, cTrifluoroethanolD3Broad, cC6D5Cl1, cC6D5Cl2, cC6D5Cl3, cC6D5Cl4]; exports.LIST_SHIFT_13C = LIST_SHIFT_13C; const hActicAcidD4Quin = { name: 'Acetic acid-d4 (quin)', @@ -232,8 +252,8 @@ const hCyclohexaneD12S = { label: 'C$6D$1$2' }; const hDeuteriumOxideS = { - name: 'Deuterium oxide (s)', - value: 4.75, + name: 'D2O (s)', + value: 4.79, label: 'D$2O', nsdb: 'Deuteriumoxide (D2O)' }; diff --git a/dist/helpers/chem.js b/dist/helpers/chem.js index c477abd9..88876dd1 100644 --- a/dist/helpers/chem.js +++ b/dist/helpers/chem.js @@ -391,7 +391,32 @@ const extrSpectraShare = (spectra, layout) => spectra.map(s => Object.assign({ const extrSpectraMs = (jcamp, layout) => { const scanCount = jcamp.info.$CSSCANCOUNT || 1; const spc = extrSpectraShare(jcamp.spectra.slice(0, scanCount), layout); - return spc || []; + let spectra = spc || []; + if (jcamp.info.UNITS && jcamp.info.SYMBOL) { + const units = jcamp.info.UNITS.split(','); + const symbol = jcamp.info.SYMBOL.split(','); + let xUnit = null; + let yUnit = null; + symbol.forEach((sym, idx) => { + const currSymbol = sym.replace(' ', '').toLowerCase(); + if (currSymbol === 'x') { + xUnit = units[idx].trim(); + } else if (currSymbol === 'y') { + yUnit = units[idx].trim(); + } + }); + spectra = spectra.map(sp => { + const spectrum = sp; + if (xUnit) { + spectrum.xUnit = xUnit; + } + if (yUnit) { + spectrum.yUnit = yUnit; + } + return spectrum; + }); + } + return spectra; }; const extrSpectraNi = (jcamp, layout) => { const categorys = jcamp.info.$CSCATEGORY || ['SPECTRUM']; @@ -762,7 +787,7 @@ const extrFeaturesMs = (jcamp, layout, peakUp) => { const ExtractJcamp = source => { const jcamp = _jcampconverter.default.convert(source, { xy: true, - keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA)/ // eslint-disable-line + keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL)/ // eslint-disable-line }); const layout = readLayout(jcamp); diff --git a/package.json b/package.json index de727037..ca9a1ef2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@complat/react-spectra-editor", - "version": "1.0.0-rc17", + "version": "1.0.0-rc18", "description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS, CV, UIVIS, XRD).", "repository": { "type": "git", diff --git a/src/components/multi_jcamps_viewer.js b/src/components/multi_jcamps_viewer.js index b2345959..b1295be9 100644 --- a/src/components/multi_jcamps_viewer.js +++ b/src/components/multi_jcamps_viewer.js @@ -48,14 +48,14 @@ const seperatingSubLayout = (entities, featureCondition) => { class MultiJcampsViewer extends React.Component { // eslint-disable-line render() { const { - classes, curveSt, operations, entityFileNames, entities, userManualLink, + classes, curveSt, operations, entityFileNames, entities, userManualLink, molSvg, } = this.props; if (!entities || entities.length === 0) return (
); const seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit'); const { curveIdx } = curveSt; const entity = entities[curveIdx]; - const { feature, topic, molSvg } = entity; + const { feature, topic } = entity; return (
diff --git a/src/components/panel/cyclic_voltamery_data.js b/src/components/panel/cyclic_voltamery_data.js index d97c9548..bf9a1d6b 100644 --- a/src/components/panel/cyclic_voltamery_data.js +++ b/src/components/panel/cyclic_voltamery_data.js @@ -120,21 +120,21 @@ const CyclicVoltammetryPanel = ({ }; const getDelta = (data) => { - return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x).toFixed(5) : 'undefined'; + return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x).toFixed(3) : 'undefined'; }; const getRatio = (feature, data) => { const featureData = feature.data[0]; const idx = featureData.x.indexOf(feature.maxX); const y_pecker = data.pecker ? data.pecker.y : featureData.y[idx]; - return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toFixed(5) : 'undefined'; + return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toFixed(3) : 'undefined'; }; const rows = list.map((o, idx) => ( { idx, - max: o.max ? `x:${parseFloat(o.max.x)}, y:${parseFloat(o.max.y).toExponential(2)}` : 'undefined', - min: o.min ? `x:${parseFloat(o.min.x)}, y:${parseFloat(o.min.y).toExponential(2)}` : 'undefined', + max: o.max ? `x:${parseFloat(o.max.x).toFixed(3)}, y:${parseFloat(o.max.y).toExponential(2)}` : 'undefined', + min: o.min ? `x:${parseFloat(o.min.x).toFixed(3)}, y:${parseFloat(o.min.y).toExponential(2)}` : 'undefined', pecker: o.pecker ? `${parseFloat(o.pecker.y).toExponential(2)}` : 'undefined', delta: getDelta(o), ratio: getRatio(feature, o), diff --git a/src/constants/list_shift.js b/src/constants/list_shift.js index c1372a06..e3e6c06c 100644 --- a/src/constants/list_shift.js +++ b/src/constants/list_shift.js @@ -21,42 +21,42 @@ const cActicAcidD4S = { const cAcetoneD6Sep = { name: 'Acetone-d6 (sep)', - value: 29.920, + value: 29.640, label: 'Acetone-d6', nsdb: 'Acetone-D6 ((CD3)2CO)', }; const cAcetoneD6Broad = { name: 'Acetone-d6 (broad)', - value: 206.68, + value: 206.260, label: 'Acetone-d6', nsdb: 'Acetone-D6 ((CD3)2CO)', }; const cAcetonitrileD3Sep = { name: 'Acetonitrile-d3 (sep)', - value: 1.39, + value: 1.32, label: 'Acetonitrile-d3', nsdb: 'Acetonitrile-D3(CD3CN)', }; const cAcetonitrileD3S = { name: 'Acetonitrile-d3 (s)', - value: 118.69, + value: 118.26, label: 'Acetonitrile-d3', nsdb: 'Acetonitrile-D3(CD3CN)', }; const cBenzeneT = { name: 'Benzene (t)', - value: 128.390, + value: 128.060, label: 'Benzene-d6', nsdb: 'Benzene-D6 (C6D6)', }; const cChloroformDT = { name: 'Chloroform-d (t)', - value: 77.00, + value: 77.16, label: 'CDCl$3', nsdb: 'Chloroform-D1 (CDCl3)', }; @@ -69,7 +69,7 @@ const cCyclohexaneD12Quin = { const cDichloromethaneD2Quin = { name: 'Dichloromethane-d2 (quin)', - value: 54.0, + value: 53.84, label: 'CD$2Cl$2', }; @@ -99,7 +99,7 @@ const cDioxaneD8Quin = { const cDmsoD6 = { name: 'DMSO-d6', - value: 39.51, + value: 39.52, label: 'DMSO-d6', nsdb: 'Dimethylsulphoxide-D6 (DMSO-D6, C2D6SO)', }; @@ -118,7 +118,7 @@ const cEthanolD6Quin = { const cMethanolD4Sep = { name: 'Methanol-d4 (sep)', - value: 49.15, + value: 49.00, label: 'Methanol-d4', nsdb: 'Methanol-D4 (CD3OD)', }; @@ -208,16 +208,40 @@ const cTfaDQ2 = { const cTrifluoroethanolD3Quin = { name: 'Trifluoroethanol-d3 (quin)', - value: 61.50, + value: 61.80, label: 'Trifluoroethanol-d3', }; const cTrifluoroethanolD3Broad = { name: 'Trifluoroethanol-d3 (broad)', - value: 126.3, + value: 126.28, label: 'Trifluoroethanol-d3', }; +const cC6D5Cl1 = { + name: 'C6D5Cl (sep)-1', + value: 134.19, + label: 'C6D5Cl', +}; + +const cC6D5Cl2 = { + name: 'C6D5Cl (sep)-2', + value: 129.26, + label: 'C6D5Cl', +}; + +const cC6D5Cl3 = { + name: 'C6D5Cl (sep)-2', + value: 128.25, + label: 'C6D5Cl', +}; + +const cC6D5Cl4 = { + name: 'C6D5Cl (sep)-4', + value: 125.96, + label: 'C6D5Cl', +}; + const LIST_SHIFT_13C = [ noReference, cActicAcidD4Sept, cActicAcidD4S, cAcetoneD6Sep, cAcetoneD6Broad, cAcetonitrileD3Sep, cAcetonitrileD3S, cBenzeneT, cChloroformDT, @@ -227,6 +251,7 @@ const LIST_SHIFT_13C = [ cThfD8Quin1, cThfD8Quin2, cTmsS, cTolueneD8Sep1, cTolueneD8T2, cTolueneD8T3, cTolueneD8T4, cTolueneD8T5, cTfaDQ1, cTfaDQ2, cTrifluoroethanolD3Quin, cTrifluoroethanolD3Broad, + cC6D5Cl1, cC6D5Cl2, cC6D5Cl3, cC6D5Cl4, ]; const hActicAcidD4Quin = { @@ -276,8 +301,8 @@ const hCyclohexaneD12S = { }; const hDeuteriumOxideS = { - name: 'Deuterium oxide (s)', - value: 4.75, + name: 'D2O (s)', + value: 4.79, label: 'D$2O', nsdb: 'Deuteriumoxide (D2O)', }; diff --git a/src/helpers/chem.js b/src/helpers/chem.js index 3ad7fd94..42ea1fda 100644 --- a/src/helpers/chem.js +++ b/src/helpers/chem.js @@ -345,7 +345,33 @@ const extrSpectraShare = (spectra, layout) => ( const extrSpectraMs = (jcamp, layout) => { const scanCount = jcamp.info.$CSSCANCOUNT || 1; const spc = extrSpectraShare(jcamp.spectra.slice(0, scanCount), layout); - return spc || []; + let spectra = spc || []; + if (jcamp.info.UNITS && jcamp.info.SYMBOL) { + const units = jcamp.info.UNITS.split(','); + const symbol = jcamp.info.SYMBOL.split(','); + let xUnit = null; + let yUnit = null; + symbol.forEach((sym, idx) => { + const currSymbol = sym.replace(' ', '').toLowerCase(); + if (currSymbol === 'x') { + xUnit = units[idx].trim(); + } else if (currSymbol === 'y') { + yUnit = units[idx].trim(); + } + }); + + spectra = spectra.map((sp) => { + const spectrum = sp; + if (xUnit) { + spectrum.xUnit = xUnit; + } + if (yUnit) { + spectrum.yUnit = yUnit; + } + return spectrum; + }); + } + return spectra; }; const extrSpectraNi = (jcamp, layout) => { @@ -726,7 +752,7 @@ const ExtractJcamp = (source) => { source, { xy: true, - keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA)/, // eslint-disable-line + keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL)/, // eslint-disable-line }, ); const layout = readLayout(jcamp);