UNPKG

@rcsb/rcsb-saguaro-app

Version:
74 lines (73 loc) 4.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RcsbFvUniprot = void 0; const tslib_1 = require("tslib"); const GqlTypes_1 = require("@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Types/Borrego/GqlTypes"); const RcsbFvAbstractModule_1 = require("./RcsbFvAbstractModule"); const RcsbClient_1 = require("../../RcsbGraphQL/RcsbClient"); const MsaAlignmentTrackFactory_1 = require("../RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/MsaAlignmentTrackFactory"); const Assertions_1 = require("../../RcsbUtils/Helpers/Assertions"); var assertDefined = Assertions_1.Assertions.assertDefined; class RcsbFvUniprot extends RcsbFvAbstractModule_1.RcsbFvAbstractModule { protectedBuild() { return tslib_1.__awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d; const buildConfig = this.buildConfig; const upAcc = buildConfig.upAcc; assertDefined(upAcc); const source = [GqlTypes_1.AnnotationReference.Uniprot]; const alignmentRequestContext = { queryId: upAcc, from: GqlTypes_1.SequenceReference.Uniprot, to: GqlTypes_1.SequenceReference.PdbEntity, dynamicDisplay: false, fitTitleWidth: true, excludeFirstRowLink: true, externalTrackBuilder: (_a = buildConfig.additionalConfig) === null || _a === void 0 ? void 0 : _a.externalTrackBuilder }; const alignmentResponse = yield this.alignmentCollector.collect(alignmentRequestContext, (_b = buildConfig.additionalConfig) === null || _b === void 0 ? void 0 : _b.alignmentFilter); const trackFactory = new MsaAlignmentTrackFactory_1.MsaAlignmentTrackFactory(this.getPolymerEntityInstanceTranslator()); const alignmentFeatures = yield collectFeatures(upAcc); yield trackFactory.prepareFeatures(alignmentFeatures.map(af => { var _a; return (Object.assign(Object.assign({}, af), { feature: (_a = af.features) === null || _a === void 0 ? void 0 : _a.filter(f => (f === null || f === void 0 ? void 0 : f.type) == GqlTypes_1.FeaturesType.UnobservedResidueXyz) })); }), alignmentFeatures.map(af => { var _a; return (Object.assign(Object.assign({}, af), { feature: (_a = af.features) === null || _a === void 0 ? void 0 : _a.filter(f => (f === null || f === void 0 ? void 0 : f.type) == GqlTypes_1.FeaturesType.MaQaMetricLocalTypePlddt) })); })); yield this.buildAlignmentTracks(alignmentRequestContext, alignmentResponse, { alignmentTrackFactory: trackFactory }); const annotationsRequestContext = { queryId: upAcc, reference: GqlTypes_1.SequenceReference.Uniprot, sources: source, annotationProcessing: (_c = buildConfig.additionalConfig) === null || _c === void 0 ? void 0 : _c.annotationProcessing, externalTrackBuilder: (_d = buildConfig.additionalConfig) === null || _d === void 0 ? void 0 : _d.externalTrackBuilder }; const annotationsFeatures = yield this.annotationCollector.collect(annotationsRequestContext); yield this.buildAnnotationsTrack(annotationsRequestContext, annotationsFeatures); this.boardConfigData.length = yield this.alignmentCollector.getAlignmentLength(); this.boardConfigData.includeAxis = true; return void 0; }); } concatAlignmentAndAnnotationTracks() { var _a; const buildConfig = this.buildConfig; this.rowConfigData = !((_a = buildConfig.additionalConfig) === null || _a === void 0 ? void 0 : _a.hideAlignments) ? [this.referenceTrack].concat(this.annotationTracks).concat(this.alignmentTracks) : [this.referenceTrack].concat(this.annotationTracks); } } exports.RcsbFvUniprot = RcsbFvUniprot; function collectFeatures(upAcc) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return yield RcsbClient_1.rcsbClient.requestRcsbPdbAnnotations({ queryId: upAcc, reference: GqlTypes_1.SequenceReference.Uniprot, sources: [GqlTypes_1.AnnotationReference.PdbInstance], filters: [{ source: GqlTypes_1.AnnotationReference.PdbInstance, operation: GqlTypes_1.OperationType.Equals, field: GqlTypes_1.FieldName.Type, values: [GqlTypes_1.FeaturesType.UnobservedResidueXyz, GqlTypes_1.FeaturesType.MaQaMetricLocalTypePlddt] }] }); }); }