Skip to content
Snippets Groups Projects
Commit 437d52e4 authored by Alexander Rose's avatar Alexander Rose
Browse files

fix comp_id issues from making it a atom prop, #66

parent abef75bf
No related branches found
No related tags found
No related merge requests found
...@@ -319,11 +319,11 @@ export namespace PropertyAccess { ...@@ -319,11 +319,11 @@ export namespace PropertyAccess {
const a = await StructureSymmetry.buildSymmetryRange(s, Vec3.create(-2, -2, -2), Vec3.create(2, 2, 2)).run(); const a = await StructureSymmetry.buildSymmetryRange(s, Vec3.create(-2, -2, -2), Vec3.create(2, 2, 2)).run();
// console.log(printUnits(a)); // console.log(printUnits(a));
const auth_comp_id = SP.residue.auth_comp_id, op = SP.unit.operator_name; const auth_comp_id = SP.atom.auth_comp_id, op = SP.unit.operator_name;
// const q1 = Q.generators.atoms({ residueTest: l => auth_comp_id(l) === 'REA' }); // const q1 = Q.generators.atoms({ residueTest: l => auth_comp_id(l) === 'REA' });
const q1 = Q.modifiers.includeSurroundings(Q.generators.atoms({ const q1 = Q.modifiers.includeSurroundings(Q.generators.atoms({
chainTest: l => op(l.element) === '1_555', chainTest: l => op(l.element) === '1_555',
residueTest: l => auth_comp_id(l.element) === 'REA' atomTest: l => auth_comp_id(l.element) === 'REA'
}), { }), {
radius: 5, radius: 5,
wholeResidues: true wholeResidues: true
...@@ -431,18 +431,18 @@ export namespace PropertyAccess { ...@@ -431,18 +431,18 @@ export namespace PropertyAccess {
// const authSeqId = Element.property(l => l.unit.hierarchy.residues.auth_seq_id.value(l.unit.residueIndex[l.atom])); // const authSeqId = Element.property(l => l.unit.hierarchy.residues.auth_seq_id.value(l.unit.residueIndex[l.atom]));
// const auth_seq_id = SP.residue.auth_seq_id; // const auth_seq_id = SP.residue.auth_seq_id;
const auth_comp_id = SP.residue.auth_comp_id; const auth_comp_id = SP.atom.auth_comp_id;
// const auth_asym_id = SP.chain.auth_asym_id; // const auth_asym_id = SP.chain.auth_asym_id;
// const set = new Set(['A', 'B', 'C', 'D']); // const set = new Set(['A', 'B', 'C', 'D']);
// const q = Q.generators.atomGroups({ atomTest: l => auth_seq_id(l) < 3 }); // const q = Q.generators.atomGroups({ atomTest: l => auth_seq_id(l) < 3 });
const q = Q.generators.atoms({ atomTest: Q.pred.eq(l => SP.residue.auth_comp_id(l.element), 'ALA') }); const q = Q.generators.atoms({ atomTest: Q.pred.eq(l => SP.atom.auth_comp_id(l.element), 'ALA') });
const P = SP; const P = SP;
// const q0 = Q.generators.atoms({ atomTest: l => auth_comp_id(l) === 'ALA' }); // const q0 = Q.generators.atoms({ atomTest: l => auth_comp_id(l) === 'ALA' });
const q1 = (Q.generators.atoms({ residueTest: l => auth_comp_id(l.element) === 'ALA' })); const q1 = (Q.generators.atoms({ atomTest: l => auth_comp_id(l.element) === 'ALA' }));
const q2 = (Q.generators.atoms({ residueTest: l => auth_comp_id(l.element) === 'ALA', groupBy: l => SP.residue.key(l.element) })); const q2 = (Q.generators.atoms({ atomTest: l => auth_comp_id(l.element) === 'ALA', groupBy: l => SP.residue.key(l.element) }));
const q3 = (Q.generators.atoms({ const q3 = (Q.generators.atoms({
chainTest: Q.pred.inSet(l => P.chain.auth_asym_id(l.element), ['A', 'B', 'C', 'D']), chainTest: Q.pred.inSet(l => P.chain.auth_asym_id(l.element), ['A', 'B', 'C', 'D']),
residueTest: Q.pred.eq(l => P.residue.auth_comp_id(l.element), 'ALA') atomTest: Q.pred.eq(l => P.atom.auth_comp_id(l.element), 'ALA')
})); }));
await query(q, structures[0]); await query(q, structures[0]);
// console.log(to_mmCIF('test', Selection.union(q0r))); // console.log(to_mmCIF('test', Selection.union(q0r)));
......
...@@ -62,16 +62,6 @@ function residueTest(params: AtomSiteSchemaElement): QueryPredicate | undefined ...@@ -62,16 +62,6 @@ function residueTest(params: AtomSiteSchemaElement): QueryPredicate | undefined
values.push(+params.auth_seq_id); values.push(+params.auth_seq_id);
} }
if (typeof params.label_comp_id !== 'undefined') {
props.push(Props.residue.label_comp_id);
values.push(params.label_comp_id);
}
if (typeof params.auth_comp_id !== 'undefined') {
props.push(Props.residue.auth_comp_id);
values.push(params.auth_comp_id);
}
if (typeof params.pdbx_PDB_ins_code !== 'undefined') { if (typeof params.pdbx_PDB_ins_code !== 'undefined') {
props.push(Props.residue.pdbx_PDB_ins_code); props.push(Props.residue.pdbx_PDB_ins_code);
values.push(params.pdbx_PDB_ins_code); values.push(params.pdbx_PDB_ins_code);
...@@ -100,6 +90,16 @@ function atomTest(params: AtomSiteSchemaElement): QueryPredicate | undefined { ...@@ -100,6 +90,16 @@ function atomTest(params: AtomSiteSchemaElement): QueryPredicate | undefined {
values.push(ElementSymbol(params.type_symbol)); values.push(ElementSymbol(params.type_symbol));
} }
if (typeof params.label_comp_id !== 'undefined') {
props.push(Props.atom.label_comp_id);
values.push(params.label_comp_id);
}
if (typeof params.auth_comp_id !== 'undefined') {
props.push(Props.atom.auth_comp_id);
values.push(params.auth_comp_id);
}
return andEqual(props, values); return andEqual(props, values);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment