| /** | ||
| * Add neutral loss on natural amino acids | ||
| * @param {*} mf | ||
| * @returns | ||
| */ | ||
| export function allowNeutralLoss(mf: any): any; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.allowNeutralLoss = allowNeutralLoss; | ||
| /** | ||
| * Add neutral loss on natural amino acids | ||
| * @param {*} mf | ||
| * @returns | ||
| */ | ||
| function allowNeutralLoss(mf) { | ||
| if (Array.isArray(mf)) { | ||
| for (let i = 0; i < mf.length; i++) { | ||
| mf[i] = allowOneNeutralLoss(mf[i]); | ||
| } | ||
| return mf; | ||
| } | ||
| else { | ||
| return allowOneNeutralLoss(mf); | ||
| } | ||
| } | ||
| function allowOneNeutralLoss(mf) { | ||
| 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; | ||
| } |
| export const aminoAcids: ({ | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa?: undefined; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa: number; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc?: undefined; | ||
| pKaC?: undefined; | ||
| pKaN?: undefined; | ||
| })[]; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.aminoAcids = void 0; | ||
| // SOURCE: https://en.wikipedia.org/wiki/Amino_acid | ||
| // Link for UTF8 code for modified: https://codepoints.net/search?sc=Grek | ||
| exports.aminoAcids = [ | ||
| // Standard amino acids | ||
| { | ||
| name: 'Alanine', | ||
| aa3: 'Ala', | ||
| aa1: 'A', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.33, | ||
| pKaN: 9.71, | ||
| }, | ||
| { | ||
| name: 'Arginine', | ||
| aa3: 'Arg', | ||
| aa1: 'R', | ||
| sc: { | ||
| type: 'positive', | ||
| pKa: 12.1, | ||
| }, | ||
| pKaC: 2.03, | ||
| pKaN: 9, | ||
| }, | ||
| { | ||
| name: 'Asparagine', | ||
| aa3: 'Asn', | ||
| aa1: 'N', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.13, | ||
| pKaN: 9.05, | ||
| }, | ||
| { | ||
| name: 'Aspartic acid', | ||
| aa3: 'Asp', | ||
| aa1: 'D', | ||
| sc: { | ||
| type: 'negative', | ||
| pKa: 3.71, | ||
| }, | ||
| pKaC: 1.95, | ||
| pKaN: 9.66, | ||
| }, | ||
| { | ||
| name: 'Cysteine', | ||
| aa3: 'Cys', | ||
| aa1: 'C', | ||
| sc: { | ||
| type: 'special', | ||
| pKa: 8.14, | ||
| }, | ||
| pKaC: 1.91, | ||
| pKaN: 10.28, | ||
| }, | ||
| { | ||
| name: 'Glutamic acid', | ||
| aa3: 'Glu', | ||
| aa1: 'E', | ||
| sc: { | ||
| type: 'negative', | ||
| pKa: 4.15, | ||
| }, | ||
| pKaC: 2.16, | ||
| pKaN: 9.58, | ||
| }, | ||
| { | ||
| name: 'Glutamine', | ||
| aa3: 'Gln', | ||
| aa1: 'Q', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.18, | ||
| pKaN: 9, | ||
| }, | ||
| { | ||
| name: 'Glycine', | ||
| aa3: 'Gly', | ||
| aa1: 'G', | ||
| sc: { | ||
| type: 'special', | ||
| }, | ||
| pKaC: 2.34, | ||
| pKaN: 9.58, | ||
| }, | ||
| { | ||
| name: 'Histidine', | ||
| aa3: 'His', | ||
| aa1: 'H', | ||
| sc: { | ||
| type: 'positive', | ||
| pKa: 6.04, | ||
| }, | ||
| pKaC: 1.7, | ||
| pKaN: 9.09, | ||
| }, | ||
| { | ||
| name: 'Isoleucine', | ||
| aa3: 'Ile', | ||
| aa1: 'I', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.26, | ||
| pKaN: 9.6, | ||
| }, | ||
| { | ||
| name: 'Leucine', | ||
| aa3: 'Leu', | ||
| aa1: 'L', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.32, | ||
| pKaN: 9.58, | ||
| }, | ||
| { | ||
| name: 'Lysine', | ||
| aa3: 'Lys', | ||
| aa1: 'K', | ||
| sc: { | ||
| type: 'positive', | ||
| pKa: 10.67, | ||
| }, | ||
| pKaC: 2.15, | ||
| pKaN: 9.16, | ||
| }, | ||
| { | ||
| name: 'Methionine', | ||
| aa3: 'Met', | ||
| aa1: 'M', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.16, | ||
| pKaN: 9.08, | ||
| }, | ||
| { | ||
| name: 'Phenylalanine', | ||
| aa3: 'Phe', | ||
| aa1: 'F', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.18, | ||
| pKaN: 9.09, | ||
| }, | ||
| { | ||
| name: 'Proline', | ||
| aa3: 'Pro', | ||
| aa1: 'P', | ||
| sc: { | ||
| type: 'special', | ||
| }, | ||
| pKaC: 1.95, | ||
| pKaN: 10.47, | ||
| }, | ||
| { | ||
| name: 'Serine', | ||
| aa3: 'Ser', | ||
| aa1: 'S', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.13, | ||
| pKaN: 9.05, | ||
| }, | ||
| { | ||
| name: 'Threonine', | ||
| aa3: 'Thr', | ||
| aa1: 'T', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.2, | ||
| pKaN: 8.96, | ||
| }, | ||
| { | ||
| name: 'Tryptophan', | ||
| aa3: 'Trp', | ||
| aa1: 'W', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.38, | ||
| pKaN: 9.34, | ||
| }, | ||
| { | ||
| name: 'Tyrosine', | ||
| aa3: 'Tyr', | ||
| aa1: 'Y', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.24, | ||
| pKaN: 9.04, | ||
| }, | ||
| { | ||
| name: 'Valine', | ||
| aa3: 'Val', | ||
| aa1: 'V', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.27, | ||
| pKaN: 9.52, | ||
| }, | ||
| // Additional | ||
| { | ||
| name: 'Selenocysteine', | ||
| aa3: 'Sec', | ||
| aa1: 'U', | ||
| }, | ||
| { | ||
| name: 'Pyrrolysine', | ||
| aa3: 'Pyl', | ||
| aa1: 'O', | ||
| }, | ||
| // Ambiguous | ||
| { | ||
| name: 'Asparagine or aspartic acid', | ||
| aa3: 'Asx', | ||
| aa1: 'B', | ||
| }, | ||
| { | ||
| name: 'Glutamine or glutamic acid', | ||
| aa3: 'Glx', | ||
| aa1: 'Z', | ||
| }, | ||
| { | ||
| name: 'Leucine or isoleucine', | ||
| aa3: 'Xle', | ||
| aa1: 'J', | ||
| }, | ||
| { | ||
| name: 'Unspecified or unknown', | ||
| aa3: 'Xaa', | ||
| aa1: 'X', | ||
| }, | ||
| ]; |
| export function chargePeptide(mf: any, options?: {}): any; |
| "use strict"; | ||
| 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; | ||
| } |
| export function digestPeptide(sequence: any, options?: {}): string[]; |
| "use strict"; | ||
| /* | ||
| Iotuibs: | ||
| * minMissed (default: 0) | ||
| * maxMissed (default: 0) | ||
| * minResidue: 0; | ||
| * maxResidue: infinity | ||
| * enzyme: chymotrypsin, trypsin, glucph4, glucph8, thermolysin, cyanogenbromide : Mandatory, no default value ! | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.digestPeptide = digestPeptide; | ||
| function digestPeptide(sequence, options = {}) { | ||
| sequence = sequence.replace(/^H([^a-z])/, '$1').replace(/OH$/, ''); | ||
| options.enzyme = options.enzyme || 'trypsin'; | ||
| if (options.minMissed === undefined) | ||
| options.minMissed = 0; | ||
| if (options.maxMissed === undefined) | ||
| options.maxMissed = 0; | ||
| if (options.minResidue === undefined) | ||
| options.minResidue = 0; | ||
| if (options.maxResidue === undefined) | ||
| options.maxResidue = Number.MAX_VALUE; | ||
| let regexp = getRegexp(options.enzyme); | ||
| let fragments = sequence.replace(regexp, '$1 ').split(/ /).filter(Boolean); | ||
| { | ||
| let from = 0; | ||
| for (let i = 0; i < fragments.length; i++) { | ||
| let nbResidue = fragments[i] | ||
| .replaceAll(/([A-Z][a-z]{2})/g, ' $1') | ||
| .split(/ /) | ||
| .filter(Boolean).length; | ||
| fragments[i] = { | ||
| sequence: fragments[i], | ||
| nbResidue, | ||
| from, | ||
| to: from + nbResidue - 1, | ||
| }; | ||
| from += nbResidue; | ||
| } | ||
| } | ||
| let results = []; | ||
| for (let i = 0; i < fragments.length - options.minMissed; i++) { | ||
| for (let j = options.minMissed; j <= Math.min(options.maxMissed, fragments.length - i - 1); j++) { | ||
| let fragment = ''; | ||
| let nbResidue = 0; | ||
| for (let k = i; k <= i + j; k++) { | ||
| fragment += fragments[k].sequence; | ||
| nbResidue += fragments[k].nbResidue; | ||
| } | ||
| let from = fragments[i].from + 1; | ||
| let to = fragments[i + j].to + 1; | ||
| if (fragment && | ||
| nbResidue >= options.minResidue && | ||
| nbResidue <= options.maxResidue) { | ||
| results.push(`H${fragment}OH$D${from}>${to}`); | ||
| } | ||
| } | ||
| } | ||
| return results; | ||
| } | ||
| function getRegexp(enzyme) { | ||
| switch (enzyme.toLowerCase().replaceAll(/[^\da-z]/g, '')) { | ||
| case 'chymotrypsin': | ||
| return /(Phe|Tyr|Trp)(?!Pro)/g; | ||
| case 'trypsin': | ||
| return /(Lys|Arg)(?!Pro)/g; | ||
| case 'lysc': | ||
| return /(Lys)(?!Pro)/g; | ||
| case 'glucph4': | ||
| return /(Glu)(?!Pro|Glu)/g; | ||
| case 'glucph8': | ||
| return /(Asp|Glu)(?!Pro|Glu)/g; | ||
| case 'thermolysin': // N-term of Leu, Phe, Val, Ile, Ala, Met | ||
| return /()(?=Ile|Leu|Val|Ala|Met|Phe)/g; | ||
| case 'cyanogenbromide': | ||
| return /(Met)/g; | ||
| case 'any': | ||
| return /()(?=[A-Z][a-z]{2})/g; | ||
| default: | ||
| throw new Error(`Digestion enzyme: ${enzyme} is unknown`); | ||
| } | ||
| } |
| export function generatePeptideFragments(mf: any, options: any): string[]; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.generatePeptideFragments = generatePeptideFragments; | ||
| function generatePeptideFragments(mf, options) { | ||
| if (options === undefined) { | ||
| options = { | ||
| a: false, | ||
| b: true, | ||
| c: false, | ||
| x: false, | ||
| y: true, | ||
| z: false, | ||
| i: false, | ||
| ya: false, | ||
| yb: false, | ||
| yc: false, | ||
| zc: false, | ||
| }; | ||
| } | ||
| options.maxInternal = options.maxInternal || Number.MAX_VALUE; | ||
| options.minInternal = options.minInternal || 0; | ||
| let mfs = []; | ||
| // need to allow 0-9 to deal with neutral loss | ||
| let mfparts = mf | ||
| .replaceAll(/([\d)a-z])([A-Z][a-z](?=[a-z]))/g, '$1 $2') | ||
| .split(/ /); | ||
| let nTerm = ''; | ||
| let cTerm = ''; | ||
| if (mfparts[0].startsWith('(')) { | ||
| nTerm += mfparts[0]; | ||
| mfparts = mfparts.splice(1); | ||
| } | ||
| if (mfparts.at(-1).includes('(')) { | ||
| cTerm += mfparts.at(-1).replace(/^[^()]*/, ''); | ||
| mfparts[mfparts.length - 1] = mfparts.at(-1).replace(/\(.*/, ''); | ||
| } | ||
| for (let i = 1; i < mfparts.length; i++) { | ||
| nTerm += mfparts[i - 1]; | ||
| cTerm = mfparts[mfparts.length - i] + cTerm; | ||
| addNTerm(mfs, nTerm, i, options); | ||
| addCTerm(mfs, cTerm, i, options); | ||
| if (options.i) | ||
| mfs.push(`${mfparts[i]}HC-1O-1(+1)$i:${mfparts[i]}`); | ||
| if (options.ya || options.yb || options.yc || options.zc) { | ||
| // we have double fragmentations | ||
| for (let j = i + 1; j < Math.min(mfparts.length, options.maxInternal + i + 1); j++) { | ||
| let iTerm = ''; | ||
| if (j - i >= options.minInternal) { | ||
| for (let k = i; k < j; k++) { | ||
| iTerm += mfparts[k]; | ||
| } | ||
| addITerm(mfs, iTerm, mfparts.length - i, j, options); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| // todo does this make sense ??? I think we should remote those 3 lines | ||
| if (mfs.length === 0) { | ||
| mfs = mfs.concat([mf]); | ||
| } | ||
| return mfs; | ||
| } | ||
| function addNTerm(mfs, nTerm, i, options) { | ||
| if (options.a) | ||
| mfs.push(`${nTerm}C-1O-1(+1)$a${i}`); | ||
| if (options.b) | ||
| mfs.push(`${nTerm}(+1)$b${i}`); | ||
| if (options.c) | ||
| mfs.push(`${nTerm}NH3(+1)$c${i}`); | ||
| } | ||
| function addITerm(mfs, iTerm, i, j, options) { | ||
| if (options.ya) | ||
| mfs.push(`H${iTerm}C-1O-1(+1)$a${j}y${i}`); | ||
| if (options.yb) | ||
| mfs.push(`H${iTerm}(+1)$b${j}y${i}`); | ||
| if (options.yc) | ||
| mfs.push(`H${iTerm}NH3(+1)$c${j}y${i}`); | ||
| if (options.zc) | ||
| mfs.push(`N-1${iTerm}NH3(+1)$c${j}z${i}`); | ||
| } | ||
| function addCTerm(mfs, cTerm, i, options) { | ||
| if (options.x) | ||
| mfs.push(`CO(+1)${cTerm}$x${i}`); | ||
| if (options.y) | ||
| mfs.push(`H2(+1)${cTerm}$y${i}`); | ||
| if (options.z) | ||
| mfs.push(`N-1H-1(+1)${cTerm}$z${i}`); | ||
| } |
| export function getAA(code: any): { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa?: undefined; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa: number; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc?: undefined; | ||
| pKaC?: undefined; | ||
| pKaN?: undefined; | ||
| }; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getAA = getAA; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| function getAA(code) { | ||
| if (code.length === 1) { | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| if (aminoAcids_1.aminoAcids[i].aa1 === code) { | ||
| return aminoAcids_1.aminoAcids[i]; | ||
| } | ||
| } | ||
| } | ||
| if (code.length === 3) { | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| if (aminoAcids_1.aminoAcids[i].aa3 === code) { | ||
| return aminoAcids_1.aminoAcids[i]; | ||
| } | ||
| } | ||
| } | ||
| } |
| export function getInfo(): ({ | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa?: undefined; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa: number; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc?: undefined; | ||
| pKaC?: undefined; | ||
| pKaN?: undefined; | ||
| })[]; | ||
| export function calculateIEP(sequence: any): number; | ||
| export function calculateIEPChart(sequence: any): { | ||
| first: any; | ||
| last: any; | ||
| basic: {}; | ||
| acid: {}; | ||
| }; | ||
| export function getColorForIEP(iep: any): string; | ||
| export function calculateCharge(sequence: any, ph: any): number; | ||
| export * from "./allowNeutralLoss.js"; | ||
| export * from "./chargePeptide.js"; | ||
| export * from "./sequenceToMF.js"; | ||
| export * from "./generatePeptideFragments.js"; | ||
| export * from "./digestPeptide.js"; | ||
| export * from "./splitPeptide.js"; |
| "use strict"; | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getInfo = getInfo; | ||
| exports.calculateIEP = calculateIEP; | ||
| exports.calculateIEPChart = calculateIEPChart; | ||
| exports.getColorForIEP = getColorForIEP; | ||
| exports.calculateCharge = calculateCharge; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| const IEP = __importStar(require("./isoElectricPoint")); | ||
| const splitPeptide_js_1 = require("./splitPeptide.js"); | ||
| __exportStar(require("./allowNeutralLoss.js"), exports); | ||
| __exportStar(require("./chargePeptide.js"), exports); | ||
| __exportStar(require("./sequenceToMF.js"), exports); | ||
| __exportStar(require("./generatePeptideFragments.js"), exports); | ||
| __exportStar(require("./digestPeptide.js"), exports); | ||
| __exportStar(require("./splitPeptide.js"), exports); | ||
| function getInfo() { | ||
| return aminoAcids_1.aminoAcids; | ||
| } | ||
| // sequence should be in the "right" format like HAlaGlyProOH | ||
| function calculateIEP(sequence) { | ||
| let aas = (0, splitPeptide_js_1.splitPeptide)(sequence); | ||
| let result = IEP.calculateIEP(aas); | ||
| return result; | ||
| } | ||
| function calculateIEPChart(sequence) { | ||
| let aas = (0, splitPeptide_js_1.splitPeptide)(sequence); | ||
| let result = IEP.calculateChart(aas); | ||
| return result; | ||
| } | ||
| function getColorForIEP(iep) { | ||
| return IEP.getColor(iep); | ||
| } | ||
| function calculateCharge(sequence, ph) { | ||
| let aas = (0, splitPeptide_js_1.splitPeptide)(sequence); | ||
| return IEP.calculateCharge(aas, ph); | ||
| } |
| export function calculateCharge(aas: any, pH?: number): number; | ||
| export function calculateIEP(aas: any): number; | ||
| export function calculateChart(aas: any): { | ||
| first: any; | ||
| last: any; | ||
| basic: {}; | ||
| acid: {}; | ||
| }; | ||
| export function getColor(iep: any): string; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.calculateCharge = calculateCharge; | ||
| exports.calculateIEP = calculateIEP; | ||
| exports.calculateChart = calculateChart; | ||
| exports.getColor = getColor; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| // we will convert the data to an object to be much faster | ||
| let aaObject = {}; | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| aaObject[aminoAcids_1.aminoAcids[i].aa3] = aminoAcids_1.aminoAcids[i]; | ||
| } | ||
| function calculateCharge(aas, pH = 7) { | ||
| let combined = combine(aas); | ||
| if (!combined) | ||
| return; | ||
| let charge = calculateForPh(combined, pH); | ||
| return Math.round(charge * 1000) / 1000; | ||
| } | ||
| // this methods required an array of aas | ||
| function calculateIEP(aas) { | ||
| let combined = combine(aas); | ||
| if (!combined) | ||
| return; | ||
| let first = 0; | ||
| let last = 14; | ||
| let current = 14; | ||
| let previous = 0; | ||
| let currentCharge; | ||
| while (Math.abs(current - previous) > 0.0001) { | ||
| previous = current; | ||
| current = (last + first) / 2; | ||
| currentCharge = calculateForPh(combined, current); | ||
| if (currentCharge > 0) { | ||
| first = current; | ||
| } | ||
| else if (currentCharge < 0) { | ||
| last = current; | ||
| } | ||
| else { | ||
| previous = current; | ||
| } | ||
| } | ||
| return Math.round(current * 1000) / 1000; | ||
| } | ||
| function calculateChart(aas) { | ||
| let combined = combine(aas); | ||
| if (!combined) | ||
| return; | ||
| let y = []; | ||
| let x = []; | ||
| let yAbs = []; | ||
| for (let i = 0; i <= 14; i = i + 0.01) { | ||
| let charge = calculateForPh(combined, i); | ||
| x.push(i); | ||
| y.push(charge); | ||
| yAbs.push(Math.abs(charge)); | ||
| } | ||
| combined.x = x; | ||
| combined.y = y; | ||
| combined.yAbs = yAbs; | ||
| return combined; | ||
| } | ||
| function calculateForPh(combined, pH) { | ||
| let total = 0; | ||
| 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 + 10 ** (aaObject[key].sc.pKa - pH)); | ||
| } | ||
| for (let key in combined.basic) { | ||
| total += combined.basic[key] / (1 + 10 ** (pH - aaObject[key].sc.pKa)); | ||
| } | ||
| return total; | ||
| } | ||
| // we will combine the amino acids | ||
| function combine(aas) { | ||
| let combined = {}; | ||
| if (aaObject[aas[0]]) { | ||
| combined.first = aaObject[aas[0]].pKaN; | ||
| } | ||
| else { | ||
| return; | ||
| } | ||
| if (aaObject[aas.at(-1)]) { | ||
| combined.last = aaObject[aas.at(-1)].pKaC; | ||
| } | ||
| else { | ||
| return; | ||
| } | ||
| combined.basic = {}; | ||
| combined.acid = {}; | ||
| for (let i = 0; i < aas.length; i++) { | ||
| let currentAA = aas[i]; | ||
| if (!aaObject[currentAA]) | ||
| return; | ||
| if (aaObject[currentAA].sc && aaObject[currentAA].sc.type) { | ||
| if (aaObject[currentAA].sc.type === 'positive') { | ||
| if (!combined.basic[currentAA]) { | ||
| combined.basic[currentAA] = 0; | ||
| } | ||
| combined.basic[currentAA]++; | ||
| } | ||
| else if (aaObject[currentAA].sc.type === 'negative') { | ||
| if (!combined.acid[currentAA]) { | ||
| combined.acid[currentAA] = 0; | ||
| } | ||
| combined.acid[currentAA]++; | ||
| } | ||
| } | ||
| } | ||
| return combined; | ||
| } | ||
| /* | ||
| We can generate a color based on iep | ||
| 0 -> 7 means that at pH 7 it is charged negatively (blue) | ||
| 7 -> 14 means that at pH7 it is charged positively (red) | ||
| */ | ||
| function getColor(iep) { | ||
| if (iep < 7) { | ||
| if (iep < 3) | ||
| iep = 3; | ||
| let white = Math.round(255 - (7 - iep) * (200 / 4)); | ||
| return `rgb(${white},${white},255)`; | ||
| } | ||
| else if (iep > 7) { | ||
| if (iep > 11) | ||
| iep = 11; | ||
| let white = Math.round(255 - (iep - 7) * (200 / 4)); | ||
| return `rgb(255,${white},${white})`; | ||
| } | ||
| return 'rgb(255,255,255)'; | ||
| } |
| export function sequenceToMF(mf: any): any; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.sequenceToMF = sequenceToMF; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| function sequenceToMF(mf) { | ||
| // this function will check if it is a sequence of aa in 1 letter or 3 letters and convert them if it is the case | ||
| // it could be a multiline mf ! | ||
| // if it is a multiline we could make some "tricks" ... | ||
| let newMF = mf; | ||
| // SEQRES 1 B 256 MET PRO VAL GLU ILE THR VAL LYS GLU LEU LEU GLU ALA | ||
| // SEQRES 2 B 256 GLY VAL HIS PHE GLY HIS GLU ARG LYS ARG TRP ASN PRO | ||
| // or | ||
| // MET PRO VAL GLU ILE THR VAL LYS GLU LEU LEU GLU ALA | ||
| // GLY VAL HIS PHE GLY HIS GLU ARG LYS ARG TRP ASN PRO | ||
| if (mf.search(/(?:[A-Z]{3} ){2}[A-Z]{3}/) > -1) { | ||
| // this is a PDB ! | ||
| 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 | ||
| let parts = tmpmf.split(' '); | ||
| newMF = 'H'; | ||
| for (let i = 0; i < parts.length; i++) { | ||
| 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 | ||
| newMF = ''; | ||
| let nTerminal = 'H'; | ||
| let cTerminal = 'OH'; | ||
| let parenthesisCounter = 0; | ||
| for (let i = 0; i < mf.length; i++) { | ||
| let currentSymbol = mf[i]; | ||
| if (currentSymbol === '(' || | ||
| currentSymbol === ')' || | ||
| parenthesisCounter > 0) { | ||
| if (currentSymbol === '(') { | ||
| parenthesisCounter++; | ||
| if (i === 0) | ||
| nTerminal = ''; | ||
| } | ||
| if (currentSymbol === ')') { | ||
| parenthesisCounter--; | ||
| if (i === mf.length - 1) | ||
| cTerminal = ''; | ||
| } | ||
| newMF += currentSymbol; | ||
| continue; | ||
| } | ||
| newMF += convertAA1To3(currentSymbol); | ||
| } | ||
| newMF = nTerminal + newMF + cTerminal; | ||
| } | ||
| else if (mf.search(/[A-Z]{3}/) > -1 && | ||
| mf.search(/[A-Za-z][\da-z]/) === -1) { | ||
| // UNIPROT | ||
| // 370 380 390 400 410 420 | ||
| //GFKPNLRKTF VSGLFRESCG AHFYRGVDVK PFYIKKPVDN LFALMLILNR LRGWGVVGGM | ||
| // | ||
| // 430 440 450 460 470 480 | ||
| //SDPRLYKVWV RLSSQVPSMF FGGTDLAADY YVVSPPTAVS VYTKTPYGRL LADTRTSGFR | ||
| // We remove all the number, all the spaces, etc | ||
| newMF = `H${convertAA1To3(newMF.replaceAll(/[^A-Z]/g, ''))}OH`; | ||
| } | ||
| return newMF; | ||
| } | ||
| function convertAA1To3(mf) { | ||
| let newmf = ''; | ||
| for (let i = 0; i < mf.length; i++) { | ||
| newmf += aa1To3(mf.charAt(i)); | ||
| } | ||
| return newmf; | ||
| } | ||
| function aa1To3(code) { | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| if (aminoAcids_1.aminoAcids[i].aa1 === code) { | ||
| return aminoAcids_1.aminoAcids[i].aa3; | ||
| } | ||
| } | ||
| throw new Error(`Invalid 1 letter code: ${code}`); | ||
| } | ||
| // mf can contain as well parenthesis. We need to check if it is not yet a correct molecular formula | ||
| function isOneLetterCode(mf) { | ||
| let parenthesisLevel = 0; | ||
| for (let char of mf) { | ||
| if (parenthesisLevel === 0 && char.match(/[a-z]/)) | ||
| return false; | ||
| if (char === '(') | ||
| parenthesisLevel++; | ||
| if (char === ')') | ||
| parenthesisLevel--; | ||
| } | ||
| return true; | ||
| } |
| export function splitPeptide(sequence: any): any; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.splitPeptide = splitPeptide; | ||
| function splitPeptide(sequence) { | ||
| let aas = sequence.replaceAll(/([A-Z])/g, ' $1').split(/ /); | ||
| let begin = 0; | ||
| while (aas[begin] === '' || aas[begin] === 'H') { | ||
| begin++; | ||
| } | ||
| let end = aas.length - 1; | ||
| while (aas[end] === 'O' || aas[end] === 'H') { | ||
| end--; | ||
| } | ||
| aas = aas.slice(begin, end + 1); | ||
| return aas; | ||
| } |
Sorry, the diff of this file is not supported yet
+3
-3
| { | ||
| "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 @@ |
+1
-1
@@ -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') { |
| /** | ||
| * Add neutral loss on natural amino acids | ||
| * @param {*} mf | ||
| * @returns | ||
| */ | ||
| export function allowNeutralLoss(mf: any): any; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.allowNeutralLoss = allowNeutralLoss; | ||
| /** | ||
| * Add neutral loss on natural amino acids | ||
| * @param {*} mf | ||
| * @returns | ||
| */ | ||
| function allowNeutralLoss(mf) { | ||
| if (Array.isArray(mf)) { | ||
| for (let i = 0; i < mf.length; i++) { | ||
| mf[i] = allowOneNeutralLoss(mf[i]); | ||
| } | ||
| return mf; | ||
| } | ||
| else { | ||
| return allowOneNeutralLoss(mf); | ||
| } | ||
| } | ||
| 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'); | ||
| return mf; | ||
| } |
| export const aminoAcids: ({ | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa?: undefined; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa: number; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc?: undefined; | ||
| pKaC?: undefined; | ||
| pKaN?: undefined; | ||
| })[]; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.aminoAcids = void 0; | ||
| // SOURCE: https://en.wikipedia.org/wiki/Amino_acid | ||
| // Link for UTF8 code for modified: https://codepoints.net/search?sc=Grek | ||
| exports.aminoAcids = [ | ||
| // Standard amino acids | ||
| { | ||
| name: 'Alanine', | ||
| aa3: 'Ala', | ||
| aa1: 'A', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.33, | ||
| pKaN: 9.71, | ||
| }, | ||
| { | ||
| name: 'Arginine', | ||
| aa3: 'Arg', | ||
| aa1: 'R', | ||
| sc: { | ||
| type: 'positive', | ||
| pKa: 12.1, | ||
| }, | ||
| pKaC: 2.03, | ||
| pKaN: 9.0, | ||
| }, | ||
| { | ||
| name: 'Asparagine', | ||
| aa3: 'Asn', | ||
| aa1: 'N', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.13, | ||
| pKaN: 9.05, | ||
| }, | ||
| { | ||
| name: 'Aspartic acid', | ||
| aa3: 'Asp', | ||
| aa1: 'D', | ||
| sc: { | ||
| type: 'negative', | ||
| pKa: 3.71, | ||
| }, | ||
| pKaC: 1.95, | ||
| pKaN: 9.66, | ||
| }, | ||
| { | ||
| name: 'Cysteine', | ||
| aa3: 'Cys', | ||
| aa1: 'C', | ||
| sc: { | ||
| type: 'special', | ||
| pKa: 8.14, | ||
| }, | ||
| pKaC: 1.91, | ||
| pKaN: 10.28, | ||
| }, | ||
| { | ||
| name: 'Glutamic acid', | ||
| aa3: 'Glu', | ||
| aa1: 'E', | ||
| sc: { | ||
| type: 'negative', | ||
| pKa: 4.15, | ||
| }, | ||
| pKaC: 2.16, | ||
| pKaN: 9.58, | ||
| }, | ||
| { | ||
| name: 'Glutamine', | ||
| aa3: 'Gln', | ||
| aa1: 'Q', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.18, | ||
| pKaN: 9.0, | ||
| }, | ||
| { | ||
| name: 'Glycine', | ||
| aa3: 'Gly', | ||
| aa1: 'G', | ||
| sc: { | ||
| type: 'special', | ||
| }, | ||
| pKaC: 2.34, | ||
| pKaN: 9.58, | ||
| }, | ||
| { | ||
| name: 'Histidine', | ||
| aa3: 'His', | ||
| aa1: 'H', | ||
| sc: { | ||
| type: 'positive', | ||
| pKa: 6.04, | ||
| }, | ||
| pKaC: 1.7, | ||
| pKaN: 9.09, | ||
| }, | ||
| { | ||
| name: 'Isoleucine', | ||
| aa3: 'Ile', | ||
| aa1: 'I', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.26, | ||
| pKaN: 9.6, | ||
| }, | ||
| { | ||
| name: 'Leucine', | ||
| aa3: 'Leu', | ||
| aa1: 'L', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.32, | ||
| pKaN: 9.58, | ||
| }, | ||
| { | ||
| name: 'Lysine', | ||
| aa3: 'Lys', | ||
| aa1: 'K', | ||
| sc: { | ||
| type: 'positive', | ||
| pKa: 10.67, | ||
| }, | ||
| pKaC: 2.15, | ||
| pKaN: 9.16, | ||
| }, | ||
| { | ||
| name: 'Methionine', | ||
| aa3: 'Met', | ||
| aa1: 'M', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.16, | ||
| pKaN: 9.08, | ||
| }, | ||
| { | ||
| name: 'Phenylalanine', | ||
| aa3: 'Phe', | ||
| aa1: 'F', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.18, | ||
| pKaN: 9.09, | ||
| }, | ||
| { | ||
| name: 'Proline', | ||
| aa3: 'Pro', | ||
| aa1: 'P', | ||
| sc: { | ||
| type: 'special', | ||
| }, | ||
| pKaC: 1.95, | ||
| pKaN: 10.47, | ||
| }, | ||
| { | ||
| name: 'Serine', | ||
| aa3: 'Ser', | ||
| aa1: 'S', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.13, | ||
| pKaN: 9.05, | ||
| }, | ||
| { | ||
| name: 'Threonine', | ||
| aa3: 'Thr', | ||
| aa1: 'T', | ||
| sc: { | ||
| type: 'polar', | ||
| }, | ||
| pKaC: 2.2, | ||
| pKaN: 8.96, | ||
| }, | ||
| { | ||
| name: 'Tryptophan', | ||
| aa3: 'Trp', | ||
| aa1: 'W', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.38, | ||
| pKaN: 9.34, | ||
| }, | ||
| { | ||
| name: 'Tyrosine', | ||
| aa3: 'Tyr', | ||
| aa1: 'Y', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.24, | ||
| pKaN: 9.04, | ||
| }, | ||
| { | ||
| name: 'Valine', | ||
| aa3: 'Val', | ||
| aa1: 'V', | ||
| sc: { | ||
| type: 'hydrophobic', | ||
| }, | ||
| pKaC: 2.27, | ||
| pKaN: 9.52, | ||
| }, | ||
| // Additional | ||
| { | ||
| name: 'Selenocysteine', | ||
| aa3: 'Sec', | ||
| aa1: 'U', | ||
| }, | ||
| { | ||
| name: 'Pyrrolysine', | ||
| aa3: 'Pyl', | ||
| aa1: 'O', | ||
| }, | ||
| // Ambiguous | ||
| { | ||
| name: 'Asparagine or aspartic acid', | ||
| aa3: 'Asx', | ||
| aa1: 'B', | ||
| }, | ||
| { | ||
| name: 'Glutamine or glutamic acid', | ||
| aa3: 'Glx', | ||
| aa1: 'Z', | ||
| }, | ||
| { | ||
| name: 'Leucine or isoleucine', | ||
| aa3: 'Xle', | ||
| aa1: 'J', | ||
| }, | ||
| { | ||
| name: 'Unspecified or unknown', | ||
| aa3: 'Xaa', | ||
| aa1: 'X', | ||
| }, | ||
| ]; |
| export function chargePeptide(mf: any, options?: {}): any; |
| "use strict"; | ||
| 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.replace(/(Arg)(?!\()/g, '$1(H+)'); | ||
| if (pH < (0, getAA_1.getAA)('His').sc.pKa) | ||
| mf = mf.replace(/(His)(?!\()/g, '$1(H+)'); | ||
| if (pH < (0, getAA_1.getAA)('Lys').sc.pKa) | ||
| mf = mf.replace(/(Lys)(?!\()/g, '$1(H+)'); | ||
| // acid AA | ||
| if (pH > (0, getAA_1.getAA)('Asp').sc.pKa) | ||
| mf = mf.replace(/(Asp)(?!\()/g, '$1(H-1-)'); | ||
| if (pH > (0, getAA_1.getAA)('Glu').sc.pKa) | ||
| mf = mf.replace(/(Glu)(?!\()/g, '$1(H-1-)'); | ||
| if (pH > (0, getAA_1.getAA)('Cys').sc.pKa) | ||
| mf = mf.replace(/(Cys)(?!\()/g, '$1(H-1-)'); | ||
| return mf; | ||
| } |
| export function digestPeptide(sequence: any, options?: {}): string[]; |
| "use strict"; | ||
| /* | ||
| Iotuibs: | ||
| * minMissed (default: 0) | ||
| * maxMissed (default: 0) | ||
| * minResidue: 0; | ||
| * maxResidue: infinity | ||
| * enzyme: chymotrypsin, trypsin, glucph4, glucph8, thermolysin, cyanogenbromide : Mandatory, no default value ! | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.digestPeptide = digestPeptide; | ||
| function digestPeptide(sequence, options = {}) { | ||
| sequence = sequence.replace(/^H([^a-z])/, '$1').replace(/OH$/, ''); | ||
| options.enzyme = options.enzyme || 'trypsin'; | ||
| if (options.minMissed === undefined) | ||
| options.minMissed = 0; | ||
| if (options.maxMissed === undefined) | ||
| options.maxMissed = 0; | ||
| if (options.minResidue === undefined) | ||
| options.minResidue = 0; | ||
| if (options.maxResidue === undefined) | ||
| options.maxResidue = Number.MAX_VALUE; | ||
| let regexp = getRegexp(options.enzyme); | ||
| let fragments = sequence | ||
| .replace(regexp, '$1 ') | ||
| .split(/ /) | ||
| .filter((entry) => entry); | ||
| { | ||
| let from = 0; | ||
| for (let i = 0; i < fragments.length; i++) { | ||
| let nbResidue = fragments[i] | ||
| .replace(/([A-Z][a-z][a-z])/g, ' $1') | ||
| .split(/ /) | ||
| .filter((entry) => entry).length; | ||
| fragments[i] = { | ||
| sequence: fragments[i], | ||
| nbResidue, | ||
| from, | ||
| to: from + nbResidue - 1, | ||
| }; | ||
| from += nbResidue; | ||
| } | ||
| } | ||
| let results = []; | ||
| for (let i = 0; i < fragments.length - options.minMissed; i++) { | ||
| for (let j = options.minMissed; j <= Math.min(options.maxMissed, fragments.length - i - 1); j++) { | ||
| let fragment = ''; | ||
| let nbResidue = 0; | ||
| for (let k = i; k <= i + j; k++) { | ||
| fragment += fragments[k].sequence; | ||
| nbResidue += fragments[k].nbResidue; | ||
| } | ||
| let from = fragments[i].from + 1; | ||
| let to = fragments[i + j].to + 1; | ||
| if (fragment && | ||
| nbResidue >= options.minResidue && | ||
| nbResidue <= options.maxResidue) { | ||
| results.push(`H${fragment}OH$D${from}>${to}`); | ||
| } | ||
| } | ||
| } | ||
| return results; | ||
| } | ||
| function getRegexp(enzyme) { | ||
| switch (enzyme.toLowerCase().replace(/[^a-z0-9]/g, '')) { | ||
| case 'chymotrypsin': | ||
| return /(Phe|Tyr|Trp)(?!Pro)/g; | ||
| case 'trypsin': | ||
| return /(Lys|Arg)(?!Pro)/g; | ||
| case 'lysc': | ||
| return /(Lys)(?!Pro)/g; | ||
| case 'glucph4': | ||
| return /(Glu)(?!Pro|Glu)/g; | ||
| case 'glucph8': | ||
| return /(Asp|Glu)(?!Pro|Glu)/g; | ||
| case 'thermolysin': // N-term of Leu, Phe, Val, Ile, Ala, Met | ||
| return /()(?=Ile|Leu|Val|Ala|Met|Phe)/g; | ||
| case 'cyanogenbromide': | ||
| return /(Met)/g; | ||
| case 'any': | ||
| return /()(?=[A-Z][a-z][a-z])/g; | ||
| default: | ||
| throw new Error(`Digestion enzyme: ${enzyme} is unknown`); | ||
| } | ||
| } |
| export function generatePeptideFragments(mf: any, options: any): string[]; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.generatePeptideFragments = generatePeptideFragments; | ||
| function generatePeptideFragments(mf, options) { | ||
| if (options === undefined) { | ||
| options = { | ||
| a: false, | ||
| b: true, | ||
| c: false, | ||
| x: false, | ||
| y: true, | ||
| z: false, | ||
| i: false, | ||
| ya: false, | ||
| yb: false, | ||
| yc: false, | ||
| zc: false, | ||
| }; | ||
| } | ||
| options.maxInternal = options.maxInternal || Number.MAX_VALUE; | ||
| options.minInternal = options.minInternal || 0; | ||
| let mfs = []; | ||
| // need to allow 0-9 to deal with neutral loss | ||
| let mfparts = mf | ||
| .replace(/([a-z)0-9])([A-Z][a-z](?=[a-z]))/g, '$1 $2') | ||
| .split(/ /); | ||
| let nTerm = ''; | ||
| let cTerm = ''; | ||
| if (mfparts[0].startsWith('(')) { | ||
| nTerm += mfparts[0]; | ||
| mfparts = mfparts.splice(1); | ||
| } | ||
| if (mfparts[mfparts.length - 1].includes('(')) { | ||
| cTerm += mfparts[mfparts.length - 1].replace(/^[^()]*/, ''); | ||
| mfparts[mfparts.length - 1] = mfparts[mfparts.length - 1].replace(/\(.*/, ''); | ||
| } | ||
| for (let i = 1; i < mfparts.length; i++) { | ||
| nTerm += mfparts[i - 1]; | ||
| cTerm = mfparts[mfparts.length - i] + cTerm; | ||
| addNTerm(mfs, nTerm, i, options); | ||
| addCTerm(mfs, cTerm, i, options); | ||
| if (options.i) | ||
| mfs.push(`${mfparts[i]}HC-1O-1(+1)$i:${mfparts[i]}`); | ||
| if (options.ya || options.yb || options.yc || options.zc) { | ||
| // we have double fragmentations | ||
| for (let j = i + 1; j < Math.min(mfparts.length, options.maxInternal + i + 1); j++) { | ||
| let iTerm = ''; | ||
| if (j - i >= options.minInternal) { | ||
| for (let k = i; k < j; k++) { | ||
| iTerm += mfparts[k]; | ||
| } | ||
| addITerm(mfs, iTerm, mfparts.length - i, j, options); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| // todo does this make sense ??? I think we should remote those 3 lines | ||
| if (mfs.length === 0) { | ||
| mfs = mfs.concat([mf]); | ||
| } | ||
| return mfs; | ||
| } | ||
| function addNTerm(mfs, nTerm, i, options) { | ||
| if (options.a) | ||
| mfs.push(`${nTerm}C-1O-1(+1)$a${i}`); | ||
| if (options.b) | ||
| mfs.push(`${nTerm}(+1)$b${i}`); | ||
| if (options.c) | ||
| mfs.push(`${nTerm}NH3(+1)$c${i}`); | ||
| } | ||
| function addITerm(mfs, iTerm, i, j, options) { | ||
| if (options.ya) | ||
| mfs.push(`H${iTerm}C-1O-1(+1)$a${j}y${i}`); | ||
| if (options.yb) | ||
| mfs.push(`H${iTerm}(+1)$b${j}y${i}`); | ||
| if (options.yc) | ||
| mfs.push(`H${iTerm}NH3(+1)$c${j}y${i}`); | ||
| if (options.zc) | ||
| mfs.push(`N-1${iTerm}NH3(+1)$c${j}z${i}`); | ||
| } | ||
| function addCTerm(mfs, cTerm, i, options) { | ||
| if (options.x) | ||
| mfs.push(`CO(+1)${cTerm}$x${i}`); | ||
| if (options.y) | ||
| mfs.push(`H2(+1)${cTerm}$y${i}`); | ||
| if (options.z) | ||
| mfs.push(`N-1H-1(+1)${cTerm}$z${i}`); | ||
| } |
| export function getAA(code: any): { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa?: undefined; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa: number; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc?: undefined; | ||
| pKaC?: undefined; | ||
| pKaN?: undefined; | ||
| }; |
-20
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getAA = getAA; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| function getAA(code) { | ||
| if (code.length === 1) { | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| if (aminoAcids_1.aminoAcids[i].aa1 === code) { | ||
| return aminoAcids_1.aminoAcids[i]; | ||
| } | ||
| } | ||
| } | ||
| if (code.length === 3) { | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| if (aminoAcids_1.aminoAcids[i].aa3 === code) { | ||
| return aminoAcids_1.aminoAcids[i]; | ||
| } | ||
| } | ||
| } | ||
| } |
| export function getInfo(): ({ | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa?: undefined; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc: { | ||
| type: string; | ||
| pKa: number; | ||
| }; | ||
| pKaC: number; | ||
| pKaN: number; | ||
| } | { | ||
| name: string; | ||
| aa3: string; | ||
| aa1: string; | ||
| sc?: undefined; | ||
| pKaC?: undefined; | ||
| pKaN?: undefined; | ||
| })[]; | ||
| export function calculateIEP(sequence: any): number; | ||
| export function calculateIEPChart(sequence: any): { | ||
| first: any; | ||
| last: any; | ||
| basic: {}; | ||
| acid: {}; | ||
| }; | ||
| export function getColorForIEP(iep: any): string; | ||
| export function calculateCharge(sequence: any, ph: any): number; | ||
| export * from "./allowNeutralLoss"; | ||
| export * from "./chargePeptide.js"; | ||
| export * from "./sequenceToMF.js"; | ||
| export * from "./generatePeptideFragments.js"; | ||
| export * from "./digestPeptide.js"; | ||
| export * from "./splitPeptide.js"; |
-63
| "use strict"; | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getInfo = getInfo; | ||
| exports.calculateIEP = calculateIEP; | ||
| exports.calculateIEPChart = calculateIEPChart; | ||
| exports.getColorForIEP = getColorForIEP; | ||
| exports.calculateCharge = calculateCharge; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| const IEP = __importStar(require("./isoElectricPoint")); | ||
| const splitPeptide_js_1 = require("./splitPeptide.js"); | ||
| __exportStar(require("./allowNeutralLoss"), exports); | ||
| __exportStar(require("./chargePeptide.js"), exports); | ||
| __exportStar(require("./sequenceToMF.js"), exports); | ||
| __exportStar(require("./generatePeptideFragments.js"), exports); | ||
| __exportStar(require("./digestPeptide.js"), exports); | ||
| __exportStar(require("./splitPeptide.js"), exports); | ||
| function getInfo() { | ||
| return aminoAcids_1.aminoAcids; | ||
| } | ||
| // sequence should be in the "right" format like HAlaGlyProOH | ||
| function calculateIEP(sequence) { | ||
| let aas = (0, splitPeptide_js_1.splitPeptide)(sequence); | ||
| let result = IEP.calculateIEP(aas); | ||
| return result; | ||
| } | ||
| function calculateIEPChart(sequence) { | ||
| let aas = (0, splitPeptide_js_1.splitPeptide)(sequence); | ||
| let result = IEP.calculateChart(aas); | ||
| return result; | ||
| } | ||
| function getColorForIEP(iep) { | ||
| return IEP.getColor(iep); | ||
| } | ||
| function calculateCharge(sequence, ph) { | ||
| let aas = (0, splitPeptide_js_1.splitPeptide)(sequence); | ||
| return IEP.calculateCharge(aas, ph); | ||
| } |
| export function calculateCharge(aas: any, pH?: number): number; | ||
| export function calculateIEP(aas: any): number; | ||
| export function calculateChart(aas: any): { | ||
| first: any; | ||
| last: any; | ||
| basic: {}; | ||
| acid: {}; | ||
| }; | ||
| export function getColor(iep: any): string; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.calculateCharge = calculateCharge; | ||
| exports.calculateIEP = calculateIEP; | ||
| exports.calculateChart = calculateChart; | ||
| exports.getColor = getColor; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| // we will convert the data to an object to be much faster | ||
| let aaObject = {}; | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| aaObject[aminoAcids_1.aminoAcids[i].aa3] = aminoAcids_1.aminoAcids[i]; | ||
| } | ||
| function calculateCharge(aas, pH = 7.0) { | ||
| let combined = combine(aas); | ||
| if (!combined) | ||
| return; | ||
| let charge = calculateForPh(combined, pH); | ||
| return Math.round(charge * 1000) / 1000; | ||
| } | ||
| // this methods required an array of aas | ||
| function calculateIEP(aas) { | ||
| let combined = combine(aas); | ||
| if (!combined) | ||
| return; | ||
| let first = 0; | ||
| let last = 14; | ||
| let current = 14; | ||
| let previous = 0; | ||
| let currentCharge; | ||
| while (Math.abs(current - previous) > 0.0001) { | ||
| previous = current; | ||
| current = (last + first) / 2; | ||
| currentCharge = calculateForPh(combined, current); | ||
| if (currentCharge > 0) { | ||
| first = current; | ||
| } | ||
| else if (currentCharge < 0) { | ||
| last = current; | ||
| } | ||
| else { | ||
| previous = current; | ||
| } | ||
| } | ||
| return Math.round(current * 1000) / 1000; | ||
| } | ||
| function calculateChart(aas) { | ||
| let combined = combine(aas); | ||
| if (!combined) | ||
| return; | ||
| let y = []; | ||
| let x = []; | ||
| let yAbs = []; | ||
| for (let i = 0; i <= 14; i = i + 0.01) { | ||
| let charge = calculateForPh(combined, i); | ||
| x.push(i); | ||
| y.push(charge); | ||
| yAbs.push(Math.abs(charge)); | ||
| } | ||
| combined.x = x; | ||
| combined.y = y; | ||
| combined.yAbs = yAbs; | ||
| return combined; | ||
| } | ||
| function calculateForPh(combined, pH) { | ||
| let total = 0; | ||
| 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 + 10 ** (aaObject[key].sc.pKa - pH)); | ||
| } | ||
| for (let key in combined.basic) { | ||
| total += combined.basic[key] / (1 + 10 ** (pH - aaObject[key].sc.pKa)); | ||
| } | ||
| return total; | ||
| } | ||
| // we will combine the amino acids | ||
| function combine(aas) { | ||
| let combined = {}; | ||
| if (aaObject[aas[0]]) { | ||
| combined.first = aaObject[aas[0]].pKaN; | ||
| } | ||
| else { | ||
| return; | ||
| } | ||
| if (aaObject[aas[aas.length - 1]]) { | ||
| combined.last = aaObject[aas[aas.length - 1]].pKaC; | ||
| } | ||
| else { | ||
| return; | ||
| } | ||
| combined.basic = {}; | ||
| combined.acid = {}; | ||
| for (let i = 0; i < aas.length; i++) { | ||
| let currentAA = aas[i]; | ||
| if (!aaObject[currentAA]) | ||
| return; | ||
| if (aaObject[currentAA].sc && aaObject[currentAA].sc.type) { | ||
| if (aaObject[currentAA].sc.type === 'positive') { | ||
| if (!combined.basic[currentAA]) { | ||
| combined.basic[currentAA] = 0; | ||
| } | ||
| combined.basic[currentAA]++; | ||
| } | ||
| else if (aaObject[currentAA].sc.type === 'negative') { | ||
| if (!combined.acid[currentAA]) { | ||
| combined.acid[currentAA] = 0; | ||
| } | ||
| combined.acid[currentAA]++; | ||
| } | ||
| } | ||
| } | ||
| return combined; | ||
| } | ||
| /* | ||
| We can generate a color based on iep | ||
| 0 -> 7 means that at pH 7 it is charged negatively (blue) | ||
| 7 -> 14 means that at pH7 it is charged positively (red) | ||
| */ | ||
| function getColor(iep) { | ||
| if (iep < 7) { | ||
| if (iep < 3) | ||
| iep = 3; | ||
| let white = Math.round(255 - (7 - iep) * (200 / 4)); | ||
| return `rgb(${white},${white},255)`; | ||
| } | ||
| else if (iep > 7) { | ||
| if (iep > 11) | ||
| iep = 11; | ||
| let white = Math.round(255 - (iep - 7) * (200 / 4)); | ||
| return `rgb(255,${white},${white})`; | ||
| } | ||
| return 'rgb(255,255,255)'; | ||
| } |
| export function sequenceToMF(mf: any): any; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.sequenceToMF = sequenceToMF; | ||
| const aminoAcids_1 = require("./aminoAcids"); | ||
| function sequenceToMF(mf) { | ||
| // this function will check if it is a sequence of aa in 1 letter or 3 letters and convert them if it is the case | ||
| // it could be a multiline mf ! | ||
| // if it is a multiline we could make some "tricks" ... | ||
| let newMF = mf; | ||
| // SEQRES 1 B 256 MET PRO VAL GLU ILE THR VAL LYS GLU LEU LEU GLU ALA | ||
| // SEQRES 2 B 256 GLY VAL HIS PHE GLY HIS GLU ARG LYS ARG TRP ASN PRO | ||
| // or | ||
| // MET PRO VAL GLU ILE THR VAL LYS GLU LEU LEU GLU ALA | ||
| // 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) { | ||
| // 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, ''); | ||
| // we need to correct the uppercase / lowercase | ||
| let parts = tmpmf.split(' '); | ||
| newMF = 'H'; | ||
| for (let i = 0; i < parts.length; i++) { | ||
| newMF += parts[i].substr(0, 1) + parts[i].substr(1).toLowerCase(); | ||
| } | ||
| newMF += 'OH'; | ||
| } | ||
| else if (mf.includes('(') && isOneLetterCode(mf)) { | ||
| // we expect one letter code with modification | ||
| newMF = ''; | ||
| let nTerminal = 'H'; | ||
| let cTerminal = 'OH'; | ||
| let parenthesisCounter = 0; | ||
| for (let i = 0; i < mf.length; i++) { | ||
| let currentSymbol = mf[i]; | ||
| if (currentSymbol === '(' || | ||
| currentSymbol === ')' || | ||
| parenthesisCounter > 0) { | ||
| if (currentSymbol === '(') { | ||
| parenthesisCounter++; | ||
| if (i === 0) | ||
| nTerminal = ''; | ||
| } | ||
| if (currentSymbol === ')') { | ||
| parenthesisCounter--; | ||
| if (i === mf.length - 1) | ||
| cTerminal = ''; | ||
| } | ||
| newMF += currentSymbol; | ||
| continue; | ||
| } | ||
| newMF += convertAA1To3(currentSymbol); | ||
| } | ||
| newMF = nTerminal + newMF + cTerminal; | ||
| } | ||
| else if (mf.search(/[A-Z]{3}/) > -1 && | ||
| mf.search(/[a-zA-Z][a-z0-9]/) === -1) { | ||
| // UNIPROT | ||
| // 370 380 390 400 410 420 | ||
| //GFKPNLRKTF VSGLFRESCG AHFYRGVDVK PFYIKKPVDN LFALMLILNR LRGWGVVGGM | ||
| // | ||
| // 430 440 450 460 470 480 | ||
| //SDPRLYKVWV RLSSQVPSMF FGGTDLAADY YVVSPPTAVS VYTKTPYGRL LADTRTSGFR | ||
| // We remove all the number, all the spaces, etc | ||
| newMF = `H${convertAA1To3(newMF.replace(/[^A-Z]/g, ''))}OH`; | ||
| } | ||
| return newMF; | ||
| } | ||
| function convertAA1To3(mf) { | ||
| let newmf = ''; | ||
| for (let i = 0; i < mf.length; i++) { | ||
| newmf += aa1To3(mf.charAt(i)); | ||
| } | ||
| return newmf; | ||
| } | ||
| function aa1To3(code) { | ||
| for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) { | ||
| if (aminoAcids_1.aminoAcids[i].aa1 === code) { | ||
| return aminoAcids_1.aminoAcids[i].aa3; | ||
| } | ||
| } | ||
| throw new Error(`Invalid 1 letter code: ${code}`); | ||
| } | ||
| // mf can contain as well parenthesis. We need to check if it is not yet a correct molecular formula | ||
| function isOneLetterCode(mf) { | ||
| let parenthesisLevel = 0; | ||
| for (let char of mf) { | ||
| if (parenthesisLevel === 0 && char.match(/[a-z]/)) | ||
| return false; | ||
| if (char === '(') | ||
| parenthesisLevel++; | ||
| if (char === ')') | ||
| parenthesisLevel--; | ||
| } | ||
| return true; | ||
| } |
| export function splitPeptide(sequence: any): any; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.splitPeptide = splitPeptide; | ||
| function splitPeptide(sequence) { | ||
| let aas = sequence.replace(/([A-Z])/g, ' $1').split(/ /); | ||
| let begin = 0; | ||
| while (aas[begin] === '' || aas[begin] === 'H') { | ||
| begin++; | ||
| } | ||
| let end = aas.length - 1; | ||
| while (aas[end] === 'O' || aas[end] === 'H') { | ||
| end--; | ||
| } | ||
| aas = aas.slice(begin, end + 1); | ||
| return aas; | ||
| } |
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
57.99%34
3.03%1660
-0.54%2
100%