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

openchemlib-utils

Package Overview
Dependencies
Maintainers
4
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openchemlib-utils - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

src/db/utils/appendSmilesList.js

7

CHANGELOG.md
# Changelog
## [1.4.0](https://www.github.com/cheminfo/openchemlib-utils/compare/v1.3.0...v1.4.0) (2021-08-03)
### Features
* appendSmiles text file for Molecules DB ([62365c6](https://www.github.com/cheminfo/openchemlib-utils/commit/62365c6845331e8e4356178e3443163956efaa48))
## [1.3.0](https://www.github.com/cheminfo/openchemlib-utils/compare/v1.2.0...v1.3.0) (2021-07-29)

@@ -4,0 +11,0 @@

@@ -1147,2 +1147,25 @@ 'use strict';

async function appendSmilesList(
moleculesDB,
text,
options = {},
) {
const { onStep } = options;
text = ensureString.ensureString(text);
if (typeof text !== 'string') {
throw new TypeError('text must be a string');
}
const smilesArray = text
.split(/\r?\n/)
.map((line) => line.trim())
.filter((line) => line);
for (let i = 0; i < smilesArray.length; i++) {
const oneSmiles = smilesArray[i];
moleculesDB.pushEntry(moleculesDB.OCL.Molecule.fromSmiles(oneSmiles));
if (onStep) {
await onStep(i + 1, smilesArray.length);
}
}
}
function pushEntry(

@@ -1433,2 +1456,17 @@ moleculesDB,

/**
* Append a SDF to the current database
* @param {text|ArrayBuffer} smiles - text file containing a list of smiles
* @param {object} [options={}]
* @param {function} [options.onStep] call back to execute after each molecule
* @returns {DB}
*/
appendSmilesList(text, options) {
return appendSmilesList(this, text, {
computeProperties: this.computeProperties,
...options,
});
}
/**
* Add a molecule to the current database

@@ -1435,0 +1473,0 @@ * @param {OCL.Molecule} molecule

6

package.json
{
"name": "openchemlib-utils",
"version": "1.3.0",
"version": "1.4.0",
"description": "",

@@ -44,3 +44,3 @@ "main": "lib/index.js",

"cheminfo-build": "^1.1.11",
"eslint": "^7.31.0",
"eslint": "^7.32.0",
"eslint-config-cheminfo": "^5.2.4",

@@ -51,3 +51,3 @@ "esm": "^3.2.25",

"prettier": "^2.3.2",
"rollup": "^2.55.0"
"rollup": "^2.55.1"
},

@@ -54,0 +54,0 @@ "dependencies": {

import appendCSV from './utils/appendCSV';
import appendSDF from './utils/appendSDF';
import appendSmilesList from './utils/appendSmilesList';
import pushEntry from './utils/pushEntry';

@@ -64,2 +65,17 @@ import pushMoleculeInfo from './utils/pushMoleculeInfo';

/**
* Append a SDF to the current database
* @param {text|ArrayBuffer} smiles - text file containing a list of smiles
* @param {object} [options={}]
* @param {function} [options.onStep] call back to execute after each molecule
* @returns {DB}
*/
appendSmilesList(text, options) {
return appendSmilesList(this, text, {
computeProperties: this.computeProperties,
...options,
});
}
/**
* Add a molecule to the current database

@@ -66,0 +82,0 @@ * @param {OCL.Molecule} molecule

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