Browse Source

Enabling some numerical properties and cleaning by lint

yakomaxa 2 years ago
parent
commit
b03b306848

+ 3 - 3
src/mol-script/transpilers/rasmol/operators.ts

@@ -39,10 +39,10 @@ export const operators: OperatorList = [
         '@desc': 'Selects atoms included in either s1 or s2.',
         '@examples': ['ASP or GLU'],
         name: 'or',
-	abbr: [','],
+        abbr: [','],
         type: h.binaryLeft,
-	rule: P.MonadicParser.alt(h.infixOp(/OR|\||\|\||,/i)),
-//        rule: h.infixOp(/OR|\||\|\|/i),
+        rule: P.MonadicParser.alt(h.infixOp(/OR|\||\|\||,/i)),
+        //        rule: h.infixOp(/OR|\||\|\|/i),
         map: (op, s1, s2) => B.struct.combinator.merge([s1, s2])
     },
     /*

+ 7 - 8
src/mol-script/transpilers/rasmol/parser.ts

@@ -41,7 +41,6 @@ function orNull(rule: P.MonadicParser<any>) {
     return rule.or(P.MonadicParser.of(null));
 }
 
-
 function atomSelectionQuery2(x: any) {
     const tests: AtomGroupArgs = {};
     const props: { [k: string]: any[] } = {};
@@ -143,31 +142,31 @@ const lang = P.MonadicParser.createLanguage({
 	    commu.then(P.MonadicParser.alt(
                 P.MonadicParser.alt(
                     P.MonadicParser.alt(
-			P.MonadicParser.seq(
+                        P.MonadicParser.seq(
                             orNull(propertiesDict.resn).skip(tator),
 			    orNull(propertiesDict.resi).skip(colon),
                             orNull(propertiesDict.chain).skip(dot),
                             orNull(propertiesDict.name)
                         ).map(x => { return { resn: x[0], resi: x[1], chain: x[2], name: x[3] }; }),
-			P.MonadicParser.seq(
+                        P.MonadicParser.seq(
                             orNull(propertiesDict.resn).skip(tator),
 			    orNull(propertiesDict.resi).skip(colon),
                             orNull(propertiesDict.chain)
                         ).map(x => { return { resn: x[0], resi: x[1], chain: x[2] }; }),
-			P.MonadicParser.seq(
+                        P.MonadicParser.seq(
 			    orNull(propertiesDict.resn).skip(tator),
 			    orNull(propertiesDict.resi).skip(colon).skip(dot),
                             orNull(propertiesDict.name)
-			).map(x => { return { resn: x[0], resi: x[1], name: x[2] }; }),
-			P.MonadicParser.seq(
+                        ).map(x => { return { resn: x[0], resi: x[1], name: x[2] }; }),
+                        P.MonadicParser.seq(
                             orNull(propertiesDict.resn).skip(tator),
 			    orNull(propertiesDict.resi).skip(dot),
                             orNull(propertiesDict.name)
                         ).map(x => { return { resn: x[0], resi: x[1], name: x[2] }; }),
-			P.MonadicParser.seq(
+                        P.MonadicParser.seq(
                             orNull(propertiesDict.resn).skip(tator),
 			    orNull(propertiesDict.resi)
-                        ).map(x => { return { resn: x[0], resi: x[1]}; }),
+                        ).map(x => { return { resn: x[0], resi: x[1] }; }),
                         P.MonadicParser.seq(
                             orNull(propertiesDict.resn).skip(tator).skip(colon),
                             orNull(propertiesDict.chain).skip(dot),

+ 5 - 8
src/mol-script/transpilers/rasmol/properties.ts

@@ -214,6 +214,7 @@ export const properties: PropertyDict = {
     formalCharge: {
         '@desc': 'formal charge',
         '@examples': ['formalCharge=1'],
+        isNumeric: true,
         regex: reFloat, map: x => parseFloat(x),
         level: 'atom-test', property: B.ammp('pdbx_formal_charge')
     },
@@ -336,6 +337,7 @@ export const properties: PropertyDict = {
     mass: {
         '@desc': 'atomic mass -- especially useful with appended .max or .sum',
         '@examples': ['mass > 13'],
+        isNumeric: true,
         regex: reFloat, map: x => parseFloat(x),
         level: 'atom-test', property: B.acp('mass')
     },
@@ -391,6 +393,7 @@ export const properties: PropertyDict = {
     occupancy: {
         '@desc': 'CIF file site occupancy. In SELECT command comparisons ("select occupancy < 90"), an integer n implies measurement on a 0-100 scale; also, in the context %[occupancy] or %q for a label, the reported number is a percentage. In all other cases, such as when %Q is used in a label or when a decimal number is used in a comparison, the scale is 0.0 - 1.0.',
         '@examples': ['occupancy < 1'],
+        isNumeric: true,
         regex: reFloat, map: x => parseFloat(x),
         level: 'atom-test', property: B.ammp('occupancy')
     },
@@ -450,14 +453,6 @@ export const properties: PropertyDict = {
         regex: /-?[0-9]+/, map: x => parseInt(x),
         level: 'residue-test', property: B.ammp('auth_seq_id')
     },
-    hoge: {
-        '@desc': 'PDB residue number, not including insertion code (see also seqcode, below)',
-        '@examples': ['resno = 100'],
-        //        isNumeric: true,
-        regex: /-?[0-9]+/, map: x => parseInt(x),
-        level: 'residue-test', property: B.ammp('auth_seq_id')
-
-    },
     selected: {
         '@desc': '1.0 if atom is selected; 0.0 if not',
         '@examples': [''],
@@ -557,6 +552,7 @@ export const properties: PropertyDict = {
     temperature: {
         '@desc': 'yes  yes  temperature factor (B-factor)',
         '@examples': ['temperature >= 20'],
+        isNumeric: true,
         regex: reFloat, map: x => parseFloat(x),
         level: 'atom-test', property: B.ammp('B_iso_or_equiv')
     },
@@ -598,6 +594,7 @@ export const properties: PropertyDict = {
     vanderwaals: {
         '@desc': 'van der Waals radius',
         '@examples': ['vanderwaals >2'],
+        isNumeric: true,
         regex: reFloat, map: x => parseFloat(x),
         level: 'atom-test', property: B.acp('vdw')
     },