peptide-score 2.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +149 -0
- package/lib/src/allowNeutralLoss.d.ts +7 -0
- package/lib/src/allowNeutralLoss.d.ts.map +1 -0
- package/lib/src/allowNeutralLoss.js +25 -0
- package/lib/src/allowNeutralLoss.js.map +1 -0
- package/lib/src/aminoAcids.d.ts +29 -0
- package/lib/src/aminoAcids.d.ts.map +1 -0
- package/lib/src/aminoAcids.js +247 -0
- package/lib/src/aminoAcids.js.map +1 -0
- package/lib/src/chargePeptide.d.ts +2 -0
- package/lib/src/chargePeptide.d.ts.map +1 -0
- package/lib/src/chargePeptide.js +50 -0
- package/lib/src/chargePeptide.js.map +1 -0
- package/lib/src/digestPeptide.d.ts +2 -0
- package/lib/src/digestPeptide.d.ts.map +1 -0
- package/lib/src/digestPeptide.js +83 -0
- package/lib/src/digestPeptide.js.map +1 -0
- package/lib/src/generatePeptideFragments.d.ts +2 -0
- package/lib/src/generatePeptideFragments.d.ts.map +1 -0
- package/lib/src/generatePeptideFragments.js +89 -0
- package/lib/src/generatePeptideFragments.js.map +1 -0
- package/lib/src/getAA.d.ts +29 -0
- package/lib/src/getAA.d.ts.map +1 -0
- package/lib/src/getAA.js +21 -0
- package/lib/src/getAA.js.map +1 -0
- package/lib/src/index.d.ts +44 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/index.js +74 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/isoElectricPoint.d.ts +10 -0
- package/lib/src/isoElectricPoint.d.ts.map +1 -0
- package/lib/src/isoElectricPoint.js +134 -0
- package/lib/src/isoElectricPoint.js.map +1 -0
- package/lib/src/sequenceToMF.d.ts +2 -0
- package/lib/src/sequenceToMF.d.ts.map +1 -0
- package/lib/src/sequenceToMF.js +99 -0
- package/lib/src/sequenceToMF.js.map +1 -0
- package/lib/src/splitPeptide.d.ts +2 -0
- package/lib/src/splitPeptide.d.ts.map +1 -0
- package/lib/src/splitPeptide.js +17 -0
- package/lib/src/splitPeptide.js.map +1 -0
- package/lib/tsconfig.build.tsbuildinfo +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +29 -0
- package/src/allowNeutralLoss.js +22 -0
- package/src/aminoAcids.js +244 -0
- package/src/chargePeptide.js +48 -0
- package/src/digestPeptide.js +87 -0
- package/src/generatePeptideFragments.js +89 -0
- package/src/getAA.js +18 -0
- package/src/index.js +37 -0
- package/src/isoElectricPoint.js +124 -0
- package/src/sequenceToMF.js +96 -0
- package/src/splitPeptide.js +13 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generatePeptideFragments = generatePeptideFragments;
|
|
4
|
+
function generatePeptideFragments(mf, options) {
|
|
5
|
+
if (options === undefined) {
|
|
6
|
+
options = {
|
|
7
|
+
a: false,
|
|
8
|
+
b: true,
|
|
9
|
+
c: false,
|
|
10
|
+
x: false,
|
|
11
|
+
y: true,
|
|
12
|
+
z: false,
|
|
13
|
+
i: false,
|
|
14
|
+
ya: false,
|
|
15
|
+
yb: false,
|
|
16
|
+
yc: false,
|
|
17
|
+
zc: false,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
options.maxInternal = options.maxInternal || Number.MAX_VALUE;
|
|
21
|
+
options.minInternal = options.minInternal || 0;
|
|
22
|
+
let mfs = [];
|
|
23
|
+
// need to allow 0-9 to deal with neutral loss
|
|
24
|
+
let mfparts = mf
|
|
25
|
+
.replaceAll(/([\d)a-z])([A-Z][a-z](?=[a-z]))/g, '$1 $2')
|
|
26
|
+
.split(/ /);
|
|
27
|
+
let nTerm = '';
|
|
28
|
+
let cTerm = '';
|
|
29
|
+
if (mfparts[0].startsWith('(')) {
|
|
30
|
+
nTerm += mfparts[0];
|
|
31
|
+
mfparts = mfparts.splice(1);
|
|
32
|
+
}
|
|
33
|
+
if (mfparts.at(-1).includes('(')) {
|
|
34
|
+
cTerm += mfparts.at(-1).replace(/^[^()]*/, '');
|
|
35
|
+
mfparts[mfparts.length - 1] = mfparts.at(-1).replace(/\(.*/, '');
|
|
36
|
+
}
|
|
37
|
+
for (let i = 1; i < mfparts.length; i++) {
|
|
38
|
+
nTerm += mfparts[i - 1];
|
|
39
|
+
cTerm = mfparts[mfparts.length - i] + cTerm;
|
|
40
|
+
addNTerm(mfs, nTerm, i, options);
|
|
41
|
+
addCTerm(mfs, cTerm, i, options);
|
|
42
|
+
if (options.i)
|
|
43
|
+
mfs.push(`${mfparts[i]}HC-1O-1(+1)$i:${mfparts[i]}`);
|
|
44
|
+
if (options.ya || options.yb || options.yc || options.zc) {
|
|
45
|
+
// we have double fragmentations
|
|
46
|
+
for (let j = i + 1; j < Math.min(mfparts.length, options.maxInternal + i + 1); j++) {
|
|
47
|
+
let iTerm = '';
|
|
48
|
+
if (j - i >= options.minInternal) {
|
|
49
|
+
for (let k = i; k < j; k++) {
|
|
50
|
+
iTerm += mfparts[k];
|
|
51
|
+
}
|
|
52
|
+
addITerm(mfs, iTerm, mfparts.length - i, j, options);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// todo does this make sense ??? I think we should remote those 3 lines
|
|
58
|
+
if (mfs.length === 0) {
|
|
59
|
+
mfs = mfs.concat([mf]);
|
|
60
|
+
}
|
|
61
|
+
return mfs;
|
|
62
|
+
}
|
|
63
|
+
function addNTerm(mfs, nTerm, i, options) {
|
|
64
|
+
if (options.a)
|
|
65
|
+
mfs.push(`${nTerm}C-1O-1(+1)$a${i}`);
|
|
66
|
+
if (options.b)
|
|
67
|
+
mfs.push(`${nTerm}(+1)$b${i}`);
|
|
68
|
+
if (options.c)
|
|
69
|
+
mfs.push(`${nTerm}NH3(+1)$c${i}`);
|
|
70
|
+
}
|
|
71
|
+
function addITerm(mfs, iTerm, i, j, options) {
|
|
72
|
+
if (options.ya)
|
|
73
|
+
mfs.push(`H${iTerm}C-1O-1(+1)$a${j}y${i}`);
|
|
74
|
+
if (options.yb)
|
|
75
|
+
mfs.push(`H${iTerm}(+1)$b${j}y${i}`);
|
|
76
|
+
if (options.yc)
|
|
77
|
+
mfs.push(`H${iTerm}NH3(+1)$c${j}y${i}`);
|
|
78
|
+
if (options.zc)
|
|
79
|
+
mfs.push(`N-1${iTerm}NH3(+1)$c${j}z${i}`);
|
|
80
|
+
}
|
|
81
|
+
function addCTerm(mfs, cTerm, i, options) {
|
|
82
|
+
if (options.x)
|
|
83
|
+
mfs.push(`CO(+1)${cTerm}$x${i}`);
|
|
84
|
+
if (options.y)
|
|
85
|
+
mfs.push(`H2(+1)${cTerm}$y${i}`);
|
|
86
|
+
if (options.z)
|
|
87
|
+
mfs.push(`N-1H-1(+1)${cTerm}$z${i}`);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=generatePeptideFragments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatePeptideFragments.js","sourceRoot":"","sources":["../../src/generatePeptideFragments.js"],"names":[],"mappings":";;AAAA,4DAqEC;AArED,SAAgB,wBAAwB,CAAC,EAAE,EAAE,OAAO;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,GAAG;YACR,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;YACR,EAAE,EAAE,KAAK;YACT,EAAE,EAAE,KAAK;YACT,EAAE,EAAE,KAAK;YACT,EAAE,EAAE,KAAK;SACV,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC;IAC9D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,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string;
|
|
5
|
+
sc: {
|
|
6
|
+
type: string;
|
|
7
|
+
pKa?: undefined;
|
|
8
|
+
};
|
|
9
|
+
pKaC: number;
|
|
10
|
+
pKaN: number;
|
|
11
|
+
} | {
|
|
12
|
+
name: string;
|
|
13
|
+
aa3: string;
|
|
14
|
+
aa1: string;
|
|
15
|
+
sc: {
|
|
16
|
+
type: string;
|
|
17
|
+
pKa: number;
|
|
18
|
+
};
|
|
19
|
+
pKaC: number;
|
|
20
|
+
pKaN: number;
|
|
21
|
+
} | {
|
|
22
|
+
name: string;
|
|
23
|
+
aa3: string;
|
|
24
|
+
aa1: string;
|
|
25
|
+
sc?: undefined;
|
|
26
|
+
pKaC?: undefined;
|
|
27
|
+
pKaN?: undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
//# sourceMappingURL=getAA.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAA.d.ts","sourceRoot":"","sources":["../../src/getAA.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAeC"}
|
package/lib/src/getAA.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAA = getAA;
|
|
4
|
+
const aminoAcids_1 = require("./aminoAcids");
|
|
5
|
+
function getAA(code) {
|
|
6
|
+
if (code.length === 1) {
|
|
7
|
+
for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) {
|
|
8
|
+
if (aminoAcids_1.aminoAcids[i].aa1 === code) {
|
|
9
|
+
return aminoAcids_1.aminoAcids[i];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (code.length === 3) {
|
|
14
|
+
for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) {
|
|
15
|
+
if (aminoAcids_1.aminoAcids[i].aa3 === code) {
|
|
16
|
+
return aminoAcids_1.aminoAcids[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=getAA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAA.js","sourceRoot":"","sources":["../../src/getAA.js"],"names":[],"mappings":";;AAEA,sBAeC;AAjBD,6CAA0C;AAE1C,SAAgB,KAAK,CAAC,IAAI;IACxB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,IAAI,uBAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;gBAC/B,OAAO,uBAAU,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,IAAI,uBAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;gBAC/B,OAAO,uBAAU,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export function getInfo(): ({
|
|
2
|
+
name: string;
|
|
3
|
+
aa3: string;
|
|
4
|
+
aa1: string;
|
|
5
|
+
sc: {
|
|
6
|
+
type: string;
|
|
7
|
+
pKa?: undefined;
|
|
8
|
+
};
|
|
9
|
+
pKaC: number;
|
|
10
|
+
pKaN: number;
|
|
11
|
+
} | {
|
|
12
|
+
name: string;
|
|
13
|
+
aa3: string;
|
|
14
|
+
aa1: string;
|
|
15
|
+
sc: {
|
|
16
|
+
type: string;
|
|
17
|
+
pKa: number;
|
|
18
|
+
};
|
|
19
|
+
pKaC: number;
|
|
20
|
+
pKaN: number;
|
|
21
|
+
} | {
|
|
22
|
+
name: string;
|
|
23
|
+
aa3: string;
|
|
24
|
+
aa1: string;
|
|
25
|
+
sc?: undefined;
|
|
26
|
+
pKaC?: undefined;
|
|
27
|
+
pKaN?: undefined;
|
|
28
|
+
})[];
|
|
29
|
+
export function calculateIEP(sequence: any): number | undefined;
|
|
30
|
+
export function calculateIEPChart(sequence: any): {
|
|
31
|
+
first: any;
|
|
32
|
+
last: any;
|
|
33
|
+
basic: {};
|
|
34
|
+
acid: {};
|
|
35
|
+
} | undefined;
|
|
36
|
+
export function getColorForIEP(iep: any): string;
|
|
37
|
+
export function calculateCharge(sequence: any, ph: any): number | undefined;
|
|
38
|
+
export * from "./allowNeutralLoss.js";
|
|
39
|
+
export * from "./chargePeptide.js";
|
|
40
|
+
export * from "./sequenceToMF.js";
|
|
41
|
+
export * from "./generatePeptideFragments.js";
|
|
42
|
+
export * from "./digestPeptide.js";
|
|
43
|
+
export * from "./splitPeptide.js";
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEC;AAID,gEAIC;AAED;;;;;cAIC;AAED,iDAEC;AAED,4EAGC"}
|
package/lib/src/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getInfo = getInfo;
|
|
40
|
+
exports.calculateIEP = calculateIEP;
|
|
41
|
+
exports.calculateIEPChart = calculateIEPChart;
|
|
42
|
+
exports.getColorForIEP = getColorForIEP;
|
|
43
|
+
exports.calculateCharge = calculateCharge;
|
|
44
|
+
const aminoAcids_1 = require("./aminoAcids");
|
|
45
|
+
const IEP = __importStar(require("./isoElectricPoint"));
|
|
46
|
+
const splitPeptide_js_1 = require("./splitPeptide.js");
|
|
47
|
+
__exportStar(require("./allowNeutralLoss.js"), exports);
|
|
48
|
+
__exportStar(require("./chargePeptide.js"), exports);
|
|
49
|
+
__exportStar(require("./sequenceToMF.js"), exports);
|
|
50
|
+
__exportStar(require("./generatePeptideFragments.js"), exports);
|
|
51
|
+
__exportStar(require("./digestPeptide.js"), exports);
|
|
52
|
+
__exportStar(require("./splitPeptide.js"), exports);
|
|
53
|
+
function getInfo() {
|
|
54
|
+
return aminoAcids_1.aminoAcids;
|
|
55
|
+
}
|
|
56
|
+
// sequence should be in the "right" format like HAlaGlyProOH
|
|
57
|
+
function calculateIEP(sequence) {
|
|
58
|
+
let aas = (0, splitPeptide_js_1.splitPeptide)(sequence);
|
|
59
|
+
let result = IEP.calculateIEP(aas);
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function calculateIEPChart(sequence) {
|
|
63
|
+
let aas = (0, splitPeptide_js_1.splitPeptide)(sequence);
|
|
64
|
+
let result = IEP.calculateChart(aas);
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
function getColorForIEP(iep) {
|
|
68
|
+
return IEP.getColor(iep);
|
|
69
|
+
}
|
|
70
|
+
function calculateCharge(sequence, ph) {
|
|
71
|
+
let aas = (0, splitPeptide_js_1.splitPeptide)(sequence);
|
|
72
|
+
return IEP.calculateCharge(aas, ph);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,0BAEC;AAID,oCAIC;AAED,8CAIC;AAED,wCAEC;AAED,0CAGC;AApCD,6CAA0C;AAC1C,wDAA0C;AAC1C,uDAAiD;AAEjD,wDAAsC;AACtC,qDAAmC;AACnC,oDAAkC;AAClC,gEAA8C;AAC9C,qDAAmC;AACnC,oDAAkC;AAElC,SAAgB,OAAO;IACrB,OAAO,uBAAU,CAAC;AACpB,CAAC;AAED,6DAA6D;AAE7D,SAAgB,YAAY,CAAC,QAAQ;IACnC,IAAI,GAAG,GAAG,IAAA,8BAAY,EAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,iBAAiB,CAAC,QAAQ;IACxC,IAAI,GAAG,GAAG,IAAA,8BAAY,EAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,MAAM,GAAG,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,cAAc,CAAC,GAAG;IAChC,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,SAAgB,eAAe,CAAC,QAAQ,EAAE,EAAE;IAC1C,IAAI,GAAG,GAAG,IAAA,8BAAY,EAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function calculateCharge(aas: any, pH?: number): number | undefined;
|
|
2
|
+
export function calculateIEP(aas: any): number | undefined;
|
|
3
|
+
export function calculateChart(aas: any): {
|
|
4
|
+
first: any;
|
|
5
|
+
last: any;
|
|
6
|
+
basic: {};
|
|
7
|
+
acid: {};
|
|
8
|
+
} | undefined;
|
|
9
|
+
export function getColor(iep: any): string;
|
|
10
|
+
//# sourceMappingURL=isoElectricPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isoElectricPoint.d.ts","sourceRoot":"","sources":["../../src/isoElectricPoint.js"],"names":[],"mappings":"AAQA,2EAKC;AAID,2DAqBC;AAED;;;;;cAiBC;AAuDD,2CAWC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateCharge = calculateCharge;
|
|
4
|
+
exports.calculateIEP = calculateIEP;
|
|
5
|
+
exports.calculateChart = calculateChart;
|
|
6
|
+
exports.getColor = getColor;
|
|
7
|
+
const aminoAcids_1 = require("./aminoAcids");
|
|
8
|
+
// we will convert the data to an object to be much faster
|
|
9
|
+
let aaObject = {};
|
|
10
|
+
for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) {
|
|
11
|
+
aaObject[aminoAcids_1.aminoAcids[i].aa3] = aminoAcids_1.aminoAcids[i];
|
|
12
|
+
}
|
|
13
|
+
function calculateCharge(aas, pH = 7) {
|
|
14
|
+
let combined = combine(aas);
|
|
15
|
+
if (!combined)
|
|
16
|
+
return;
|
|
17
|
+
let charge = calculateForPh(combined, pH);
|
|
18
|
+
return Math.round(charge * 1000) / 1000;
|
|
19
|
+
}
|
|
20
|
+
// this methods required an array of aas
|
|
21
|
+
function calculateIEP(aas) {
|
|
22
|
+
let combined = combine(aas);
|
|
23
|
+
if (!combined)
|
|
24
|
+
return;
|
|
25
|
+
let first = 0;
|
|
26
|
+
let last = 14;
|
|
27
|
+
let current = 14;
|
|
28
|
+
let previous = 0;
|
|
29
|
+
let currentCharge;
|
|
30
|
+
while (Math.abs(current - previous) > 0.0001) {
|
|
31
|
+
previous = current;
|
|
32
|
+
current = (last + first) / 2;
|
|
33
|
+
currentCharge = calculateForPh(combined, current);
|
|
34
|
+
if (currentCharge > 0) {
|
|
35
|
+
first = current;
|
|
36
|
+
}
|
|
37
|
+
else if (currentCharge < 0) {
|
|
38
|
+
last = current;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
previous = current;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return Math.round(current * 1000) / 1000;
|
|
45
|
+
}
|
|
46
|
+
function calculateChart(aas) {
|
|
47
|
+
let combined = combine(aas);
|
|
48
|
+
if (!combined)
|
|
49
|
+
return;
|
|
50
|
+
let y = [];
|
|
51
|
+
let x = [];
|
|
52
|
+
let yAbs = [];
|
|
53
|
+
for (let i = 0; i <= 14; i = i + 0.01) {
|
|
54
|
+
let charge = calculateForPh(combined, i);
|
|
55
|
+
x.push(i);
|
|
56
|
+
y.push(charge);
|
|
57
|
+
yAbs.push(Math.abs(charge));
|
|
58
|
+
}
|
|
59
|
+
combined.x = x;
|
|
60
|
+
combined.y = y;
|
|
61
|
+
combined.yAbs = yAbs;
|
|
62
|
+
return combined;
|
|
63
|
+
}
|
|
64
|
+
function calculateForPh(combined, pH) {
|
|
65
|
+
let total = 0;
|
|
66
|
+
total += 1 / (1 + 10 ** (pH - combined.first));
|
|
67
|
+
total += -1 / (1 + 10 ** (combined.last - pH));
|
|
68
|
+
for (let key in combined.acid) {
|
|
69
|
+
total += -combined.acid[key] / (1 + 10 ** (aaObject[key].sc.pKa - pH));
|
|
70
|
+
}
|
|
71
|
+
for (let key in combined.basic) {
|
|
72
|
+
total += combined.basic[key] / (1 + 10 ** (pH - aaObject[key].sc.pKa));
|
|
73
|
+
}
|
|
74
|
+
return total;
|
|
75
|
+
}
|
|
76
|
+
// we will combine the amino acids
|
|
77
|
+
function combine(aas) {
|
|
78
|
+
let combined = {};
|
|
79
|
+
if (aaObject[aas[0]]) {
|
|
80
|
+
combined.first = aaObject[aas[0]].pKaN;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (aaObject[aas.at(-1)]) {
|
|
86
|
+
combined.last = aaObject[aas.at(-1)].pKaC;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
combined.basic = {};
|
|
92
|
+
combined.acid = {};
|
|
93
|
+
for (let i = 0; i < aas.length; i++) {
|
|
94
|
+
let currentAA = aas[i];
|
|
95
|
+
if (!aaObject[currentAA])
|
|
96
|
+
return;
|
|
97
|
+
if (aaObject[currentAA].sc && aaObject[currentAA].sc.type) {
|
|
98
|
+
if (aaObject[currentAA].sc.type === 'positive') {
|
|
99
|
+
if (!combined.basic[currentAA]) {
|
|
100
|
+
combined.basic[currentAA] = 0;
|
|
101
|
+
}
|
|
102
|
+
combined.basic[currentAA]++;
|
|
103
|
+
}
|
|
104
|
+
else if (aaObject[currentAA].sc.type === 'negative') {
|
|
105
|
+
if (!combined.acid[currentAA]) {
|
|
106
|
+
combined.acid[currentAA] = 0;
|
|
107
|
+
}
|
|
108
|
+
combined.acid[currentAA]++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return combined;
|
|
113
|
+
}
|
|
114
|
+
/*
|
|
115
|
+
We can generate a color based on iep
|
|
116
|
+
0 -> 7 means that at pH 7 it is charged negatively (blue)
|
|
117
|
+
7 -> 14 means that at pH7 it is charged positively (red)
|
|
118
|
+
*/
|
|
119
|
+
function getColor(iep) {
|
|
120
|
+
if (iep < 7) {
|
|
121
|
+
if (iep < 3)
|
|
122
|
+
iep = 3;
|
|
123
|
+
let white = Math.round(255 - (7 - iep) * (200 / 4));
|
|
124
|
+
return `rgb(${white},${white},255)`;
|
|
125
|
+
}
|
|
126
|
+
else if (iep > 7) {
|
|
127
|
+
if (iep > 11)
|
|
128
|
+
iep = 11;
|
|
129
|
+
let white = Math.round(255 - (iep - 7) * (200 / 4));
|
|
130
|
+
return `rgb(255,${white},${white})`;
|
|
131
|
+
}
|
|
132
|
+
return 'rgb(255,255,255)';
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=isoElectricPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isoElectricPoint.js","sourceRoot":"","sources":["../../src/isoElectricPoint.js"],"names":[],"mappings":";;AAQA,0CAKC;AAID,oCAqBC;AAED,wCAiBC;AAuDD,4BAWC;AA3HD,6CAA0C;AAE1C,0DAA0D;AAC1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CAAC,CAAC;QACpD,OAAO,OAAO,KAAK,IAAI,KAAK,OAAO,CAAC;IACtC,CAAC;SAAM,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACnB,IAAI,GAAG,GAAG,EAAE;YAAE,GAAG,GAAG,EAAE,CAAC;QACvB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACpD,OAAO,WAAW,KAAK,IAAI,KAAK,GAAG,CAAC;IACtC,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequenceToMF.d.ts","sourceRoot":"","sources":["../../src/sequenceToMF.js"],"names":[],"mappings":"AAIA,2CA+DC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sequenceToMF = sequenceToMF;
|
|
4
|
+
const mf_utilities_1 = require("mf-utilities");
|
|
5
|
+
const aminoAcids_1 = require("./aminoAcids");
|
|
6
|
+
function sequenceToMF(mf) {
|
|
7
|
+
if (mf === '')
|
|
8
|
+
return '';
|
|
9
|
+
mf = (0, mf_utilities_1.ensureUppercaseSequence)(mf);
|
|
10
|
+
// 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
|
|
11
|
+
// it could be a multiline mf !
|
|
12
|
+
// if it is a multiline we could make some "tricks" ...
|
|
13
|
+
let newMF = mf;
|
|
14
|
+
// SEQRES 1 B 256 MET PRO VAL GLU ILE THR VAL LYS GLU LEU LEU GLU ALA
|
|
15
|
+
// SEQRES 2 B 256 GLY VAL HIS PHE GLY HIS GLU ARG LYS ARG TRP ASN PRO
|
|
16
|
+
// or
|
|
17
|
+
// MET PRO VAL GLU ILE THR VAL LYS GLU LEU LEU GLU ALA
|
|
18
|
+
// GLY VAL HIS PHE GLY HIS GLU ARG LYS ARG TRP ASN PRO
|
|
19
|
+
if (mf.search(/(?:[A-Z]{3} ){2}[A-Z]{3}/) > -1) {
|
|
20
|
+
// this is a PDB !
|
|
21
|
+
let tmpmf = mf.replaceAll(/[\n\r]+/g, ' ');
|
|
22
|
+
tmpmf = tmpmf.replaceAll(/(SEQRES|\d+| [A-Z] | [\dA-Z]{4-50})/g, '');
|
|
23
|
+
// we need to correct the uppercase / lowercase
|
|
24
|
+
let parts = tmpmf.split(' ');
|
|
25
|
+
newMF = 'H';
|
|
26
|
+
for (let i = 0; i < parts.length; i++) {
|
|
27
|
+
newMF += parts[i].slice(0, 1) + parts[i].slice(1).toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
newMF += 'OH';
|
|
30
|
+
}
|
|
31
|
+
else if (mf.includes('(') && isOneLetterCode(mf)) {
|
|
32
|
+
// we expect one-letter code with modification
|
|
33
|
+
newMF = '';
|
|
34
|
+
let nTerminal = 'H';
|
|
35
|
+
let cTerminal = 'OH';
|
|
36
|
+
let parenthesisCounter = 0;
|
|
37
|
+
for (let i = 0; i < mf.length; i++) {
|
|
38
|
+
let currentSymbol = mf[i];
|
|
39
|
+
if (currentSymbol === '(' ||
|
|
40
|
+
currentSymbol === ')' ||
|
|
41
|
+
parenthesisCounter > 0) {
|
|
42
|
+
if (currentSymbol === '(') {
|
|
43
|
+
parenthesisCounter++;
|
|
44
|
+
if (i === 0)
|
|
45
|
+
nTerminal = '';
|
|
46
|
+
}
|
|
47
|
+
if (currentSymbol === ')') {
|
|
48
|
+
parenthesisCounter--;
|
|
49
|
+
if (i === mf.length - 1)
|
|
50
|
+
cTerminal = '';
|
|
51
|
+
}
|
|
52
|
+
newMF += currentSymbol;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
newMF += convertAA1To3(currentSymbol);
|
|
56
|
+
}
|
|
57
|
+
newMF = nTerminal + newMF + cTerminal;
|
|
58
|
+
}
|
|
59
|
+
else if (mf.search(/[A-Za-z][\da-z]/) === -1) {
|
|
60
|
+
// UNIPROT
|
|
61
|
+
// 370 380 390 400 410 420
|
|
62
|
+
//GFKPNLRKTF VSGLFRESCG AHFYRGVDVK PFYIKKPVDN LFALMLILNR LRGWGVVGGM
|
|
63
|
+
//
|
|
64
|
+
// 430 440 450 460 470 480
|
|
65
|
+
//SDPRLYKVWV RLSSQVPSMF FGGTDLAADY YVVSPPTAVS VYTKTPYGRL LADTRTSGFR
|
|
66
|
+
// We remove all the number, all the spaces, etc
|
|
67
|
+
newMF = `H${convertAA1To3(newMF.replaceAll(/[^A-Z]/g, ''))}OH`;
|
|
68
|
+
}
|
|
69
|
+
return newMF;
|
|
70
|
+
}
|
|
71
|
+
function convertAA1To3(mf) {
|
|
72
|
+
let newmf = '';
|
|
73
|
+
for (let i = 0; i < mf.length; i++) {
|
|
74
|
+
newmf += aa1To3(mf.charAt(i));
|
|
75
|
+
}
|
|
76
|
+
return newmf;
|
|
77
|
+
}
|
|
78
|
+
function aa1To3(code) {
|
|
79
|
+
for (let i = 0; i < aminoAcids_1.aminoAcids.length; i++) {
|
|
80
|
+
if (aminoAcids_1.aminoAcids[i].aa1 === code) {
|
|
81
|
+
return aminoAcids_1.aminoAcids[i].aa3;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`Invalid 1 letter code: ${code}`);
|
|
85
|
+
}
|
|
86
|
+
// mf can contain as well parenthesis. We need to check if it is not yet a correct molecular formula
|
|
87
|
+
function isOneLetterCode(mf) {
|
|
88
|
+
let parenthesisLevel = 0;
|
|
89
|
+
for (let char of mf) {
|
|
90
|
+
if (parenthesisLevel === 0 && char.match(/[a-z]/))
|
|
91
|
+
return false;
|
|
92
|
+
if (char === '(')
|
|
93
|
+
parenthesisLevel++;
|
|
94
|
+
if (char === ')')
|
|
95
|
+
parenthesisLevel--;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=sequenceToM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AED,SAAS,aAAa,CAAC,EAAE;IACvB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,MAAM,CAAC,IAAI;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,uBAAU,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,uBAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,oGAAoG;AACpG,SAAS,eAAe,CAAC,EAAE;IACzB,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,KAAK,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;QACpB,IAAI,gBAAgB,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAChE,IAAI,IAAI,KAAK,GAAG;YAAE,gBAAgB,EAAE,CAAC;QACrC,IAAI,IAAI,KAAK,GAAG;YAAE,gBAAgB,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitPeptide.d.ts","sourceRoot":"","sources":["../../src/splitPeptide.js"],"names":[],"mappings":"AAAA,iDAYC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitPeptide = splitPeptide;
|
|
4
|
+
function splitPeptide(sequence) {
|
|
5
|
+
let aas = sequence.replaceAll(/([A-Z])/g, ' $1').split(/ /);
|
|
6
|
+
let begin = 0;
|
|
7
|
+
while (aas[begin] === '' || aas[begin] === 'H') {
|
|
8
|
+
begin++;
|
|
9
|
+
}
|
|
10
|
+
let end = aas.length - 1;
|
|
11
|
+
while (aas[end] === 'O' || aas[end] === 'H') {
|
|
12
|
+
end--;
|
|
13
|
+
}
|
|
14
|
+
aas = aas.slice(begin, end + 1);
|
|
15
|
+
return aas;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=splitPeptide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitPeptide.js","sourceRoot":"","sources":["../../src/splitPeptide.js"],"names":[],"mappings":";;AAAA,oCAYC;AAZD,SAAgB,YAAY,CAAC,QAAQ;IACnC,IAAI,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;QAC/C,KAAK,EAAE,CAAC;IACV,CAAC;IACD,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QAC5C,GAAG,EAAE,CAAC;IACR,CAAC;IACD,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC"}
|