Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nmr-predictor

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nmr-predictor - npm Package Compare versions

Comparing version 0.4.0 to 0.5.1

2

package.json
{
"name": "nmr-predictor",
"version": "0.4.0",
"version": "0.5.1",
"description": "NMR chemical shift predictor",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -46,3 +46,3 @@ 'use strict';

describe('URL JSON 13C prediction', function () {
this.timeout(20000);
this.timeout(10000);
it('13C chemical shift prediction expanded', function (done) {

@@ -61,2 +61,10 @@ fetch('https://raw.githubusercontent.com/cheminfo-js/nmr-predictor/master/data/nmrshiftdb2.json', {

});
it('13C chemical shift prediction grouped', function (done) {
var predictor = new NmrPredictor();
predictor.carbon(molfile, {group:false}).then(prediction => {
prediction.length.should.eql(8);
done();
}).catch(reason => {return new Error(reason)});
});
});

@@ -48,3 +48,2 @@ const Predictor = require('../index.js');

var predictor = new Predictor('spinus');
debugger;
predictor.spinus(molfile).then(prediction => {

@@ -51,0 +50,0 @@ //var a = simule2DNmrSpectrum(prediction, {nbPointsX: 100, nbPointsY: 100});

@@ -50,12 +50,20 @@ 'use strict'

proton(molfile, options) {
let result = this.protonSync(molfile, options);
return new Promise(function(resolve, reject){
resolve(result);
});
if(!this.db)
this.db = {};
if(!this.db['H']) {
return fetch('https://raw.githubusercontent.com/cheminfo-js/nmr-predictor/master/data/h1.json', {timeout: 5000})
.then(value => {return value.text()}).then(body => {
this.db['H'] = JSON.parse(body);
return this.protonSync(molfile, options);
});
} else {
let result = this.protonSync(molfile, options);
return new Promise(function(resolve, reject){
resolve(result);
});
}
}
carbonSync(molfile, options) {
if(!this.db) {
this.db = {"C": fetchDB("C")};
}
var mol = molfile;

@@ -72,6 +80,19 @@ if(typeof molfile === 'string') {

carbon(molfile, options) {
let result = this.carbonSync(molfile, options);
return new Promise(function(resolve, reject){
resolve(result);
});
if(!this.db)
this.db = {};
if(!this.db['C']) {
return fetch('https://raw.githubusercontent.com/cheminfo-js/nmr-predictor/master/data/nmrshiftdb2.json',
{timeout: 20000})
.then(value => {return value.text()}).then(body => {
this.db['C'] = JSON.parse(body);
return this.carbonSync(molfile, options);
});
} else {
let result = this.carbonSync(molfile, options);
return new Promise(function(resolve, reject){
resolve(result);
});
}
}

@@ -386,3 +407,3 @@

var idx = ids[withID];
jc[i][idx] = (+tokens[6 + 3 * j]) / 2;
jc[i][idx] = (+tokens[6 + 3 * j]);
}

@@ -389,0 +410,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc