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.6.2 to 1.7.0

10

__tests__/digestPeptide.js

@@ -53,2 +53,12 @@ 'use strict';

});
test('HLysLeu(H-1OH)ValOH digest at all amide bonds', () => {
var result = PEP.digestPeptide('HLysLeu(H-1OH)ValOH', {
enzyme: 'any',
minMissed: 1,
maxMissed: 1
});
expect(result).toEqual(['HLysLeu(H-1OH)OH$D1>2', 'HLeu(H-1OH)ValOH$D2>3']);
});
});

238

__tests__/fragmentation.js

@@ -7,109 +7,183 @@ 'use strict';

var allowed=[
"Ala$b1",
"AlaLys$b2",
"AlaLysLeu$b3",
"AlaLysLeuArg$b4",
"AlaLysLeuArgCys$b5",
"AlaLysLeuArgCysSer$b6",
"AlaLysLeuArgCysSerThr$b7",
"Tyr$y1",
"ThrTyr$y2",
"SerThrTyr$y3",
"CysSerThrTyr$y4",
"ArgCysSerThrTyr$y5",
"LeuArgCysSerThrTyr$y6",
"LysLeuArgCysSerThrTyr$y7"
var allowed = [
'Ala$b1',
'AlaLys$b2',
'AlaLysLeu$b3',
'AlaLysLeuArg$b4',
'AlaLysLeuArgCys$b5',
'AlaLysLeuArgCysSer$b6',
'AlaLysLeuArgCysSerThr$b7',
'Tyr$y1',
'ThrTyr$y2',
'SerThrTyr$y3',
'CysSerThrTyr$y4',
'ArgCysSerThrTyr$y5',
'LeuArgCysSerThrTyr$y6',
'LysLeuArgCysSerThrTyr$y7'
];
describe('Check fragmentation', () => {
test('Check KA', () => {
var sequence=PEP.convertAASequence('KAA');
console.log(sequence);
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(4);
test('Check KA', () => {
var sequence = PEP.convertAASequence('KAA');
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(4);
});
test('Check AKLRCSTY', () => {
var sequence=PEP.convertAASequence('AKLRCSTY');
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(14);
checkAllowed(result);
test('Check AKLRCSTY', () => {
var sequence = PEP.convertAASequence('AKLRCSTY');
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(14);
checkAllowed(result);
});
test('Check HLysAlaOH', () => {
var result=PEP.generatePeptideFragments('HLysAlaOH',{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(2);
expect(result).toEqual( [ 'HLys(+1)$b1', 'H2(+1)AlaOH$y1' ]);
test('Check HLysAlaOH', () => {
var result = PEP.generatePeptideFragments('HLysAlaOH', {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(2);
expect(result).toEqual(['HLys(+1)$b1', 'H2(+1)AlaOH$y1']);
});
test('Check HLys(COH)AlaOH side chain modified', () => {
var result=PEP.generatePeptideFragments('HLys(COH)AlaOH',{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(2);
expect(result).toEqual( ["HLys(COH)(+1)$b1", "H2(+1)AlaOH$y1"]);
test('Check HLys(COH)AlaOH side chain modified', () => {
var result = PEP.generatePeptideFragments('HLys(COH)AlaOH', {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(2);
expect(result).toEqual(['HLys(COH)(+1)$b1', 'H2(+1)AlaOH$y1']);
});
test('Check AKLRCSTY ph=1', () => {
var sequence=PEP.convertAASequence('AKLRCSTY');
sequence=PEP.chargePeptide(sequence, {pH: 1});
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(14);
checkAllowed(result);
test('Check AKLRCSTY ph=1', () => {
var sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.chargePeptide(sequence, { pH: 1 });
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(14);
checkAllowed(result);
});
test('Check AKLRCSTY ph=13', () => {
var sequence=PEP.convertAASequence('AKLRCSTY');
sequence=PEP.chargePeptide(sequence, {pH: 13});
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(14);
checkAllowed(result);
test('Check AKLRCSTY ph=13', () => {
var sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.chargePeptide(sequence, { pH: 13 });
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(14);
checkAllowed(result);
});
test('Check AKLRCSTY neutral loss ph=1', () => {
var sequence=PEP.convertAASequence('AKLRCSTY');
sequence=PEP.allowNeutralLoss(sequence);
sequence=PEP.chargePeptide(sequence, {pH: 1});
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(14);
checkAllowed(result);
test('Check AKLRCSTY neutral loss ph=1', () => {
var sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.allowNeutralLoss(sequence);
sequence = PEP.chargePeptide(sequence, { pH: 1 });
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(14);
checkAllowed(result);
});
test('Check AKLRCSTY neutral loss ph=13', () => {
var sequence=PEP.convertAASequence('AKLRCSTY');
sequence=PEP.allowNeutralLoss(sequence);
sequence=PEP.chargePeptide(sequence, {pH: 13});
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(14);
checkAllowed(result);
test('Check AKLRCSTY neutral loss ph=13', () => {
var sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.allowNeutralLoss(sequence);
sequence = PEP.chargePeptide(sequence, { pH: 13 });
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(14);
checkAllowed(result);
});
test('Check AKLRCSTY neutral loss', () => {
var sequence=PEP.convertAASequence('AKLRCSTY');
sequence=PEP.allowNeutralLoss(sequence);
var result=PEP.generatePeptideFragments(sequence,{a:false, b:true, c:false, x:false, y:true, z:false, yb:false, ya:false});
expect(result).toHaveLength(14);
checkAllowed(result);
test('Check AKLRCSTY neutral loss', () => {
var sequence = PEP.convertAASequence('AKLRCSTY');
sequence = PEP.allowNeutralLoss(sequence);
var result = PEP.generatePeptideFragments(sequence, {
a: false,
b: true,
c: false,
x: false,
y: true,
z: false,
yb: false,
ya: false
});
expect(result).toHaveLength(14);
checkAllowed(result);
});
});
function clean(mfs) {
for (var i=0; i<mfs.length; i++) {
var mf=mfs[i]
mfs[i]=mfs[i].replace(/\([^\(]*\)[0-9-]*/g,'');
mfs[i]=mfs[i].replace(/^[H\d+]*(?=[A-Z])/,'');
mfs[i]=mfs[i].replace(/O[H-]\$/,'$');
}
for (var i = 0; i < mfs.length; i++) {
var mf = mfs[i];
mfs[i] = mfs[i].replace(/\([^\(]*\)[0-9-]*/g, '');
mfs[i] = mfs[i].replace(/^[H\d+]*(?=[A-Z])/, '');
mfs[i] = mfs[i].replace(/O[H-]\$/, '$');
}
}
function checkAllowed(mfs) {
clean(mfs);
for (var mf of mfs) {
expect(allowed).toContain(mf);
}
}
clean(mfs);
for (var mf of mfs) {
expect(allowed).toContain(mf);
}
}

@@ -5,22 +5,17 @@ 'use strict';

describe('Checking split peptide', () => {
test('Normal sequence split', () => {
var result=PEP.splitPeptide("HAlaGlyLysHisAspOH");
expect(result).toEqual(["Ala","Gly","Lys","His","Asp"]);
});
test('Normal sequence split', () => {
var result = PEP.splitPeptide('HAlaGlyLysHisAspOH');
expect(result).toEqual(['Ala', 'Gly', 'Lys', 'His', 'Asp']);
});
test('Sequence split : nothing on N-term', () => {
var result=PEP.splitPeptide("AlaGlyLysHisAspOH");
expect(result).toEqual(["Ala","Gly","Lys","His","Asp"]);
});
test('Sequence split : nothing on N-term', () => {
var result = PEP.splitPeptide('AlaGlyLysHisAspOH');
expect(result).toEqual(['Ala', 'Gly', 'Lys', 'His', 'Asp']);
});
test('Sequence split : nothing on C-term', () => {
var result=PEP.splitPeptide("HAlaGlyLysHisAsp");
expect(result).toEqual(["Ala","Gly","Lys","His","Asp"]);
});
test('Sequence split : nothing on C-term', () => {
var result = PEP.splitPeptide('HAlaGlyLysHisAsp');
expect(result).toEqual(['Ala', 'Gly', 'Lys', 'His', 'Asp']);
});
});
{
"name": "peptide",
"version": "1.6.2",
"version": "1.7.0",
"description": "Peptide",

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

{
"name": "peptide",
"version": "1.6.2",
"version": "1.7.0",
"description": "Peptide",

@@ -33,3 +33,3 @@ "keywords": [

"cheminfo-tools": "^1.20.2",
"eslint": "^5.14.1",
"eslint": "^5.15.1",
"eslint-config-cheminfo": "^1.18.0",

@@ -36,0 +36,0 @@ "eslint-plugin-jest": "^22.3.0",

@@ -25,14 +25,18 @@ 'use strict';

var regexp = getRegexp(options.enzyme);
var fragments = sequence.replace(regexp, '$1 ').split(/ /);
if (!fragments[fragments.length - 1])
fragments = fragments.slice(0, fragments.length - 1);
var fragments = sequence
.replace(regexp, '$1 ')
.split(/ /)
.filter(entry => entry);
var from = 0;
for (var i = 0; i < fragments.length; i++) {
var nbResidue = splitSequence(fragments[i]).length;
var nbResidue = fragments[i]
.replace(/([A-Z][a-z][a-z])/g, ' $1')
.split(/ /)
.filter(entry => entry).length;
fragments[i] = {
sequence: fragments[i],
nbResidue: nbResidue,
from: from + 1,
to: from + nbResidue
from: from,
to: from + nbResidue - 1
};

@@ -56,4 +60,4 @@ from += nbResidue;

}
var from = fragments[i].from;
var to = fragments[i + j].to;
var from = fragments[i].from + 1;
var to = fragments[i + j].to + 1;
if (

@@ -88,2 +92,4 @@ fragment &&

return /(Met)/g;
case 'any':
return /()(?=[A-Z][a-z][a-z])/g;
}

@@ -90,0 +96,0 @@ throw new Error('Digestion enzyme: ' + enzyme + ' is unknown');

'use strict';
function splitSequence(sequence) {
var aas=sequence.replace(/([A-Z])/g," $1").split(/ /);
var begin=0;
while (aas[begin]==='' || aas[begin]==='H') {
begin++;
}
var end=aas.length-1;
while (aas[end]==='O' || aas[end]==='H') {
end--;
}
aas=aas.slice(begin,end+1);
return aas;
var aas = sequence.replace(/([A-Z])/g, ' $1').split(/ /);
var begin = 0;
while (aas[begin] === '' || aas[begin] === 'H') {
begin++;
}
var end = aas.length - 1;
while (aas[end] === 'O' || aas[end] === 'H') {
end--;
}
aas = aas.slice(begin, end + 1);
return aas;
}
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