Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "peptide", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Peptide", | ||
@@ -29,2 +29,2 @@ "keywords": [ | ||
] | ||
} | ||
} |
{ | ||
"name": "peptide", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Peptide", | ||
@@ -10,5 +10,2 @@ "keywords": [ | ||
], | ||
"config": { | ||
"name": "Peptide" | ||
}, | ||
"author": "Luc Patiny", | ||
@@ -31,18 +28,10 @@ "contributors": [ | ||
"test": "mocha --require should --reporter mocha-better-spec-reporter --recursive", | ||
"build": "gulp build" | ||
"build": "cheminfo build --root Peptide" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^8.1.3", | ||
"del": "^1.1.1", | ||
"gulp": "^3.8.11", | ||
"gulp-header": "^1.2.2", | ||
"gulp-rename": "^1.2.0", | ||
"gulp-sourcemaps": "^1.3.0", | ||
"gulp-uglify": "^1.1.0", | ||
"mocha": "latest", | ||
"mocha-better-spec-reporter": "latest", | ||
"should": "latest", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.0.0" | ||
"cheminfo-tools": "^1.0.2", | ||
"mocha": "^2.2.5", | ||
"mocha-better-spec-reporter": "^2.1.1", | ||
"should": "^7.0.2" | ||
} | ||
} | ||
} |
@@ -10,2 +10,83 @@ # peptide | ||
## Amino acids | ||
#### getInfo() | ||
Returns an array of information about amino acids | ||
## Amino acids sequence | ||
#### convertAASequence(sequence) | ||
Returns a peptidic sequence from a PDB or one letter code to the internal molecular formula format | ||
__Arguments__ | ||
* `sequence` - string with the amino acids sequence | ||
#### chargePeptide(mf) | ||
Add a positive charge on Arg, His and Lys | ||
__Arguments__ | ||
* `mf` - string with a molecular formula to charge | ||
#### generatePeptideFragments(mf, [options]) | ||
Generate [peptide fragmentation](http://en.wikipedia.org/wiki/Peptide_sequence_tag). | ||
Returns an array of molecular formulas with the different fragments. | ||
__Arguments__ | ||
* `mf` - string with the molecular formula | ||
* `options` - object with requested fragments. Default: `{a:false, b:true, c:false, x:false, y:true, z:false, i:false}` | ||
You can also specify internal fragments using the options 'ya' and 'yb'. | ||
## Isoelectric Point | ||
pKa of amino acids is based on https://en.wikipedia.org/wiki/Amino_acid. | ||
#### calculateCharge(sequence, ph) | ||
Calculate the charge for a specific amino acid sequence. The sequence should be entered in the form "HAlaGlyOH". | ||
Please take care about the N and C terminal end. You may use the methods "convertAASequence" to create such a sequence | ||
from other format. | ||
__Arguments__ | ||
* `sequence` - string with the amino acids sequence | ||
* `ph` - ph for which to calculate the charge. Default: 7.0 | ||
#### calculateIEP(sequence) | ||
Calculate the isoelectric point for a specific amino acid sequence. The sequence should be entered in the form "HAlaGlyOH". | ||
Please take care about the N and C terminal end. You may use the methods "convertAASequence" to create such a sequence | ||
from other format. | ||
__Arguments__ | ||
* `sequence` - string with the amino acids sequence | ||
#### calculateIEPChart(sequence) | ||
Returns an object containing the y and yAbs array of the charge of the peptide for a pH that goes from 0 to 14. | ||
__Arguments__ | ||
* `sequence` - string with the amino acids sequence | ||
#### getColorForIEP(iep) | ||
Returns a color based on the isoelectric point : | ||
* 0 -> 7 means that at pH 7 it is charged negatively (blue) | ||
* 7 -> 14 means that at pH7 it is charged positively (red) | ||
__Arguments__ | ||
* `iep` - the value of the isoelectric point | ||
## License | ||
@@ -12,0 +93,0 @@ |
@@ -6,5 +6,3 @@ 'use strict'; | ||
console.log(IEP); | ||
exports.getInfo = function () { | ||
@@ -31,2 +29,12 @@ return aa; | ||
exports.getColorForIEP = function (iep) { | ||
return IEP.getColor(iep); | ||
} | ||
exports.calculateCharge = function (sequence, ph) { | ||
var aas=sequence.replace(/([A-Z])/g," $1").split(/ /); | ||
aas=aas.slice(2,aas.length-2); | ||
return IEP.calculateCharge(aas, ph); | ||
} | ||
exports.generatePeptideFragments = function generatePeptideFragments(mf, options) { | ||
@@ -41,3 +49,5 @@ if (options === undefined) { | ||
z: false, | ||
i: false | ||
i: false, | ||
yb: false, | ||
ya: false | ||
}; | ||
@@ -57,4 +67,15 @@ } | ||
if (options.i) mfs.push(mfparts[i]+"HC-1O-1(+1)$i:"+mfparts[i]); | ||
if (options.ya || options.yb) { // we have double fragmentations | ||
for (var j=i+1; j<mfparts.length;j++) { | ||
var iTerm=''; | ||
for (var k=i; k<j; k++) { | ||
iTerm+=mfparts[k]; | ||
} | ||
addITerm(mfs, iTerm, i, j, options); | ||
} | ||
} | ||
} | ||
if (mfs.length === 0) { | ||
@@ -140,2 +161,7 @@ mfs = mfs.concat([mf]); | ||
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); | ||
} | ||
function addCTerm(mfs, cTerm, i, options) { | ||
@@ -142,0 +168,0 @@ if (options.x) mfs.push("CO(+1)"+cTerm+"$x"+i); |
@@ -14,5 +14,5 @@ 'use strict'; | ||
function calculateCharge(aaSequence, pH) { | ||
function calculateCharge(aas, pH) { | ||
if (! pH) pH=7.0; | ||
var combined=combine(aaSequence); | ||
var combined=combine(aas); | ||
if (!combined) return; | ||
@@ -79,11 +79,11 @@ var charge=calculateForPh(combined, pH); | ||
// we will combine the amino acids | ||
function combine(aaSequence) { | ||
function combine(aas) { | ||
var combined={}; | ||
if (aaObject[aaSequence[0]]) { | ||
combined.first=aaObject[aaSequence[0]].pKaN; | ||
if (aaObject[aas[0]]) { | ||
combined.first=aaObject[aas[0]].pKaN; | ||
} else { | ||
return; | ||
} | ||
if (aaObject[aaSequence[aaSequence.length-1]]) { | ||
combined.last=aaObject[aaSequence[aaSequence.length-1]].pKaC; | ||
if (aaObject[aas[aas.length-1]]) { | ||
combined.last=aaObject[aas[aas.length-1]].pKaC; | ||
} else { | ||
@@ -94,4 +94,4 @@ return; | ||
combined.acid={}; | ||
for (var i=0; i<aaSequence.length; i++) { | ||
var aa=aaSequence[i]; | ||
for (var i=0; i<aas.length; i++) { | ||
var aa=aas[i]; | ||
if (! aaObject[aa]) return; | ||
@@ -115,9 +115,26 @@ if (aaObject[aa].sc && aaObject[aa].sc.type) { | ||
/* | ||
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; | ||
var white=Math.round(255-(7-iep)*(200/4)); | ||
return "rgb("+white+","+white+",255)"; | ||
} else if (iep>7) { | ||
if (iep>11) iep=11; | ||
var white=Math.round(255-(iep-7)*(200/4)); | ||
return "rgb(255,"+white+","+white+")"; | ||
} | ||
return "rgb(255,255,255)"; | ||
} | ||
module.exports={ | ||
calculateIEP: calculateIEP, | ||
calculateCharge: calculateCharge, | ||
calculateChart: calculateChart | ||
calculateChart: calculateChart, | ||
getColor: getColor | ||
} | ||
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18416
4
0
103
12
540