Parcourir la source

handle more common ff residue/atom names

Alexander Rose il y a 3 ans
Parent
commit
0607ed46d1

+ 8 - 0
src/mol-model-formats/structure/util.ts

@@ -61,6 +61,14 @@ export function guessElementSymbolString(str: string) {
         ) return str;
     }
 
+    if (l === 3) { // three chars
+        if (str === 'SOD') return 'NA';
+        if (str === 'POT') return 'K';
+        if (str === 'CES') return 'CS';
+        if (str === 'CAL') return 'CA';
+        if (str === 'CLA') return 'CL';
+    }
+
     const c = str[0];
     if (c === 'C' || c === 'H' || c === 'N' || c === 'O' || c === 'P' || c === 'S') return c;
 

+ 12 - 0
src/mol-model/sequence/constants.ts

@@ -39,6 +39,18 @@ const ProteinOneLetterCodes: { [name: string]: AminoAlphabet }  = {
 
     'SEC': 'U',  // as per IUPAC definition
     'PYL': 'O',  // as per IUPAC definition
+
+    // charmm ff
+    'HSD': 'H', 'HSE': 'H', 'HSP': 'H',
+    'LSN': 'K',
+    'ASPP': 'D',
+    'GLUP': 'E',
+
+    // amber ff
+    'HID': 'H', 'HIE': 'H', 'HIP': 'H',
+    'LYN': 'K',
+    'ASH': 'D',
+    'GLH': 'E',
 };
 
 const DnaOneLetterCodes: { [name: string]: NuclecicAlphabet } = {

+ 0 - 33
src/mol-model/structure/model/properties/utils/guess-element.ts

@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-const elm1 = [ 'H', 'C', 'O', 'N', 'S', 'P' ];
-const elm2 = [ 'NA', 'CL', 'FE' ];
-
-function charAtIsNumber(str: string, index: number) {
-    const code = str.charCodeAt(index);
-    return code >= 48 && code <= 57;
-}
-
-export function guessElement(str: string) {
-    let at = str.trim().toUpperCase();
-
-    if (charAtIsNumber(at, 0)) at = at.substr(1);
-    // parse again to check for a second integer
-    if (charAtIsNumber(at, 0)) at = at.substr(1);
-    const n = at.length;
-
-    if (n === 0) return '';
-    if (n === 1) return at;
-    if (n === 2) {
-        if (elm2.indexOf(at) !== -1) return at;
-        if (elm1.indexOf(at[0]) !== -1) return at[0];
-    }
-    if (n >= 3) {
-        if (elm1.indexOf(at[0]) !== -1) return at[0];
-    }
-    return '';
-}

+ 21 - 4
src/mol-model/structure/model/types.ts

@@ -99,7 +99,7 @@ export const PolymerTypeAtomRoleId: { [k in PolymerType]: { [k in AtomRole]: Set
     [PolymerType.Protein]: {
         trace: new Set(['CA']),
         directionFrom: new Set(['C']),
-        directionTo: new Set(['O', 'OC1', 'O1', 'OX1', 'OXT']),
+        directionTo: new Set(['O', 'OC1', 'O1', 'OX1', 'OXT', 'OT1']),
         backboneStart: new Set(['N']),
         backboneEnd: new Set(['C']),
         // CA1 is used e.g. in GFP chromophores
@@ -246,8 +246,13 @@ export const AminoAcidNamesL = new Set([
     'HIS', 'ARG', 'LYS', 'ILE', 'PHE', 'LEU', 'TRP', 'ALA', 'MET', 'PRO', 'CYS',
     'ASN', 'VAL', 'GLY', 'SER', 'GLN', 'TYR', 'ASP', 'GLU', 'THR', 'SEC', 'PYL',
     'UNK', // unknown amino acid from CCD
-    'MSE', 'SEP', 'TPO', 'PTR', 'PCA' // common
+    'MSE', 'SEP', 'TPO', 'PTR', 'PCA', // common from CCD
 
+    // charmm ff
+    'HSD', 'HSE', 'HSP', 'LSN', 'ASPP', 'GLUP',
+
+    // amber ff
+    'HID', 'HIE', 'HIP', 'LYN', 'ASH', 'GLH',
 ]);
 export const AminoAcidNamesD = new Set([
     'DAL', // D-ALANINE
@@ -586,7 +591,13 @@ export const MaxAsa = {
     'THR': 163.0,
     'TRP': 264.0,
     'TYR': 255.0,
-    'VAL': 165.0
+    'VAL': 165.0,
+
+    // charmm ff
+    'HSD': 216.0, 'HSE': 216.0, 'HSP': 216.0,
+
+    // amber ff
+    'HID': 216.0, 'HIE': 216.0, 'HIP': 216.0, 'ASH': 187.0, 'GLH': 214.0,
 };
 export const DefaultMaxAsa = 121.0;
 
@@ -680,6 +691,12 @@ export const ResidueHydrophobicity = {
     'THR': [0.14, 0.25, 0.11],
     'TRP': [-1.85, -2.09, -0.24],
     'TYR': [-0.94, -0.71, 0.23],
-    'VAL': [0.07, -0.46, -0.53]
+    'VAL': [0.07, -0.46, -0.53],
+
+    // charmm ff
+    'HSD': [0.17, 0.11, -0.06], 'HSE': [0.17, 0.11, -0.06], 'HSP': [0.96, 2.33, 1.37],
+
+    // amber ff
+    'HID': [0.17, 0.11, -0.06], 'HIE': [0.17, 0.11, -0.06], 'HIP': [0.96, 2.33, 1.37],
 };
 export const DefaultResidueHydrophobicity = [0.00, 0.00, 0.00];