molstar
Version:
A comprehensive macromolecular library.
43 lines (42 loc) • 1.57 kB
JavaScript
/**
* Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Koya Sakuma <koya.sakuma.work@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*
* Adapted from MolQL project
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.operators = void 0;
const tslib_1 = require("tslib");
const P = tslib_1.__importStar(require("../../../mol-util/monadic-parser"));
const h = tslib_1.__importStar(require("../helper"));
const builder_1 = require("../../../mol-script/language/builder");
const B = builder_1.MolScriptBuilder;
exports.operators = [
{
'@desc': 'Selects atoms that are not included in s1.',
'@examples': ['not ARG'],
name: 'not',
type: h.prefix,
rule: P.MonadicParser.alt(P.MonadicParser.regex(/NOT/i).skip(P.MonadicParser.whitespace), P.MonadicParser.string('!').skip(P.MonadicParser.optWhitespace)),
map: (op, selection) => h.invertExpr(selection),
},
{
'@desc': 'Selects atoms included in both s1 and s2.',
'@examples': ['ASP and .CA'],
name: 'and',
type: h.binaryLeft,
rule: h.infixOp(/AND|&/i),
map: (op, selection, by) => B.struct.modifier.intersectBy({ 0: selection, by })
},
{
'@desc': 'Selects atoms included in either s1 or s2.',
'@examples': ['ASP or GLU'],
name: 'or',
type: h.binaryLeft,
rule: h.infixOp(/OR|\||,/i),
map: (op, s1, s2) => B.struct.combinator.merge([s1, s2])
}
];
;