|
@@ -34,18 +34,18 @@ export interface QueryDefinition {
|
|
|
structureTransform?: (params: any, s: Structure) => Promise<Structure>
|
|
|
}
|
|
|
|
|
|
-const AtomSiteParams = {
|
|
|
- entity_id: <QueryParamInfo>{ name: 'entity_id', type: QueryParamType.String, description: 'Corresponds to the \'_entity.id\' or \'*.label_entity_id\' field, depending on the context.' },
|
|
|
+// const AtomSiteParams = {
|
|
|
+// entity_id: <QueryParamInfo>{ name: 'entity_id', type: QueryParamType.String, description: 'Corresponds to the \'_entity.id\' or \'*.label_entity_id\' field, depending on the context.' },
|
|
|
|
|
|
- label_asym_id: <QueryParamInfo>{ name: 'label_asym_id', type: QueryParamType.String, description: 'Corresponds to the \'_atom_site.label_asym_id\' field.' },
|
|
|
- auth_asym_id: <QueryParamInfo>{ name: 'auth_asym_id', type: QueryParamType.String, exampleValue: 'A', description: 'Corresponds to the \'_atom_site.auth_asym_id\' field.' },
|
|
|
+// label_asym_id: <QueryParamInfo>{ name: 'label_asym_id', type: QueryParamType.String, description: 'Corresponds to the \'_atom_site.label_asym_id\' field.' },
|
|
|
+// auth_asym_id: <QueryParamInfo>{ name: 'auth_asym_id', type: QueryParamType.String, exampleValue: 'A', description: 'Corresponds to the \'_atom_site.auth_asym_id\' field.' },
|
|
|
|
|
|
- label_seq_id: <QueryParamInfo>{ name: 'label_seq_id', type: QueryParamType.Integer, description: 'Residue seq. number. Corresponds to the \'_atom_site.label_seq_id\' field.' },
|
|
|
- auth_seq_id: <QueryParamInfo>{ name: 'auth_seq_id', type: QueryParamType.Integer, exampleValue: '200', description: 'Author residue seq. number. Corresponds to the \'_atom_site.auth_seq_id\' field.' },
|
|
|
- label_comp_id: <QueryParamInfo>{ name: 'label_comp_id', type: QueryParamType.String, description: 'Residue name. Corresponds to the \'_atom_site.label_comp_id\' field.' },
|
|
|
- auth_comp_id: <QueryParamInfo>{ name: 'auth_comp_id', type: QueryParamType.String, exampleValue: 'REA', description: 'Author residue name. Corresponds to the \'_atom_site.auth_comp_id\' field.' },
|
|
|
- pdbx_PDB_ins_code: <QueryParamInfo>{ name: 'pdbx_PDB_ins_code', type: QueryParamType.String, description: 'Corresponds to the \'_atom_site.pdbx_PDB_ins_code\' field.' },
|
|
|
-};
|
|
|
+// label_seq_id: <QueryParamInfo>{ name: 'label_seq_id', type: QueryParamType.Integer, description: 'Residue seq. number. Corresponds to the \'_atom_site.label_seq_id\' field.' },
|
|
|
+// auth_seq_id: <QueryParamInfo>{ name: 'auth_seq_id', type: QueryParamType.Integer, exampleValue: '200', description: 'Author residue seq. number. Corresponds to the \'_atom_site.auth_seq_id\' field.' },
|
|
|
+// label_comp_id: <QueryParamInfo>{ name: 'label_comp_id', type: QueryParamType.String, description: 'Residue name. Corresponds to the \'_atom_site.label_comp_id\' field.' },
|
|
|
+// auth_comp_id: <QueryParamInfo>{ name: 'auth_comp_id', type: QueryParamType.String, exampleValue: 'REA', description: 'Author residue name. Corresponds to the \'_atom_site.auth_comp_id\' field.' },
|
|
|
+// pdbx_PDB_ins_code: <QueryParamInfo>{ name: 'pdbx_PDB_ins_code', type: QueryParamType.String, description: 'Corresponds to the \'_atom_site.pdbx_PDB_ins_code\' field.' },
|
|
|
+// };
|
|
|
|
|
|
const AtomSiteTestParams: QueryParamInfo = {
|
|
|
name: 'atom_site',
|
|
@@ -99,10 +99,10 @@ const QueryMap: { [id: string]: Partial<QueryDefinition> } = {
|
|
|
}]
|
|
|
},
|
|
|
'residueInteraction': {
|
|
|
- niceName: 'Residues Inside a Sphere',
|
|
|
+ niceName: 'Residue Interaction',
|
|
|
description: 'Identifies all residues within the given radius from the source residue. Takes crystal symmetry into account.',
|
|
|
query(p) {
|
|
|
- const tests = getAtomsTests(p);
|
|
|
+ const tests = getAtomsTests(p.atom_site);
|
|
|
const center = Queries.combinators.merge(tests.map(test => Queries.generators.atoms({
|
|
|
...test,
|
|
|
entityTest: test.entityTest
|
|
@@ -114,17 +114,7 @@ const QueryMap: { [id: string]: Partial<QueryDefinition> } = {
|
|
|
structureTransform(p, s) {
|
|
|
return StructureSymmetry.builderSymmetryMates(s, p.radius).run();
|
|
|
},
|
|
|
- params: [
|
|
|
- AtomSiteParams.entity_id,
|
|
|
- AtomSiteParams.label_asym_id,
|
|
|
- AtomSiteParams.auth_asym_id,
|
|
|
- AtomSiteParams.label_comp_id,
|
|
|
- AtomSiteParams.auth_comp_id,
|
|
|
- AtomSiteParams.pdbx_PDB_ins_code,
|
|
|
- AtomSiteParams.label_seq_id,
|
|
|
- AtomSiteParams.auth_seq_id,
|
|
|
- RadiusParam,
|
|
|
- ]
|
|
|
+ params: [ AtomSiteTestParams, RadiusParam ]
|
|
|
},
|
|
|
};
|
|
|
|
|
@@ -148,30 +138,32 @@ export const QueryList = (function () {
|
|
|
}
|
|
|
})();
|
|
|
|
|
|
-function _normalizeQueryParams(params: { [p: string]: string }, paramList: QueryParamInfo[]): { [p: string]: string | number | boolean } {
|
|
|
- const ret: any = {};
|
|
|
- for (const p of paramList) {
|
|
|
- const key = p.name;
|
|
|
- const value = params[key];
|
|
|
- if (typeof value === 'undefined' || (typeof value !== 'undefined' && value !== null && value['length'] === 0)) {
|
|
|
- if (p.required) {
|
|
|
- throw `The parameter '${key}' is required.`;
|
|
|
- }
|
|
|
- if (typeof p.defaultValue !== 'undefined') ret[key] = p.defaultValue;
|
|
|
- } else {
|
|
|
- switch (p.type) {
|
|
|
- case QueryParamType.String: ret[key] = value; break;
|
|
|
- case QueryParamType.Integer: ret[key] = parseInt(value); break;
|
|
|
- case QueryParamType.Float: ret[key] = parseFloat(value); break;
|
|
|
- }
|
|
|
-
|
|
|
- if (p.validation) p.validation(ret[key]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
+// function _normalizeQueryParams(params: { [p: string]: string }, paramList: QueryParamInfo[]): { [p: string]: string | number | boolean } {
|
|
|
+// const ret: any = {};
|
|
|
+// for (const p of paramList) {
|
|
|
+// const key = p.name;
|
|
|
+// const value = params[key];
|
|
|
+// if (typeof value === 'undefined' || (typeof value !== 'undefined' && value !== null && value['length'] === 0)) {
|
|
|
+// if (p.required) {
|
|
|
+// throw `The parameter '${key}' is required.`;
|
|
|
+// }
|
|
|
+// if (typeof p.defaultValue !== 'undefined') ret[key] = p.defaultValue;
|
|
|
+// } else {
|
|
|
+// switch (p.type) {
|
|
|
+// case QueryParamType.JSON: ret[key] = JSON.parse(value); break;
|
|
|
+// case QueryParamType.String: ret[key] = value; break;
|
|
|
+// case QueryParamType.Integer: ret[key] = parseInt(value); break;
|
|
|
+// case QueryParamType.Float: ret[key] = parseFloat(value); break;
|
|
|
+// }
|
|
|
+
|
|
|
+// if (p.validation) p.validation(ret[key]);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// return ret;
|
|
|
+// }
|
|
|
|
|
|
export function normalizeQueryParams(query: QueryDefinition, params: any) {
|
|
|
- return _normalizeQueryParams(params, query.params);
|
|
|
+ return params;
|
|
|
+ //return _normalizeQueryParams(params, query.params);
|
|
|
}
|