molstar
Version:
A comprehensive macromolecular library.
43 lines (42 loc) • 1.66 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;
var tslib_1 = require("tslib");
var P = tslib_1.__importStar(require("../../../mol-util/monadic-parser"));
var h = tslib_1.__importStar(require("../helper"));
var builder_1 = require("../../../mol-script/language/builder");
var 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: function (op, selection) { return 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: function (op, selection, by) { return B.struct.modifier.intersectBy({ 0: selection, by: 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: function (op, s1, s2) { return B.struct.combinator.merge([s1, s2]); }
}
];
;