@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
42 lines • 2.17 kB
JavaScript
import { __awaiter } from "tslib";
import { rcsbClient } from "../../RcsbGraphQL/RcsbClient";
import { Assertions } from "../../RcsbUtils/Helpers/Assertions";
var assertElementListDefined = Assertions.assertElementListDefined;
var assertDefined = Assertions.assertDefined;
var assertElementMatrixDefined = Assertions.assertElementMatrixDefined;
export class InterfaceInstanceCollector {
constructor() {
this.rcsbFvQuery = rcsbClient;
}
collect(requestConfig) {
return __awaiter(this, void 0, void 0, function* () {
try {
const result = yield this.rcsbFvQuery.requestInterfaceInstances(requestConfig);
return result.map(r => parseInterfaceInstances(r));
}
catch (error) {
console.log(error);
throw error;
}
});
}
}
function parseInterfaceInstances(coreInterface) {
var _a, _b, _c, _d;
assertElementMatrixDefined(coreInterface.rcsb_interface_operator[0]);
assertElementMatrixDefined(coreInterface.rcsb_interface_operator[1]);
assertElementListDefined(coreInterface.rcsb_interface_partner);
assertDefined((_a = coreInterface.rcsb_interface_partner[0].interface_partner_identifier) === null || _a === void 0 ? void 0 : _a.asym_id);
assertDefined((_b = coreInterface.rcsb_interface_partner[1].interface_partner_identifier) === null || _b === void 0 ? void 0 : _b.asym_id);
return {
rcsbId: coreInterface.rcsb_interface_container_identifiers.rcsb_id,
assemblyId: coreInterface.rcsb_interface_container_identifiers.assembly_id,
interfaceId: coreInterface.rcsb_interface_container_identifiers.interface_id,
asymIds: [
(_c = coreInterface.rcsb_interface_partner[0].interface_partner_identifier) === null || _c === void 0 ? void 0 : _c.asym_id,
(_d = coreInterface.rcsb_interface_partner[1].interface_partner_identifier) === null || _d === void 0 ? void 0 : _d.asym_id
],
operatorIds: [coreInterface.rcsb_interface_operator[0], coreInterface.rcsb_interface_operator[1]]
};
}
//# sourceMappingURL=InterfaceInstanceCollector.js.map