Browse Source

formatting

Alexander Rose 2 years ago
parent
commit
151da1487c

+ 13 - 13
src/mol-script/transpilers/jmol/keywords.ts

@@ -32,7 +32,7 @@ const ResDict = {
 
 const Backbone = {
     nucleic: ['P', "O3'", "O5'", "C5'", "C4'", "C3'", 'OP1', 'OP2', 'O3*', 'O5*', 'C5*', 'C4*', 'C3*',
-	      "C2'", "C1'", "O4'", "O2'"],
+        "C2'", "C1'", "O4'", "O2'"],
     protein: ['C', 'N', 'CA']
 };
 
@@ -84,31 +84,31 @@ function proteinExpr() {
 // TODO: improve, see keywords.backbone['@desc'] below
 function backboneExpr() {
     return B.struct.combinator.merge([
-	    B.struct.modifier.intersectBy({
+        B.struct.modifier.intersectBy({
             0: B.struct.generator.atomGroups({
                 'residue-test': B.core.set.has([
                     B.core.type.set(ResDict.amino),
                     B.ammp('label_comp_id')
                 ])
             }),
-		    by: B.struct.generator.atomGroups({
-		       'atom-test': B.core.set.has([
-			        B.core.type.set(Backbone.protein),
-			        B.ammp('label_atom_id')
+            by: B.struct.generator.atomGroups({
+                'atom-test': B.core.set.has([
+                    B.core.type.set(Backbone.protein),
+                    B.ammp('label_atom_id')
                 ])
             })
         }),
-	    B.struct.modifier.intersectBy({
+        B.struct.modifier.intersectBy({
             0: B.struct.generator.atomGroups({
-		        'residue-test': B.core.set.has([
+                'residue-test': B.core.set.has([
                     B.core.type.set(ResDict.nucleic),
                     B.ammp('label_comp_id')
-		        ])
+                ])
             }),
-		    by: B.struct.generator.atomGroups({
-		        'atom-test': B.core.set.has([
-			        B.core.type.set(Backbone.nucleic),
-			        B.ammp('label_atom_id')
+            by: B.struct.generator.atomGroups({
+                'atom-test': B.core.set.has([
+                    B.core.type.set(Backbone.nucleic),
+                    B.ammp('label_atom_id')
                 ])
             })
         }),

+ 1 - 1
src/mol-script/transpilers/jmol/parser.ts

@@ -31,7 +31,7 @@ const valueOperators: OperatorList = [
         rule: P.MonadicParser.regexp(/\s*(LIKE|>=|<=|=|!=|>|<)\s*/i, 1),
         map: (op, e1, e2) => {
             let expr;
-	    if (e1 === 'structure') {
+            if (e1 === 'structure') {
                 expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e2)]);
             } else if (e2 === 'structure') {
                 expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e1)]);

+ 1 - 1
src/mol-script/transpilers/jmol/properties.ts

@@ -13,7 +13,7 @@ const rePosInt = /[0-9]+/;
 
 function str(x: string) { return x; }
 
-const structureDict: {[key: string]: string} = {
+const structureDict: { [key: string]: string } = {
     none: 'none',
     turn: 'turn',
     sheet: 'beta',

+ 26 - 23
src/mol-script/transpilers/pymol/keywords.ts

@@ -18,36 +18,38 @@ const ResDict = {
 
 const Backbone = {
     nucleic: ['P', "O3'", "O5'", "C5'", "C4'", "C3'", 'OP1', 'OP2', 'O3*', 'O5*', 'C5*', 'C4*', 'C3*',
-	      "C2'", "C1'", "O4'", "O2'"],
+        "C2'", "C1'", "O4'", "O2'"],
     protein: ['C', 'N', 'CA', 'O']
 };
 
 function backboneExpr() {
     return B.struct.combinator.merge([
-	    B.struct.modifier.intersectBy(
-            { 0: B.struct.generator.atomGroups({
-		    'residue-test': B.core.set.has([
+        B.struct.modifier.intersectBy({
+            0: B.struct.generator.atomGroups({
+                'residue-test': B.core.set.has([
                     B.core.type.set(ResDict.protein),
                     B.ammp('label_comp_id')
-		    ]) })
-		  ,
-		  by: B.struct.generator.atomGroups({
-		      'atom-test': B.core.set.has([
-			  B.core.type.set(Backbone.protein),
-			  B.ammp('label_atom_id')]) })
+                ])
             }),
-	    B.struct.modifier.intersectBy(
-            { 0: B.struct.generator.atomGroups({
-		    'residue-test': B.core.set.has([
+            by: B.struct.generator.atomGroups({
+                'atom-test': B.core.set.has([
+                    B.core.type.set(Backbone.protein),
+                    B.ammp('label_atom_id')])
+            })
+        }),
+        B.struct.modifier.intersectBy({
+            0: B.struct.generator.atomGroups({
+                'residue-test': B.core.set.has([
                     B.core.type.set(ResDict.nucleic),
                     B.ammp('label_comp_id')
-		    ]) })
-		  ,
-		  by: B.struct.generator.atomGroups({
-		      'atom-test': B.core.set.has([
-			  B.core.type.set(Backbone.nucleic),
-			  B.ammp('label_atom_id')]) })
+                ])
             }),
+            by: B.struct.generator.atomGroups({
+                'atom-test': B.core.set.has([
+                    B.core.type.set(Backbone.nucleic),
+                    B.ammp('label_atom_id')])
+            })
+        }),
     ]);
 
 }
@@ -98,13 +100,14 @@ export const keywords: KeywordDict = {
         '@desc': 'Polymer non-backbone atoms (new in PyMOL 1.6.1)',
         abbr: ['sc.'],
         map: () => {
-	    return B.struct.modifier.exceptBy({
+            return B.struct.modifier.exceptBy({
                 '0': B.struct.generator.atomGroups({
-		    'residue-test': B.core.set.has([
+                    'residue-test': B.core.set.has([
                         B.core.type.set(ResDict.nucleic.concat(ResDict.protein)),
-                        B.ammp('label_comp_id')]) }),
+                        B.ammp('label_comp_id')])
+                }),
                 by: backboneExpr()
-	    });
+            });
         },
     },
     present: {

+ 1 - 1
src/mol-script/transpilers/pymol/parser.ts

@@ -58,7 +58,7 @@ const lang = P.MonadicParser.createLanguage({
 
     Expression: function (r: any) {
         return P.MonadicParser.alt(
-	    r.Keywords,
+            r.Keywords,
             r.AtomSelectionMacro.map(atomSelectionQuery),
             r.NamedAtomProperties,
             r.Pepseq,

+ 18 - 18
src/mol-script/transpilers/pymol/properties.ts

@@ -21,49 +21,49 @@ function listOrRangeMap(x: string) {
         const pSplit = x.split('+').map(x => x.replace(/^["']|["']$/g, ''));
         const res: number[] = [];
         pSplit.forEach(x => {
-	    if (x.includes('-') && !x.startsWith('-')) {
-                const [min, max] = x.split('-').map(x=>parseInt(x));
+            if (x.includes('-') && !x.startsWith('-')) {
+                const [min, max] = x.split('-').map(x => parseInt(x));
                 for (let i = min; i <= max; i++) {
-		    res.push(i);
+                    res.push(i);
                 }
-	    } else if (x.includes('-') && x.startsWith('-') && x.match(/[0-9]+-[-0-9]+/)) {
+            } else if (x.includes('-') && x.startsWith('-') && x.match(/[0-9]+-[-0-9]+/)) {
                 const min = -parseInt(x.split('-')[1]);
                 let max;
                 if (x.includes('--')) {
-		    max = -parseInt(x.split('-')[3]);
+                    max = -parseInt(x.split('-')[3]);
                 } else {
-		    max = parseInt(x.split('-')[2]);
+                    max = parseInt(x.split('-')[2]);
                 }
                 for (let i = min; i <= max; i++) {
-		    res.push(i);
+                    res.push(i);
                 }
-	    } else if (x.includes('-') && x.startsWith('-') && !x.match(/[0-9]+-[-0-9]+/)) {
+            } else if (x.includes('-') && x.startsWith('-') && !x.match(/[0-9]+-[-0-9]+/)) {
                 res.push(parseInt(x));
-	    } else {
+            } else {
                 res.push(parseInt(x));
-	    }
+            }
         });
         return res;
     } else if (x.includes('-') && !x.includes('+')) {
         const res: number[] = [];
         if (!x.startsWith('-')) {
-            const [min, max] = x.split('-').map(x=>parseInt(x));
+            const [min, max] = x.split('-').map(x => parseInt(x));
             for (let i = min; i <= max; i++) {
                 res.push(i);
             }
         } else if (x.startsWith('-') && x.match(/[0-9]+-[-0-9]+/)) {
-	    const min = -parseInt(x.split('-')[1]);
-	    let max;
-	    if (x.includes('--')) {
+            const min = -parseInt(x.split('-')[1]);
+            let max;
+            if (x.includes('--')) {
                 max = -parseInt(x.split('-')[3]);
-	    } else {
+            } else {
                 max = parseInt(x.split('-')[2]);
-	    }
-	    for (let i = min; i <= max; i++) {
+            }
+            for (let i = min; i <= max; i++) {
                 res.push(i);
             }
         } else if (x.startsWith('-') && !x.match(/[0-9]+-[-0-9]+/)) {
-	    res.push(parseInt(x));
+            res.push(parseInt(x));
         } else {
             res.push(parseInt(x));
         }

+ 13 - 13
src/mol-script/transpilers/vmd/parser.ts

@@ -56,33 +56,33 @@ const valueOperators: OperatorList = [
         rule: P.MonadicParser.alt(P.MonadicParser.regexp(/\s*(=~|==|>=|<=|=|!=|>|<)\s*/, 1), P.MonadicParser.whitespace.result('=')),
         map: (op, e1, e2) => {
             let expr;
-	    if (e1.head !== undefined) {
+            if (e1.head !== undefined) {
                 if (e1.head.name === 'structure-query.atom-property.macromolecular.secondary-structure-flags') {
-		    expr = B.core.flags.hasAny([e1, sstrucMap(e2)]);
+                    expr = B.core.flags.hasAny([e1, sstrucMap(e2)]);
                 }
                 if (e1.head.name === 'core.type.regex') {
-		    expr = B.core.str.match([e1, B.core.type.str([e2])]);
+                    expr = B.core.str.match([e1, B.core.type.str([e2])]);
                 }
-	    } else if (e2.head !== undefined) {
+            } else if (e2.head !== undefined) {
                 if (e2.head.name === 'structure-query.atom-property.macromolecular.secondary-structure-flags') {
-		    expr = B.core.flags.hasAny([e2, sstrucMap(e1)]);
+                    expr = B.core.flags.hasAny([e2, sstrucMap(e1)]);
                 }
                 if (e2.head.name === 'core.type.regex') {
-		    expr = B.core.str.match([e2, B.core.type.str([e1])]);
+                    expr = B.core.str.match([e2, B.core.type.str([e1])]);
                 }
-	    } else if (op === '=~') {
+            } else if (op === '=~') {
                 if (e1.head) {
-		    expr = B.core.str.match([
+                    expr = B.core.str.match([
                         B.core.type.regex([`^${e2}$`, 'i']),
                         B.core.type.str([e1])
-		    ]);
+                    ]);
                 } else {
-		    expr = B.core.str.match([
+                    expr = B.core.str.match([
                         B.core.type.regex([`^${e1}$`, 'i']),
                         B.core.type.str([e2])
-		    ]);
+                    ]);
                 }
-	    }
+            }
             if (!expr) {
                 if (e1.head) e2 = h.wrapValue(e1, e2);
                 if (e2.head) e1 = h.wrapValue(e2, e1);
@@ -179,7 +179,7 @@ const lang = P.MonadicParser.createLanguage({
                 test = rangeTest ? rangeTest : listTest;
             }
 
-	    return B.struct.generator.atomGroups({ [h.testLevel(property)]: test });
+            return B.struct.generator.atomGroups({ [h.testLevel(property)]: test });
         });
     },