@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
40 lines • 1.83 kB
JavaScript
import { __awaiter } from "tslib";
import { SequenceReference } from "@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Types/Borrego/GqlTypes";
import { rcsbClient } from "../../RcsbGraphQL/RcsbClient";
export class PolymerEntityChromosomeCollector {
constructor() {
this.rcsbFvQuery = rcsbClient;
}
collect(entityIds) {
return __awaiter(this, void 0, void 0, function* () {
const entityMap = new Map();
const result = yield Promise.all(entityIds.map(e => {
return this.entityChromosomes(e);
}));
result.forEach((alignment, n) => {
var _a;
(_a = alignment.target_alignments) === null || _a === void 0 ? void 0 : _a.forEach(ta => {
var _a, _b, _c;
if (((_b = (_a = ta === null || ta === void 0 ? void 0 : ta.aligned_regions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
if (!entityMap.has(entityIds[n]))
entityMap.set(entityIds[n], new Array());
if (ta === null || ta === void 0 ? void 0 : ta.target_id)
(_c = entityMap.get(entityIds[n])) === null || _c === void 0 ? void 0 : _c.push(ta.target_id);
}
});
});
return entityMap;
});
}
entityChromosomes(entityId) {
return __awaiter(this, void 0, void 0, function* () {
const request = {
from: SequenceReference.PdbEntity,
to: SequenceReference.NcbiGenome,
queryId: entityId
};
return yield this.rcsbFvQuery.requestAlignment(request);
});
}
}
//# sourceMappingURL=PolymerEntityChromosomeCollector.js.map