Comparing version 2.2.0 to 2.2.1
{ | ||
"name": "peptide", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Peptide", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"main": "lib/src/index.js", | ||
"module": "src/index.js", | ||
@@ -27,3 +27,3 @@ "files": [ | ||
], | ||
"gitHead": "28dae91d3b42556a23097ee08acfe4061f276ed0" | ||
"gitHead": "838f98a30846d4b1721b8ed7aa94a55e854d7521" | ||
} |
@@ -18,6 +18,6 @@ /** | ||
function allowOneNeutralLoss(mf) { | ||
mf = mf.replace(/(Ser|Thr|Asp|Glu)(?!\()/g, '$1(H-2O-1)0-1'); | ||
mf = mf.replace(/(Arg|Lys|Asn|Gln)(?!\()/g, '$1(N-1H-3)0-1'); | ||
mf = mf.replaceAll(/(Ser|Thr|Asp|Glu)(?!\()/g, '$1(H-2O-1)0-1'); | ||
mf = mf.replaceAll(/(Arg|Lys|Asn|Gln)(?!\()/g, '$1(N-1H-3)0-1'); | ||
return mf; | ||
} |
@@ -24,3 +24,3 @@ // SOURCE: https://en.wikipedia.org/wiki/Amino_acid | ||
pKaC: 2.03, | ||
pKaN: 9.0, | ||
pKaN: 9, | ||
}, | ||
@@ -78,3 +78,3 @@ { | ||
pKaC: 2.18, | ||
pKaN: 9.0, | ||
pKaN: 9, | ||
}, | ||
@@ -81,0 +81,0 @@ { |
@@ -37,13 +37,13 @@ import { getAA } from './getAA'; | ||
// basic AA | ||
if (pH < getAA('Arg').sc.pKa) mf = mf.replace(/(Arg)(?!\()/g, '$1(H+)'); | ||
if (pH < getAA('His').sc.pKa) mf = mf.replace(/(His)(?!\()/g, '$1(H+)'); | ||
if (pH < getAA('Lys').sc.pKa) mf = mf.replace(/(Lys)(?!\()/g, '$1(H+)'); | ||
if (pH < getAA('Arg').sc.pKa) mf = mf.replaceAll(/(Arg)(?!\()/g, '$1(H+)'); | ||
if (pH < getAA('His').sc.pKa) mf = mf.replaceAll(/(His)(?!\()/g, '$1(H+)'); | ||
if (pH < getAA('Lys').sc.pKa) mf = mf.replaceAll(/(Lys)(?!\()/g, '$1(H+)'); | ||
// acid AA | ||
if (pH > getAA('Asp').sc.pKa) mf = mf.replace(/(Asp)(?!\()/g, '$1(H-1-)'); | ||
if (pH > getAA('Glu').sc.pKa) mf = mf.replace(/(Glu)(?!\()/g, '$1(H-1-)'); | ||
if (pH > getAA('Asp').sc.pKa) mf = mf.replaceAll(/(Asp)(?!\()/g, '$1(H-1-)'); | ||
if (pH > getAA('Glu').sc.pKa) mf = mf.replaceAll(/(Glu)(?!\()/g, '$1(H-1-)'); | ||
if (pH > getAA('Cys').sc.pKa) mf = mf.replace(/(Cys)(?!\()/g, '$1(H-1-)'); | ||
if (pH > getAA('Cys').sc.pKa) mf = mf.replaceAll(/(Cys)(?!\()/g, '$1(H-1-)'); | ||
return mf; | ||
} |
@@ -18,6 +18,3 @@ /* | ||
let regexp = getRegexp(options.enzyme); | ||
let fragments = sequence | ||
.replace(regexp, '$1 ') | ||
.split(/ /) | ||
.filter((entry) => entry); | ||
let fragments = sequence.replace(regexp, '$1 ').split(/ /).filter(Boolean); | ||
@@ -28,5 +25,5 @@ { | ||
let nbResidue = fragments[i] | ||
.replace(/([A-Z][a-z][a-z])/g, ' $1') | ||
.replaceAll(/([A-Z][a-z]{2})/g, ' $1') | ||
.split(/ /) | ||
.filter((entry) => entry).length; | ||
.filter(Boolean).length; | ||
fragments[i] = { | ||
@@ -72,3 +69,3 @@ sequence: fragments[i], | ||
function getRegexp(enzyme) { | ||
switch (enzyme.toLowerCase().replace(/[^a-z0-9]/g, '')) { | ||
switch (enzyme.toLowerCase().replaceAll(/[^\da-z]/g, '')) { | ||
case 'chymotrypsin': | ||
@@ -89,3 +86,3 @@ return /(Phe|Tyr|Trp)(?!Pro)/g; | ||
case 'any': | ||
return /()(?=[A-Z][a-z][a-z])/g; | ||
return /()(?=[A-Z][a-z]{2})/g; | ||
default: | ||
@@ -92,0 +89,0 @@ throw new Error(`Digestion enzyme: ${enzyme} is unknown`); |
@@ -23,3 +23,3 @@ export function generatePeptideFragments(mf, options) { | ||
let mfparts = mf | ||
.replace(/([a-z)0-9])([A-Z][a-z](?=[a-z]))/g, '$1 $2') | ||
.replaceAll(/([\d)a-z])([A-Z][a-z](?=[a-z]))/g, '$1 $2') | ||
.split(/ /); | ||
@@ -35,8 +35,5 @@ | ||
if (mfparts[mfparts.length - 1].includes('(')) { | ||
cTerm += mfparts[mfparts.length - 1].replace(/^[^()]*/, ''); | ||
mfparts[mfparts.length - 1] = mfparts[mfparts.length - 1].replace( | ||
/\(.*/, | ||
'', | ||
); | ||
if (mfparts.at(-1).includes('(')) { | ||
cTerm += mfparts.at(-1).replace(/^[^()]*/, ''); | ||
mfparts[mfparts.length - 1] = mfparts.at(-1).replace(/\(.*/, ''); | ||
} | ||
@@ -43,0 +40,0 @@ |
@@ -5,3 +5,3 @@ import { aminoAcids } from './aminoAcids'; | ||
export * from './allowNeutralLoss'; | ||
export * from './allowNeutralLoss.js'; | ||
export * from './chargePeptide.js'; | ||
@@ -8,0 +8,0 @@ export * from './sequenceToMF.js'; |
@@ -9,3 +9,3 @@ import { aminoAcids } from './aminoAcids'; | ||
export function calculateCharge(aas, pH = 7.0) { | ||
export function calculateCharge(aas, pH = 7) { | ||
let combined = combine(aas); | ||
@@ -82,4 +82,4 @@ if (!combined) return; | ||
} | ||
if (aaObject[aas[aas.length - 1]]) { | ||
combined.last = aaObject[aas[aas.length - 1]].pKaC; | ||
if (aaObject[aas.at(-1)]) { | ||
combined.last = aaObject[aas.at(-1)].pKaC; | ||
} else { | ||
@@ -86,0 +86,0 @@ return; |
@@ -14,6 +14,6 @@ import { aminoAcids } from './aminoAcids'; | ||
// GLY VAL HIS PHE GLY HIS GLU ARG LYS ARG TRP ASN PRO | ||
if (mf.search(/[A-Z]{3} [A-Z]{3} [A-Z]{3}/) > -1) { | ||
if (mf.search(/(?:[A-Z]{3} ){2}[A-Z]{3}/) > -1) { | ||
// this is a PDB ! | ||
let tmpmf = mf.replace(/[\r\n]+/g, ' '); | ||
tmpmf = tmpmf.replace(/(SEQRES|[0-9]+| [A-Z] | [0-9A-Z]{4-50})/g, ''); | ||
let tmpmf = mf.replaceAll(/[\n\r]+/g, ' '); | ||
tmpmf = tmpmf.replaceAll(/(SEQRES|\d+| [A-Z] | [\dA-Z]{4-50})/g, ''); | ||
// we need to correct the uppercase / lowercase | ||
@@ -23,7 +23,7 @@ let parts = tmpmf.split(' '); | ||
for (let i = 0; i < parts.length; i++) { | ||
newMF += parts[i].substr(0, 1) + parts[i].substr(1).toLowerCase(); | ||
newMF += parts[i].slice(0, 1) + parts[i].slice(1).toLowerCase(); | ||
} | ||
newMF += 'OH'; | ||
} else if (mf.includes('(') && isOneLetterCode(mf)) { | ||
// we expect one letter code with modification | ||
// we expect one-letter code with modification | ||
newMF = ''; | ||
@@ -56,3 +56,3 @@ let nTerminal = 'H'; | ||
mf.search(/[A-Z]{3}/) > -1 && | ||
mf.search(/[a-zA-Z][a-z0-9]/) === -1 | ||
mf.search(/[A-Za-z][\da-z]/) === -1 | ||
) { | ||
@@ -66,3 +66,3 @@ // UNIPROT | ||
// We remove all the number, all the spaces, etc | ||
newMF = `H${convertAA1To3(newMF.replace(/[^A-Z]/g, ''))}OH`; | ||
newMF = `H${convertAA1To3(newMF.replaceAll(/[^A-Z]/g, ''))}OH`; | ||
} | ||
@@ -69,0 +69,0 @@ |
export function splitPeptide(sequence) { | ||
let aas = sequence.replace(/([A-Z])/g, ' $1').split(/ /); | ||
let aas = sequence.replaceAll(/([A-Z])/g, ' $1').split(/ /); | ||
let begin = 0; | ||
@@ -4,0 +4,0 @@ while (aas[begin] === '' || aas[begin] === 'H') { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
81069
34
1660
2