|
@@ -11,7 +11,20 @@ import { PropertyDict } from '../types';
|
|
|
|
|
|
const reFloat = /[-+]?[0-9]*\.?[0-9]+/;
|
|
|
const rePosInt = /[+]?[0-9]+/;
|
|
|
-const reInt = /[-+]?[0-9]+/;
|
|
|
+const reInt = /[-+]?[0-9] +/;
|
|
|
+
|
|
|
+function atomNameListMapVMD(x: string) { return x.split(' ').map(B.atomName); };
|
|
|
+function listMapVMD(x: string) { return x.split(' ').map(x => x.replace(/^["']|["']$/g, '')); }
|
|
|
+function rangeMapVMD(x: string) {
|
|
|
+ const [min, max] = x.split('\sto\s').map(x => parseInt(x));
|
|
|
+ return { min, max };
|
|
|
+}
|
|
|
+function listOrRangeMapVMD(x: string) {
|
|
|
+ return x.includes('to') ? rangeMapVMD(x) : listMapVMD(x).map(x => parseInt(x));
|
|
|
+}
|
|
|
+//function elementListMap(x: string) {
|
|
|
+// return x.split('+').map(B.struct.type.elementSymbol);
|
|
|
+//}
|
|
|
|
|
|
function str(x: string) { return x; }
|
|
|
|
|
@@ -34,7 +47,7 @@ export const properties: PropertyDict = {
|
|
|
name: {
|
|
|
'@desc': 'str atom name',
|
|
|
'@examples': ['name CA'],
|
|
|
- regex: /[a-zA-Z0-9]+/, map: B.atomName,
|
|
|
+ regex: /[a-zA-Z0-9 ]+/, map: atomNameListMapVMD ,
|
|
|
level: 'atom-test', property: B.ammp('label_atom_id')
|
|
|
},
|
|
|
type: {
|
|
@@ -80,16 +93,23 @@ export const properties: PropertyDict = {
|
|
|
chain: {
|
|
|
'@desc': 'str the one-character chain identifier',
|
|
|
'@examples': ['chain A'],
|
|
|
- regex: /[a-zA-Z0-9]+/, map: str,
|
|
|
- level: 'residue-test', property: B.ammp('auth_asym_id')
|
|
|
+ regex: /[a-zA-Z0-9 ]+/, map :listMapVMD,
|
|
|
+ level: 'chain-test', property: B.ammp('auth_asym_id')
|
|
|
},
|
|
|
residue: {
|
|
|
'@desc': 'num a set of connected atoms with the same residue number',
|
|
|
'@examples': ['residue < 11', 'residue 11'],
|
|
|
isNumeric: true,
|
|
|
- regex: reInt, map: x => parseInt(x),
|
|
|
+ regex: reInt, map: x => listOrRangeMapVMD,
|
|
|
level: 'residue-test', property: B.ammp('auth_seq_id')
|
|
|
},
|
|
|
+ resid: {
|
|
|
+ '@desc': 'num residue id',
|
|
|
+ '@examples': ['resid 42'],
|
|
|
+ isNumeric: true,
|
|
|
+ regex: reInt, map: x => parseInt(x),
|
|
|
+ level: 'residue-test', property: B.ammp('auth_seq_id')
|
|
|
+ },
|
|
|
fragment: {
|
|
|
'@desc': 'num a set of connected residues',
|
|
|
'@examples': ['fragment 42'],
|
|
@@ -131,16 +151,9 @@ export const properties: PropertyDict = {
|
|
|
resname: {
|
|
|
'@desc': 'str residue name',
|
|
|
'@examples': ['resname ALA'],
|
|
|
- regex: /[a-zA-Z0-9]+/, map: str,
|
|
|
+ regex: /[a-zA-Z0-9 ]+/, map: atomNameListMapVMD,
|
|
|
level: 'residue-test', property: B.ammp('auth_comp_id')
|
|
|
},
|
|
|
- resid: {
|
|
|
- '@desc': 'num residue id',
|
|
|
- '@examples': ['resid 42'],
|
|
|
- isNumeric: true,
|
|
|
- regex: reInt, map: x => parseInt(x),
|
|
|
- level: 'residue-test', property: B.ammp('auth_seq_id')
|
|
|
- },
|
|
|
segname: {
|
|
|
'@desc': 'str segment name',
|
|
|
'@examples': ['segname B'],
|