New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

peptide

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peptide - npm Package Compare versions

Comparing version 1.11.4 to 1.11.5

lib/index.js

12

package.json
{
"name": "peptide",
"version": "1.11.4",
"version": "1.11.5",
"description": "Peptide",

@@ -18,9 +18,11 @@ "keywords": [

},
"homepage": "https://github.com/cheminfo/mass-tools/tree/master/packages/peptide#readme",
"homepage": "https://github.com/cheminfo/mass-tools/tree/main/packages/peptide#readme",
"license": "MIT",
"main": "./src/index.js",
"main": "lib/index.js",
"module": "src/index.js",
"files": [
"src"
"src",
"lib"
],
"gitHead": "78f6c10cea6825c99ba7fd6a103367dec9979564"
"gitHead": "bd2c06e05f2196c5f9c6ff011cf3ef41e1b6a0f9"
}

@@ -144,3 +144,3 @@ # peptide

[npm-url]: https://www.npmjs.com/package/peptide
[travis-image]: https://img.shields.io/travis/cheminfo-js/peptide/master.svg?style=flat-square
[travis-image]: https://img.shields.io/travis/cheminfo-js/peptide/main.svg?style=flat-square
[travis-url]: https://travis-ci.org/cheminfo-js/peptide

@@ -147,0 +147,0 @@ [david-image]: https://img.shields.io/david/cheminfo-js/peptide.svg?style=flat-square

@@ -1,10 +0,6 @@

'use strict';
import { allowNeutralLoss } from '../index.js';
let PEP = require('..');
describe('Checking allow neutral loss of peptides', () => {
it('Check neutral loss of AASTAARKAA', () => {
let result = PEP.allowNeutralLoss(
'HAlaAlaSerThrAsp(H-1)GluArgLys(H+)AlaOH',
);
let result = allowNeutralLoss('HAlaAlaSerThrAsp(H-1)GluArgLys(H+)AlaOH');
expect(result).toBe(

@@ -11,0 +7,0 @@ 'HAlaAlaSer(H-2O-1)0-1Thr(H-2O-1)0-1Asp(H-1)Glu(H-2O-1)0-1Arg(N-1H-3)0-1Lys(H+)AlaOH',

@@ -1,8 +0,6 @@

'use strict';
import { chargePeptide } from '..';
let PEP = require('..');
describe('Checking charge peptide', () => {
it('Check charge with default option', () => {
let result = PEP.chargePeptide('HAlaGlyLysHisAspOH');
let result = chargePeptide('HAlaGlyLysHisAspOH');
expect(result).toBe('H+HAlaGlyLys(H+)His(H+)AspOH');

@@ -12,3 +10,3 @@ });

it('Check charge with pH = 1', () => {
let result = PEP.chargePeptide('HAlaGlyLysHisAspOH', { pH: 1 });
let result = chargePeptide('HAlaGlyLysHisAspOH', { pH: 1 });
expect(result).toBe('H+HAlaGlyLys(H+)His(H+)AspOH');

@@ -18,3 +16,3 @@ });

it('Check charge with pH = 7', () => {
let result = PEP.chargePeptide('HAlaGlyLysHisAspOH', { pH: 7 });
let result = chargePeptide('HAlaGlyLysHisAspOH', { pH: 7 });
expect(result).toBe('H+HAlaGlyLys(H+)HisAsp(H-1-)O-');

@@ -24,3 +22,3 @@ });

it('Check charge with pH = 13', () => {
let result = PEP.chargePeptide('HAlaGlyLysHisAspOH', { pH: 13 });
let result = chargePeptide('HAlaGlyLysHisAspOH', { pH: 13 });
expect(result).toBe('HAlaGlyLysHisAsp(H-1-)O-');

@@ -30,3 +28,3 @@ });

it('Charge an array of mfs', () => {
let result = PEP.chargePeptide(['HAlaGlyLysHisAspOH', 'HLysHisAspOH'], {
let result = chargePeptide(['HAlaGlyLysHisAspOH', 'HLysHisAspOH'], {
pH: 13,

@@ -33,0 +31,0 @@ });

@@ -1,8 +0,6 @@

'use strict';
import { sequenceToMF } from '..';
const convertAASequence = require('../convertAASequence');
describe('Checking convert AA sequence', () => {
it('AAAAAAA', () => {
const result = convertAASequence('AAAAAAA');
const result = sequenceToMF('AAAAAAA');
expect(result).toBe('HAlaAlaAlaAlaAlaAlaAlaOH');

@@ -12,7 +10,7 @@ });

it('HAlaAla(H-1OH)AlaOH', () => {
const result = convertAASequence('HAlaAla(H-1OH)AlaOH');
const result = sequenceToMF('HAlaAla(H-1OH)AlaOH');
expect(result).toBe('HAlaAla(H-1OH)AlaOH');
});
it('(C33H37O6N3Si) GluTyrGluLys(C16H30O)GluTyrGluOH', () => {
const result = convertAASequence(
const result = sequenceToMF(
'(C33H37O6N3Si) GluTyrGluLys(C16H30O)GluTyrGluOH',

@@ -24,3 +22,3 @@ );

it('(Me)AAAAAAA(NH2)', () => {
const result = convertAASequence('(Me)AAAAAAA(NH2)');
const result = sequenceToMF('(Me)AAAAAAA(NH2)');
expect(result).toBe('(Me)AlaAlaAlaAlaAlaAlaAla(NH2)');

@@ -30,3 +28,3 @@ });

it('HAlaGlyProOH', () => {
const result = convertAASequence('HAlaGlyProOH');
const result = sequenceToMF('HAlaGlyProOH');
expect(result).toBe('HAlaGlyProOH');

@@ -36,5 +34,5 @@ });

it('ALA SER LYS GLY PRO', () => {
const result = convertAASequence('ALA SER LYS GLY PRO');
const result = sequenceToMF('ALA SER LYS GLY PRO');
expect(result).toBe('HAlaSerLysGlyProOH');
});
});

@@ -1,8 +0,6 @@

'use strict';
import { digestPeptide } from '..';
let PEP = require('..');
describe('Checking digest sequence', () => {
it('Normal sequence digest', () => {
let result = PEP.digestPeptide('HLysLysAlaAlaLysOH', {
let result = digestPeptide('HLysLysAlaAlaLysOH', {
enzyme: 'trypsin',

@@ -20,3 +18,3 @@ minMissed: 0,

it('Normal sequence digest, minMissed:0, maxMissed:1', () => {
let result = PEP.digestPeptide('HLysLysAlaAlaLysOH', {
let result = digestPeptide('HLysLysAlaAlaLysOH', {
enzyme: 'trypsin',

@@ -36,3 +34,3 @@ minMissed: 0,

it('Normal sequence digest, minMissed:1, maxMissed:1', () => {
let result = PEP.digestPeptide('HLysLysAlaAlaLysOH', {
let result = digestPeptide('HLysLysAlaAlaLysOH', {
enzyme: 'trypsin',

@@ -46,3 +44,3 @@ minMissed: 1,

it('Normal small sequence digest, default value', () => {
let result = PEP.digestPeptide('HLysAlaOH');
let result = digestPeptide('HLysAlaOH');
expect(result).toStrictEqual(['HLysOH$D1>1', 'HAlaOH$D2>2']);

@@ -53,3 +51,3 @@ });

it('HLysLeuValOH digest by thermolysin', () => {
let result = PEP.digestPeptide('HLysLeuProValOH', {
let result = digestPeptide('HLysLeuProValOH', {
enzyme: 'thermolysin',

@@ -67,3 +65,3 @@ minMissed: 0,

it('HLysLeu(H-1OH)ValOH digest at all amide bonds', () => {
let result = PEP.digestPeptide('HLysLeu(H-1OH)ValOH', {
let result = digestPeptide('HLysLeu(H-1OH)ValOH', {
enzyme: 'any',

@@ -70,0 +68,0 @@ minMissed: 1,

@@ -1,5 +0,8 @@

'use strict';
import {
generatePeptideFragments,
sequenceToMF,
chargePeptide,
allowNeutralLoss,
} from '..';
let PEP = require('..');
// http://www.matrixscience.com/help/fragmentation_help.html

@@ -26,4 +29,4 @@

it('Check KAA', () => {
let sequence = PEP.convertAASequence('KAA');
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('KAA');
let result = generatePeptideFragments(sequence, {
a: false,

@@ -42,4 +45,4 @@ b: true,

it('Check AKLRCSTY', () => {
let sequence = PEP.convertAASequence('AKLRCSTY');
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKLRCSTY');
let result = generatePeptideFragments(sequence, {
a: false,

@@ -59,3 +62,3 @@ b: true,

it('Check HLysAlaOH', () => {
let result = PEP.generatePeptideFragments('HLysAlaOH', {
let result = generatePeptideFragments('HLysAlaOH', {
a: false,

@@ -75,3 +78,3 @@ b: true,

it('Check HLys(COH)AlaOH side chain modified', () => {
let result = PEP.generatePeptideFragments('HLys(COH)AlaOH', {
let result = generatePeptideFragments('HLys(COH)AlaOH', {
a: false,

@@ -91,5 +94,5 @@ b: true,

it('Check AKLRCSTY ph=1', () => {
let sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.chargePeptide(sequence, { pH: 1 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKLRCSTY');
sequence = chargePeptide(sequence, { pH: 1 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -109,5 +112,5 @@ b: true,

it('Check AKLRCSTY ph=13', () => {
let sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.chargePeptide(sequence, { pH: 13 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKLRCSTY');
sequence = chargePeptide(sequence, { pH: 13 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -127,6 +130,6 @@ b: true,

it('Check AKLRCSTY neutral loss ph=1', () => {
let sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.allowNeutralLoss(sequence);
sequence = PEP.chargePeptide(sequence, { pH: 1 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKLRCSTY');
sequence = allowNeutralLoss(sequence);
sequence = chargePeptide(sequence, { pH: 1 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -146,6 +149,6 @@ b: true,

it('Check AKLRCSTY neutral loss ph=13', () => {
let sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.allowNeutralLoss(sequence);
sequence = PEP.chargePeptide(sequence, { pH: 13 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKLRCSTY');
sequence = allowNeutralLoss(sequence);
sequence = chargePeptide(sequence, { pH: 13 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -165,5 +168,5 @@ b: true,

it('Check AKLRCSTY neutral loss', () => {
let sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.allowNeutralLoss(sequence);
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKLRCSTY');
sequence = allowNeutralLoss(sequence);
let result = generatePeptideFragments(sequence, {
a: false,

@@ -183,10 +186,10 @@ b: true,

it('ALP versus (H)ALP(OH) versus HAlaLeuProOH versus (H)AlaLeuPro(OH)', () => {
let sequence1 = PEP.convertAASequence('ALP');
let sequence2 = PEP.convertAASequence('(H)ALP(OH)');
let sequence3 = PEP.convertAASequence('HAlaLeuProOH');
let sequence4 = PEP.convertAASequence('(H)AlaLeuPro(OH)');
let result1 = PEP.generatePeptideFragments(sequence1);
let result2 = PEP.generatePeptideFragments(sequence2);
let result3 = PEP.generatePeptideFragments(sequence3);
let result4 = PEP.generatePeptideFragments(sequence4);
let sequence1 = sequenceToMF('ALP');
let sequence2 = sequenceToMF('(H)ALP(OH)');
let sequence3 = sequenceToMF('HAlaLeuProOH');
let sequence4 = sequenceToMF('(H)AlaLeuPro(OH)');
let result1 = generatePeptideFragments(sequence1);
let result2 = generatePeptideFragments(sequence2);
let result3 = generatePeptideFragments(sequence3);
let result4 = generatePeptideFragments(sequence4);
expect(result1).toStrictEqual([

@@ -209,4 +212,4 @@ 'HAla(+1)$b1',

it('AK(*1)T(H-1*2)Y', () => {
let sequence = PEP.convertAASequence('AK(*1)T(H-1*2)Y');
let result = PEP.generatePeptideFragments(sequence);
let sequence = sequenceToMF('AK(*1)T(H-1*2)Y');
let result = generatePeptideFragments(sequence);
expect(result).toStrictEqual([

@@ -222,4 +225,4 @@ 'HAla(+1)$b1',

it('HAlaLys(*1)Thr(H-1*2)TyrOH', () => {
let sequence = PEP.convertAASequence('HAlaLys(*1)Thr(H-1*2)TyrOH');
let result = PEP.generatePeptideFragments(sequence);
let sequence = sequenceToMF('HAlaLys(*1)Thr(H-1*2)TyrOH');
let result = generatePeptideFragments(sequence);
expect(result).toStrictEqual([

@@ -226,0 +229,0 @@ 'HAla(+1)$b1',

@@ -1,5 +0,3 @@

'use strict';
import { generatePeptideFragments } from '..';
let PEP = require('..');
// http://www.matrixscience.com/help/fragmentation_help.html

@@ -9,3 +7,3 @@

it('Check internal fragments for yb', () => {
let result = PEP.generatePeptideFragments('HAlaGlySerProPheOH', {
let result = generatePeptideFragments('HAlaGlySerProPheOH', {
a: false,

@@ -32,3 +30,3 @@ b: false,

it('Check internal fragments for ya', () => {
let result = PEP.generatePeptideFragments('HAlaGlySerProPheOH', {
let result = generatePeptideFragments('HAlaGlySerProPheOH', {
a: false,

@@ -55,3 +53,3 @@ b: false,

it('Check internal fragments for ya with maxInternal=2', () => {
let result = PEP.generatePeptideFragments('HAlaGlySerProPheOH', {
let result = generatePeptideFragments('HAlaGlySerProPheOH', {
a: false,

@@ -78,3 +76,3 @@ b: false,

it('Check internal fragments for ya with maxInternal=2 and minInternal=2', () => {
let result = PEP.generatePeptideFragments('HAlaGlySerProPheOH', {
let result = generatePeptideFragments('HAlaGlySerProPheOH', {
a: false,

@@ -81,0 +79,0 @@ b: false,

@@ -1,5 +0,8 @@

'use strict';
import {
generatePeptideFragments,
sequenceToMF,
chargePeptide,
allowNeutralLoss,
} from '..';
let PEP = require('..');
// http://www.matrixscience.com/help/fragmentation_help.html

@@ -23,4 +26,4 @@

it('Check AKDR', () => {
let sequence = PEP.convertAASequence('AKDR');
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
let result = generatePeptideFragments(sequence, {
a: false,

@@ -40,5 +43,5 @@ b: false,

it('Check AKDR ph=1', () => {
let sequence = PEP.convertAASequence('AKDR');
sequence = PEP.chargePeptide(sequence, { pH: 1 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
sequence = chargePeptide(sequence, { pH: 1 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -58,5 +61,5 @@ b: false,

it('Check AKLRCSTY ph=13', () => {
let sequence = PEP.convertAASequence('AKDR');
sequence = PEP.chargePeptide(sequence, { pH: 13 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
sequence = chargePeptide(sequence, { pH: 13 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -76,6 +79,6 @@ b: false,

it('Check AKDR neutral loss ph=1', () => {
let sequence = PEP.convertAASequence('AKDR');
sequence = PEP.allowNeutralLoss(sequence);
sequence = PEP.chargePeptide(sequence, { pH: 1 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
sequence = allowNeutralLoss(sequence);
sequence = chargePeptide(sequence, { pH: 1 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -95,6 +98,6 @@ b: false,

it('Check AKDR neutral loss ph=13', () => {
let sequence = PEP.convertAASequence('AKDR');
sequence = PEP.allowNeutralLoss(sequence);
sequence = PEP.chargePeptide(sequence, { pH: 13 });
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
sequence = allowNeutralLoss(sequence);
sequence = chargePeptide(sequence, { pH: 13 });
let result = generatePeptideFragments(sequence, {
a: false,

@@ -114,5 +117,5 @@ b: false,

it('Check AKDR neutral loss internal fragment yb', () => {
let sequence = PEP.convertAASequence('AKDR');
sequence = PEP.allowNeutralLoss(sequence);
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
sequence = allowNeutralLoss(sequence);
let result = generatePeptideFragments(sequence, {
a: false,

@@ -132,4 +135,4 @@ b: false,

it('Check AKDR internal fragment yc', () => {
let sequence = PEP.convertAASequence('AKDR');
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
let result = generatePeptideFragments(sequence, {
a: false,

@@ -151,5 +154,5 @@ b: false,

it('Check AKDR internal fragment zc', () => {
let sequence = PEP.convertAASequence('AKDR');
sequence = PEP.allowNeutralLoss(sequence);
let result = PEP.generatePeptideFragments(sequence, {
let sequence = sequenceToMF('AKDR');
sequence = allowNeutralLoss(sequence);
let result = generatePeptideFragments(sequence, {
a: false,

@@ -156,0 +159,0 @@ b: false,

@@ -1,5 +0,2 @@

'use strict';
let {
generatePeptideFragments,
import {
calculateIEP,

@@ -9,3 +6,4 @@ calculateIEPChart,

calculateCharge,
} = require('..');
generatePeptideFragments,
} from '..';

@@ -12,0 +10,0 @@ describe('generatePeptideFragments', () => {

@@ -1,8 +0,6 @@

'use strict';
import { splitPeptide } from '..';
let PEP = require('..');
describe('Checking split peptide', () => {
it('Normal sequence split', () => {
let result = PEP.splitPeptide('HAlaGlyLysHisAspOH');
let result = splitPeptide('HAlaGlyLysHisAspOH');
expect(result).toStrictEqual(['Ala', 'Gly', 'Lys', 'His', 'Asp']);

@@ -12,3 +10,3 @@ });

it('Sequence split : nothing on N-term', () => {
let result = PEP.splitPeptide('AlaGlyLysHisAspOH');
let result = splitPeptide('AlaGlyLysHisAspOH');
expect(result).toStrictEqual(['Ala', 'Gly', 'Lys', 'His', 'Asp']);

@@ -18,5 +16,5 @@ });

it('Sequence split : nothing on C-term', () => {
let result = PEP.splitPeptide('HAlaGlyLysHisAsp');
let result = splitPeptide('HAlaGlyLysHisAsp');
expect(result).toStrictEqual(['Ala', 'Gly', 'Lys', 'His', 'Asp']);
});
});

@@ -1,11 +0,14 @@

'use strict';
function allowNeutralLoss(mf, options) {
/**
* Add neutral loss on natural amino acids
* @param {*} mf
* @returns
*/
export function allowNeutralLoss(mf) {
if (Array.isArray(mf)) {
for (let i = 0; i < mf.length; i++) {
mf[i] = allowOneNeutralLoss(mf[i], options);
mf[i] = allowOneNeutralLoss(mf[i]);
}
return mf;
} else {
return allowOneNeutralLoss(mf, options);
return allowOneNeutralLoss(mf);
}

@@ -20,3 +23,1 @@ }

}
module.exports = allowNeutralLoss;

@@ -1,6 +0,4 @@

'use strict';
// SOURCE: https://en.wikipedia.org/wiki/Amino_acid
// Link for UTF8 code for modified: https://codepoints.net/search?sc=Grek
module.exports = [
export const aminoAcids = [
// Standard amino acids

@@ -7,0 +5,0 @@ {

@@ -1,8 +0,6 @@

'use strict';
import { getAA } from './getAA';
let getAA = require('./getAA');
// SOURCE: https://en.wikipedia.org/wiki/Amino_acid
function chargePeptide(mf, options = {}) {
export function chargePeptide(mf, options = {}) {
if (options.pH === undefined) options.pH = 0;

@@ -52,3 +50,1 @@ if (Array.isArray(mf)) {

}
module.exports = chargePeptide;

@@ -1,3 +0,1 @@

'use strict';
/*

@@ -12,3 +10,3 @@ Iotuibs:

function digestSequence(sequence, options = {}) {
export function digestPeptide(sequence, options = {}) {
sequence = sequence.replace(/^H([^a-z])/, '$1').replace(/OH$/, '');

@@ -36,4 +34,4 @@

sequence: fragments[i],
nbResidue: nbResidue,
from: from,
nbResidue,
from,
to: from + nbResidue - 1,

@@ -96,3 +94,1 @@ };

}
module.exports = digestSequence;

@@ -1,4 +0,2 @@

'use strict';
module.exports = function generatePeptideFragments(mf, options) {
export function generatePeptideFragments(mf, options) {
if (options === undefined) {

@@ -75,3 +73,3 @@ options = {

return mfs;
};
}

@@ -78,0 +76,0 @@ function addNTerm(mfs, nTerm, i, options) {

@@ -1,10 +0,8 @@

'use strict';
import { aminoAcids } from './aminoAcids';
let aa = require('./aminoAcids');
function getAA(code) {
export function getAA(code) {
if (code.length === 1) {
for (let i = 0; i < aa.length; i++) {
if (aa[i].aa1 === code) {
return aa[i];
for (let i = 0; i < aminoAcids.length; i++) {
if (aminoAcids[i].aa1 === code) {
return aminoAcids[i];
}

@@ -14,5 +12,5 @@ }

if (code.length === 3) {
for (let i = 0; i < aa.length; i++) {
if (aa[i].aa3 === code) {
return aa[i];
for (let i = 0; i < aminoAcids.length; i++) {
if (aminoAcids[i].aa3 === code) {
return aminoAcids[i];
}

@@ -22,3 +20,1 @@ }

}
module.exports = getAA;

@@ -1,49 +0,37 @@

'use strict';
import { aminoAcids } from './aminoAcids';
import * as IEP from './isoElectricPoint';
import { splitPeptide } from './splitPeptide.js';
const allowNeutralLoss = require('./allowNeutralLoss');
const aa = require('./aminoAcids');
const chargePeptide = require('./chargePeptide');
const convertAASequence = require('./convertAASequence');
const digestPeptide = require('./digestPeptide');
const generatePeptideFragments = require('./generatePeptideFragments');
const IEP = require('./isoElectricPoint');
const splitPeptide = require('./splitPeptide');
export * from './allowNeutralLoss';
export * from './chargePeptide.js';
export * from './sequenceToMF.js';
export * from './generatePeptideFragments.js';
export * from './digestPeptide.js';
export * from './splitPeptide.js';
exports.getInfo = () => {
return aa;
};
export function getInfo() {
return aminoAcids;
}
// sequence should be in the "right" format like HAlaGlyProOH
exports.splitPeptide = splitPeptide;
exports.digestPeptide = digestPeptide;
exports.calculateIEP = function calculateIEP(sequence) {
export function calculateIEP(sequence) {
let aas = splitPeptide(sequence);
let result = IEP.calculateIEP(aas);
return result;
};
}
exports.calculateIEPChart = function calculateIEPChart(sequence) {
export function calculateIEPChart(sequence) {
let aas = splitPeptide(sequence);
let result = IEP.calculateChart(aas);
return result;
};
}
exports.getColorForIEP = function getColorForIEP(iep) {
export function getColorForIEP(iep) {
return IEP.getColor(iep);
};
}
exports.calculateCharge = function calculateCharge(sequence, ph) {
export function calculateCharge(sequence, ph) {
let aas = splitPeptide(sequence);
return IEP.calculateCharge(aas, ph);
};
exports.generatePeptideFragments = generatePeptideFragments;
exports.chargePeptide = chargePeptide;
exports.allowNeutralLoss = allowNeutralLoss;
exports.convertAASequence = convertAASequence;
exports.sequenceToMF = convertAASequence;
}

@@ -1,13 +0,10 @@

'use strict';
import { aminoAcids } from './aminoAcids';
let aa = require('./aminoAcids');
// we will convert the data to an object to be much faster
let aaObject = {};
for (let i = 0; i < aa.length; i++) {
aaObject[aa[i].aa3] = aa[i];
for (let i = 0; i < aminoAcids.length; i++) {
aaObject[aminoAcids[i].aa3] = aminoAcids[i];
}
function calculateCharge(aas, pH) {
if (!pH) pH = 7.0;
export function calculateCharge(aas, pH = 7.0) {
let combined = combine(aas);

@@ -21,3 +18,3 @@ if (!combined) return;

function calculateIEP(aas) {
export function calculateIEP(aas) {
let combined = combine(aas);

@@ -45,3 +42,3 @@ if (!combined) return;

function calculateChart(aas) {
export function calculateChart(aas) {
let combined = combine(aas);

@@ -67,11 +64,9 @@ if (!combined) return;

let total = 0;
total += 1 / (1 + Math.pow(10, pH - combined.first));
total += -1 / (1 + Math.pow(10, combined.last - pH));
total += 1 / (1 + 10 ** (pH - combined.first));
total += -1 / (1 + 10 ** (combined.last - pH));
for (let key in combined.acid) {
total +=
-combined.acid[key] / (1 + Math.pow(10, aaObject[key].sc.pKa - pH));
total += -combined.acid[key] / (1 + 10 ** (aaObject[key].sc.pKa - pH));
}
for (let key in combined.basic) {
total +=
combined.basic[key] / (1 + Math.pow(10, pH - aaObject[key].sc.pKa));
total += combined.basic[key] / (1 + 10 ** (pH - aaObject[key].sc.pKa));
}

@@ -121,3 +116,3 @@ return total;

*/
function getColor(iep) {
export function getColor(iep) {
if (iep < 7) {

@@ -134,8 +129,1 @@ if (iep < 3) iep = 3;

}
module.exports = {
calculateIEP: calculateIEP,
calculateCharge: calculateCharge,
calculateChart: calculateChart,
getColor: getColor,
};

@@ -1,4 +0,2 @@

'use strict';
function splitSequence(sequence) {
export function splitPeptide(sequence) {
let aas = sequence.replace(/([A-Z])/g, ' $1').split(/ /);

@@ -16,3 +14,1 @@ let begin = 0;

}
module.exports = splitSequence;
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