peptide
Version:
50 lines • 1.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.chargePeptide = chargePeptide;
const getAA_1 = require("./getAA");
// SOURCE: https://en.wikipedia.org/wiki/Amino_acid
function chargePeptide(mf, options = {}) {
if (Array.isArray(mf)) {
for (let i = 0; i < mf.length; i++) {
mf[i] = chargeOnePeptide(mf[i], options);
}
return mf;
}
else {
return chargeOnePeptide(mf, options);
}
}
function chargeOnePeptide(mf, options) {
const { pH = 0 } = options;
// we will allow to charge the peptide at a specific pH
// first amino acids (N-terminal)
if (mf.match(/^H[A-Z][a-z]{2}/)) {
let firstAA = mf.replace(/^H([A-Z][a-z]{2}).*/, '$1');
if ((0, getAA_1.getAA)(firstAA) && pH < (0, getAA_1.getAA)(firstAA).pKaN) {
mf = mf.replace(/^H([^+])/, 'H+H$1');
}
}
// last amino acids (C-terminal)
if (mf.match(/[A-Z][a-z]{2}OH$/)) {
let lastAA = mf.replace(/.*([A-Z][a-z]{2})OH$/, '$1');
if ((0, getAA_1.getAA)(lastAA) && pH > (0, getAA_1.getAA)(lastAA).pKaC) {
mf = mf.replace(/OH$/, 'O-');
}
}
// basic AA
if (pH < (0, getAA_1.getAA)('Arg').sc.pKa)
mf = mf.replaceAll(/(Arg)(?!\()/g, '$1(H+)');
if (pH < (0, getAA_1.getAA)('His').sc.pKa)
mf = mf.replaceAll(/(His)(?!\()/g, '$1(H+)');
if (pH < (0, getAA_1.getAA)('Lys').sc.pKa)
mf = mf.replaceAll(/(Lys)(?!\()/g, '$1(H+)');
// acid AA
if (pH > (0, getAA_1.getAA)('Asp').sc.pKa)
mf = mf.replaceAll(/(Asp)(?!\()/g, '$1(H-1-)');
if (pH > (0, getAA_1.getAA)('Glu').sc.pKa)
mf = mf.replaceAll(/(Glu)(?!\()/g, '$1(H-1-)');
if (pH > (0, getAA_1.getAA)('Cys').sc.pKa)
mf = mf.replaceAll(/(Cys)(?!\()/g, '$1(H-1-)');
return mf;
}
//# sourceMappingURL=chargePeptide.js.map