@rcsb/rcsb-saguaro-app 6.0.13 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,6 +88,7 @@
88
88
  ],
89
89
  "instance_order": [
90
90
  "MA_QA_METRIC_LOCAL_TYPE_PLDDT",
91
+ "UNMODELED",
91
92
  "SECONDARY_STRUCTURE",
92
93
  "UNOBSERVED",
93
94
  "ZERO_OCCUPANCY_RESIDUE_XYZ",
@@ -122,6 +123,14 @@
122
123
  "DISORDER_BINDING"
123
124
  ],
124
125
  "config": [{
126
+ "type": "UNMODELED",
127
+ "display": "block-area",
128
+ "color": {
129
+ "colors": ["#BBB", "#999"],
130
+ "thresholds": [0.999]
131
+ },
132
+ "title": "UNMODELED"
133
+ }, {
125
134
  "type": "TRANSIT_PEPTIDE",
126
135
  "color": "#189f3e",
127
136
  "display": "block",
@@ -1,4 +1,8 @@
1
1
  import { buildEntitySummaryFv } from "../RcsbFvWeb/RcsbFvBuilder";
2
- buildEntitySummaryFv("pfv", "select", "AF_AFQ8WZ42F1_1").then((module) => {
3
- console.log(module);
2
+ import { getJsonFromUrl, onLoad } from "./utils/events";
3
+ onLoad(() => {
4
+ const args = getJsonFromUrl().entityId ? getJsonFromUrl() : { entityId: "3HBX_1" };
5
+ buildEntitySummaryFv("pfv", "select", args.entityId).then((module) => {
6
+ console.log(module);
7
+ });
4
8
  });
@@ -0,0 +1,2 @@
1
+ export declare function getJsonFromUrl(): any;
2
+ export declare function onLoad(f: () => void): void;
@@ -0,0 +1,15 @@
1
+ export function getJsonFromUrl() {
2
+ const url = location.search;
3
+ var query = url.substring(1);
4
+ var result = {};
5
+ query.split("&").forEach(function (part) {
6
+ var item = part.split("=");
7
+ result[item[0]] = decodeURIComponent(item[1]);
8
+ });
9
+ return result;
10
+ }
11
+ export function onLoad(f) {
12
+ document.addEventListener("DOMContentLoaded", function (event) {
13
+ f();
14
+ });
15
+ }
@@ -1,6 +1,9 @@
1
1
  import { RcsbFvAbstractModule } from "./RcsbFvAbstractModule";
2
+ import { RcsbFvBoardConfigInterface } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFvConfig/RcsbFvConfigInterface";
2
3
  export declare class RcsbFvEntity extends RcsbFvAbstractModule {
4
+ private readonly unmodeledTrackBuilder;
3
5
  protected protectedBuild(): Promise<void>;
6
+ protected getBoardConfig(): Promise<RcsbFvBoardConfigInterface>;
4
7
  protected concatAlignmentAndAnnotationTracks(): void;
5
8
  private titleSuffix;
6
9
  }
@@ -4,7 +4,12 @@ import { RcsbFvAbstractModule } from "./RcsbFvAbstractModule";
4
4
  import { Assertions } from "../../RcsbUtils/Helpers/Assertions";
5
5
  var assertDefined = Assertions.assertDefined;
6
6
  import { TagDelimiter } from "@rcsb/rcsb-api-tools/build/RcsbUtils/TagDelimiter";
7
+ import { addUnmodeledTrackBuilder, UnmodeledTrackBuilder } from "../../RcsbUtils/TrackGenerators/UnmodeledTrackBuilder";
7
8
  export class RcsbFvEntity extends RcsbFvAbstractModule {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.unmodeledTrackBuilder = new UnmodeledTrackBuilder();
12
+ }
8
13
  protectedBuild() {
9
14
  var _a, _b, _c, _d, _e, _f, _g;
10
15
  return __awaiter(this, void 0, void 0, function* () {
@@ -25,7 +30,10 @@ export class RcsbFvEntity extends RcsbFvAbstractModule {
25
30
  titleSuffix: this.titleSuffix.bind(this),
26
31
  filters: (_e = buildConfig.additionalConfig) === null || _e === void 0 ? void 0 : _e.filters,
27
32
  annotationProcessing: (_f = buildConfig.additionalConfig) === null || _f === void 0 ? void 0 : _f.annotationProcessing,
28
- externalTrackBuilder: (_g = buildConfig.additionalConfig) === null || _g === void 0 ? void 0 : _g.externalTrackBuilder
33
+ rcsbContext: {
34
+ entityId: buildConfig.entityId
35
+ },
36
+ externalTrackBuilder: addUnmodeledTrackBuilder(this.unmodeledTrackBuilder, (_g = buildConfig.additionalConfig) === null || _g === void 0 ? void 0 : _g.externalTrackBuilder)
29
37
  };
30
38
  const annotationsFeatures = yield this.annotationCollector.collect(annotationsRequestContext);
31
39
  yield this.buildAnnotationsTrack(annotationsRequestContext, annotationsFeatures);
@@ -34,6 +42,11 @@ export class RcsbFvEntity extends RcsbFvAbstractModule {
34
42
  return void 0;
35
43
  });
36
44
  }
45
+ getBoardConfig() {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ return Object.assign(Object.assign({}, this.boardConfigData), { tooltipGenerator: this.unmodeledTrackBuilder.getTooltip() });
48
+ });
49
+ }
37
50
  concatAlignmentAndAnnotationTracks() {
38
51
  var _a;
39
52
  const buildConfig = this.buildConfig;
@@ -1,6 +1,9 @@
1
1
  import { RcsbFvAbstractModule } from "./RcsbFvAbstractModule";
2
+ import { RcsbFvBoardConfigInterface } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFvConfig/RcsbFvConfigInterface";
2
3
  export declare class RcsbFvUniprotEntity extends RcsbFvAbstractModule {
4
+ private readonly unmodeledTrackBuilder;
3
5
  protected protectedBuild(): Promise<void>;
6
+ protected getBoardConfig(): Promise<RcsbFvBoardConfigInterface>;
4
7
  protected concatAlignmentAndAnnotationTracks(): void;
5
8
  private titleSuffix;
6
9
  }
@@ -4,7 +4,12 @@ import { RcsbFvAbstractModule } from "./RcsbFvAbstractModule";
4
4
  import { Assertions } from "../../RcsbUtils/Helpers/Assertions";
5
5
  var assertDefined = Assertions.assertDefined;
6
6
  import { TagDelimiter } from "@rcsb/rcsb-api-tools/build/RcsbUtils/TagDelimiter";
7
+ import { addUnmodeledTrackBuilder, UnmodeledTrackBuilder } from "../../RcsbUtils/TrackGenerators/UnmodeledTrackBuilder";
7
8
  export class RcsbFvUniprotEntity extends RcsbFvAbstractModule {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.unmodeledTrackBuilder = new UnmodeledTrackBuilder();
12
+ }
8
13
  protectedBuild() {
9
14
  var _a, _b, _c;
10
15
  return __awaiter(this, void 0, void 0, function* () {
@@ -36,7 +41,10 @@ export class RcsbFvUniprotEntity extends RcsbFvAbstractModule {
36
41
  filters: (additionalConfig === null || additionalConfig === void 0 ? void 0 : additionalConfig.filters) instanceof Array ? additionalConfig.filters.concat(filters) : filters,
37
42
  titleSuffix: this.titleSuffix.bind(this),
38
43
  annotationProcessing: (_b = buildConfig.additionalConfig) === null || _b === void 0 ? void 0 : _b.annotationProcessing,
39
- externalTrackBuilder: (_c = buildConfig.additionalConfig) === null || _c === void 0 ? void 0 : _c.externalTrackBuilder
44
+ rcsbContext: {
45
+ entityId: buildConfig.entityId
46
+ },
47
+ externalTrackBuilder: addUnmodeledTrackBuilder(this.unmodeledTrackBuilder, (_c = buildConfig.additionalConfig) === null || _c === void 0 ? void 0 : _c.externalTrackBuilder)
40
48
  };
41
49
  const annotationsFeatures = yield this.annotationCollector.collect(annotationsRequestContext);
42
50
  yield this.buildAnnotationsTrack(annotationsRequestContext, annotationsFeatures);
@@ -45,6 +53,11 @@ export class RcsbFvUniprotEntity extends RcsbFvAbstractModule {
45
53
  return void 0;
46
54
  });
47
55
  }
56
+ getBoardConfig() {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ return Object.assign(Object.assign({}, this.boardConfigData), { tooltipGenerator: this.unmodeledTrackBuilder.getTooltip() });
59
+ });
60
+ }
48
61
  concatAlignmentAndAnnotationTracks() {
49
62
  this.rowConfigData = [this.referenceTrack].concat(this.alignmentTracks).concat(this.annotationTracks);
50
63
  }
@@ -0,0 +1,14 @@
1
+ import { AnnotationFeatures } from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Borrego/GqlTypes";
2
+ import { PolymerEntityInstanceInterface } from "../../RcsbCollectTools/DataCollectors/PolymerEntityInstancesCollector";
3
+ import { RcsbFvTooltipInterface } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFvTooltip/RcsbFvTooltipInterface";
4
+ import { ExternalTrackBuilderInterface } from "../../RcsbCollectTools/FeatureTools/ExternalTrackBuilderInterface";
5
+ export declare function addUnmodeledTrackBuilder(unmodeledTrackBuilder: UnmodeledTrackBuilder, externalTrackBuilder?: ExternalTrackBuilderInterface): ExternalTrackBuilderInterface;
6
+ export declare class UnmodeledTrackBuilder {
7
+ private readonly unmodeledDescription;
8
+ filterFeatures(data: {
9
+ annotations: Array<AnnotationFeatures>;
10
+ rcsbContext?: Partial<PolymerEntityInstanceInterface>;
11
+ }): Promise<Array<AnnotationFeatures>>;
12
+ getTooltip(): RcsbFvTooltipInterface;
13
+ private buildUnobserved;
14
+ }
@@ -0,0 +1,100 @@
1
+ import { __awaiter } from "tslib";
2
+ import { Source, Type } from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Borrego/GqlTypes";
3
+ import { range } from "lodash";
4
+ import { rcsbRequestCtxManager } from "../../RcsbRequest/RcsbRequestContextManager";
5
+ import { RcsbFvTooltip } from "../../RcsbFvWeb/RcsbFvTooltip/RcsbFvTooltip";
6
+ export function addUnmodeledTrackBuilder(unmodeledTrackBuilder, externalTrackBuilder) {
7
+ const trackBuilder = (data) => __awaiter(this, void 0, void 0, function* () {
8
+ var _a, _b;
9
+ return [
10
+ ...(_b = yield ((_a = externalTrackBuilder === null || externalTrackBuilder === void 0 ? void 0 : externalTrackBuilder.filterFeatures) === null || _a === void 0 ? void 0 : _a.call(externalTrackBuilder, data))) !== null && _b !== void 0 ? _b : [],
11
+ ...yield unmodeledTrackBuilder.filterFeatures(data)
12
+ ];
13
+ });
14
+ return Object.assign(Object.assign({}, externalTrackBuilder), { filterFeatures: (data) => __awaiter(this, void 0, void 0, function* () {
15
+ var _c, _d, _e;
16
+ (_c = externalTrackBuilder === null || externalTrackBuilder === void 0 ? void 0 : externalTrackBuilder.filterFeatures) === null || _c === void 0 ? void 0 : _c.call(externalTrackBuilder, data);
17
+ return trackBuilder({
18
+ annotations: (_e = yield ((_d = externalTrackBuilder === null || externalTrackBuilder === void 0 ? void 0 : externalTrackBuilder.filterFeatures) === null || _d === void 0 ? void 0 : _d.call(externalTrackBuilder, data))) !== null && _e !== void 0 ? _e : data.annotations,
19
+ rcsbContext: data.rcsbContext
20
+ });
21
+ }) });
22
+ }
23
+ export class UnmodeledTrackBuilder {
24
+ constructor() {
25
+ this.unmodeledDescription = new Map();
26
+ }
27
+ filterFeatures(data) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ if (!data.rcsbContext)
30
+ return data.annotations;
31
+ return [
32
+ ...yield this.buildUnobserved(data.annotations, data.rcsbContext),
33
+ ...filterUnobserved(data.annotations)
34
+ ];
35
+ });
36
+ }
37
+ getTooltip() {
38
+ return new UnobservedToolTip(this.unmodeledDescription);
39
+ }
40
+ buildUnobserved(annotations, rcsbContext) {
41
+ var _a;
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const nInstances = (yield rcsbRequestCtxManager.getEntityProperties((_a = rcsbContext.entityId) !== null && _a !== void 0 ? _a : "none"))[0].instances.length;
44
+ const featurePositions = Array.from(annotations.filter(ann => {
45
+ var _a, _b, _c;
46
+ return (_c = (_b = (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter(f => (f === null || f === void 0 ? void 0 : f.type) == Type.UnobservedResidueXyz)) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0 > 0;
47
+ }).map(ann => {
48
+ var _a, _b;
49
+ return (_b = (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter((f) => (f === null || f === void 0 ? void 0 : f.type) == Type.UnobservedResidueXyz)) !== null && _b !== void 0 ? _b : [];
50
+ }).flat().map(feature => {
51
+ var _a, _b;
52
+ return (_b = (_a = feature.feature_positions) === null || _a === void 0 ? void 0 : _a.filter((p) => typeof p != "undefined")) !== null && _b !== void 0 ? _b : [];
53
+ }).flat().map(p => p.beg_seq_id && p.end_seq_id ? range(p.beg_seq_id, p.end_seq_id + 1) : []).flat().reduce((map, idx) => { var _a; return map.set(idx, ((_a = map.get(idx)) !== null && _a !== void 0 ? _a : 0) + 1); }, new Map).entries()).map(([idx, unobserved]) => {
54
+ this.unmodeledDescription.set(`${rcsbContext.entityId}:${idx}`, [unobserved, nInstances]);
55
+ return {
56
+ beg_seq_id: idx,
57
+ values: [Math.round(unobserved / nInstances * 100) / 100]
58
+ };
59
+ });
60
+ return [{
61
+ source: Source.PdbEntity,
62
+ target_id: rcsbContext.entityId,
63
+ features: [{
64
+ type: UNMODELED,
65
+ feature_positions: featurePositions
66
+ }]
67
+ }];
68
+ });
69
+ }
70
+ }
71
+ class UnobservedToolTip {
72
+ constructor(trackDescription) {
73
+ this.regularTooltip = new RcsbFvTooltip();
74
+ this.trackDescription = trackDescription;
75
+ }
76
+ showTooltip(d) {
77
+ return this.regularTooltip.showTooltip(d);
78
+ }
79
+ showTooltipDescription(d) {
80
+ if (d.title == UNMODELED)
81
+ return this.overloadTooltipDescription(d);
82
+ return this.regularTooltip.showTooltipDescription(d);
83
+ }
84
+ overloadTooltipDescription(d) {
85
+ var _a;
86
+ if (!this.trackDescription.has(`${d.sourceId}:${d.begin}`))
87
+ return undefined;
88
+ const tooltipDescriptionDiv = document.createElement("div");
89
+ const [unobserved, total] = (_a = this.trackDescription.get(`${d.sourceId}:${d.begin}`)) !== null && _a !== void 0 ? _a : [0, 0];
90
+ tooltipDescriptionDiv.append(`Unmodeled in ${unobserved} of ${total} chains`);
91
+ return tooltipDescriptionDiv;
92
+ }
93
+ }
94
+ function filterUnobserved(annotations) {
95
+ return annotations.map(ann => {
96
+ var _a;
97
+ return Object.assign(Object.assign({}, ann), { features: (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter(f => (f === null || f === void 0 ? void 0 : f.type) != Type.UnobservedResidueXyz && (f === null || f === void 0 ? void 0 : f.type) != Type.UnobservedAtomXyz) });
98
+ });
99
+ }
100
+ const UNMODELED = "UNMODELED";
@@ -88,6 +88,7 @@
88
88
  ],
89
89
  "instance_order": [
90
90
  "MA_QA_METRIC_LOCAL_TYPE_PLDDT",
91
+ "UNMODELED",
91
92
  "SECONDARY_STRUCTURE",
92
93
  "UNOBSERVED",
93
94
  "ZERO_OCCUPANCY_RESIDUE_XYZ",
@@ -122,6 +123,14 @@
122
123
  "DISORDER_BINDING"
123
124
  ],
124
125
  "config": [{
126
+ "type": "UNMODELED",
127
+ "display": "block-area",
128
+ "color": {
129
+ "colors": ["#BBB", "#999"],
130
+ "thresholds": [0.999]
131
+ },
132
+ "title": "UNMODELED"
133
+ }, {
125
134
  "type": "TRANSIT_PEPTIDE",
126
135
  "color": "#189f3e",
127
136
  "display": "block",
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const RcsbFvBuilder_1 = require("../RcsbFvWeb/RcsbFvBuilder");
4
- (0, RcsbFvBuilder_1.buildEntitySummaryFv)("pfv", "select", "AF_AFQ8WZ42F1_1").then((module) => {
5
- console.log(module);
4
+ const events_1 = require("./utils/events");
5
+ (0, events_1.onLoad)(() => {
6
+ const args = (0, events_1.getJsonFromUrl)().entityId ? (0, events_1.getJsonFromUrl)() : { entityId: "3HBX_1" };
7
+ (0, RcsbFvBuilder_1.buildEntitySummaryFv)("pfv", "select", args.entityId).then((module) => {
8
+ console.log(module);
9
+ });
6
10
  });
@@ -0,0 +1,2 @@
1
+ export declare function getJsonFromUrl(): any;
2
+ export declare function onLoad(f: () => void): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.onLoad = exports.getJsonFromUrl = void 0;
4
+ function getJsonFromUrl() {
5
+ const url = location.search;
6
+ var query = url.substring(1);
7
+ var result = {};
8
+ query.split("&").forEach(function (part) {
9
+ var item = part.split("=");
10
+ result[item[0]] = decodeURIComponent(item[1]);
11
+ });
12
+ return result;
13
+ }
14
+ exports.getJsonFromUrl = getJsonFromUrl;
15
+ function onLoad(f) {
16
+ document.addEventListener("DOMContentLoaded", function (event) {
17
+ f();
18
+ });
19
+ }
20
+ exports.onLoad = onLoad;
@@ -1,6 +1,9 @@
1
1
  import { RcsbFvAbstractModule } from "./RcsbFvAbstractModule";
2
+ import { RcsbFvBoardConfigInterface } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFvConfig/RcsbFvConfigInterface";
2
3
  export declare class RcsbFvEntity extends RcsbFvAbstractModule {
4
+ private readonly unmodeledTrackBuilder;
3
5
  protected protectedBuild(): Promise<void>;
6
+ protected getBoardConfig(): Promise<RcsbFvBoardConfigInterface>;
4
7
  protected concatAlignmentAndAnnotationTracks(): void;
5
8
  private titleSuffix;
6
9
  }
@@ -7,7 +7,12 @@ const RcsbFvAbstractModule_1 = require("./RcsbFvAbstractModule");
7
7
  const Assertions_1 = require("../../RcsbUtils/Helpers/Assertions");
8
8
  var assertDefined = Assertions_1.Assertions.assertDefined;
9
9
  const TagDelimiter_1 = require("@rcsb/rcsb-api-tools/build/RcsbUtils/TagDelimiter");
10
+ const UnmodeledTrackBuilder_1 = require("../../RcsbUtils/TrackGenerators/UnmodeledTrackBuilder");
10
11
  class RcsbFvEntity extends RcsbFvAbstractModule_1.RcsbFvAbstractModule {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.unmodeledTrackBuilder = new UnmodeledTrackBuilder_1.UnmodeledTrackBuilder();
15
+ }
11
16
  protectedBuild() {
12
17
  var _a, _b, _c, _d, _e, _f, _g;
13
18
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -28,7 +33,10 @@ class RcsbFvEntity extends RcsbFvAbstractModule_1.RcsbFvAbstractModule {
28
33
  titleSuffix: this.titleSuffix.bind(this),
29
34
  filters: (_e = buildConfig.additionalConfig) === null || _e === void 0 ? void 0 : _e.filters,
30
35
  annotationProcessing: (_f = buildConfig.additionalConfig) === null || _f === void 0 ? void 0 : _f.annotationProcessing,
31
- externalTrackBuilder: (_g = buildConfig.additionalConfig) === null || _g === void 0 ? void 0 : _g.externalTrackBuilder
36
+ rcsbContext: {
37
+ entityId: buildConfig.entityId
38
+ },
39
+ externalTrackBuilder: (0, UnmodeledTrackBuilder_1.addUnmodeledTrackBuilder)(this.unmodeledTrackBuilder, (_g = buildConfig.additionalConfig) === null || _g === void 0 ? void 0 : _g.externalTrackBuilder)
32
40
  };
33
41
  const annotationsFeatures = yield this.annotationCollector.collect(annotationsRequestContext);
34
42
  yield this.buildAnnotationsTrack(annotationsRequestContext, annotationsFeatures);
@@ -37,6 +45,11 @@ class RcsbFvEntity extends RcsbFvAbstractModule_1.RcsbFvAbstractModule {
37
45
  return void 0;
38
46
  });
39
47
  }
48
+ getBoardConfig() {
49
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+ return Object.assign(Object.assign({}, this.boardConfigData), { tooltipGenerator: this.unmodeledTrackBuilder.getTooltip() });
51
+ });
52
+ }
40
53
  concatAlignmentAndAnnotationTracks() {
41
54
  var _a;
42
55
  const buildConfig = this.buildConfig;
@@ -1,6 +1,9 @@
1
1
  import { RcsbFvAbstractModule } from "./RcsbFvAbstractModule";
2
+ import { RcsbFvBoardConfigInterface } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFvConfig/RcsbFvConfigInterface";
2
3
  export declare class RcsbFvUniprotEntity extends RcsbFvAbstractModule {
4
+ private readonly unmodeledTrackBuilder;
3
5
  protected protectedBuild(): Promise<void>;
6
+ protected getBoardConfig(): Promise<RcsbFvBoardConfigInterface>;
4
7
  protected concatAlignmentAndAnnotationTracks(): void;
5
8
  private titleSuffix;
6
9
  }
@@ -7,7 +7,12 @@ const RcsbFvAbstractModule_1 = require("./RcsbFvAbstractModule");
7
7
  const Assertions_1 = require("../../RcsbUtils/Helpers/Assertions");
8
8
  var assertDefined = Assertions_1.Assertions.assertDefined;
9
9
  const TagDelimiter_1 = require("@rcsb/rcsb-api-tools/build/RcsbUtils/TagDelimiter");
10
+ const UnmodeledTrackBuilder_1 = require("../../RcsbUtils/TrackGenerators/UnmodeledTrackBuilder");
10
11
  class RcsbFvUniprotEntity extends RcsbFvAbstractModule_1.RcsbFvAbstractModule {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.unmodeledTrackBuilder = new UnmodeledTrackBuilder_1.UnmodeledTrackBuilder();
15
+ }
11
16
  protectedBuild() {
12
17
  var _a, _b, _c;
13
18
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -39,7 +44,10 @@ class RcsbFvUniprotEntity extends RcsbFvAbstractModule_1.RcsbFvAbstractModule {
39
44
  filters: (additionalConfig === null || additionalConfig === void 0 ? void 0 : additionalConfig.filters) instanceof Array ? additionalConfig.filters.concat(filters) : filters,
40
45
  titleSuffix: this.titleSuffix.bind(this),
41
46
  annotationProcessing: (_b = buildConfig.additionalConfig) === null || _b === void 0 ? void 0 : _b.annotationProcessing,
42
- externalTrackBuilder: (_c = buildConfig.additionalConfig) === null || _c === void 0 ? void 0 : _c.externalTrackBuilder
47
+ rcsbContext: {
48
+ entityId: buildConfig.entityId
49
+ },
50
+ externalTrackBuilder: (0, UnmodeledTrackBuilder_1.addUnmodeledTrackBuilder)(this.unmodeledTrackBuilder, (_c = buildConfig.additionalConfig) === null || _c === void 0 ? void 0 : _c.externalTrackBuilder)
43
51
  };
44
52
  const annotationsFeatures = yield this.annotationCollector.collect(annotationsRequestContext);
45
53
  yield this.buildAnnotationsTrack(annotationsRequestContext, annotationsFeatures);
@@ -48,6 +56,11 @@ class RcsbFvUniprotEntity extends RcsbFvAbstractModule_1.RcsbFvAbstractModule {
48
56
  return void 0;
49
57
  });
50
58
  }
59
+ getBoardConfig() {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ return Object.assign(Object.assign({}, this.boardConfigData), { tooltipGenerator: this.unmodeledTrackBuilder.getTooltip() });
62
+ });
63
+ }
51
64
  concatAlignmentAndAnnotationTracks() {
52
65
  this.rowConfigData = [this.referenceTrack].concat(this.alignmentTracks).concat(this.annotationTracks);
53
66
  }
@@ -0,0 +1,14 @@
1
+ import { AnnotationFeatures } from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Borrego/GqlTypes";
2
+ import { PolymerEntityInstanceInterface } from "../../RcsbCollectTools/DataCollectors/PolymerEntityInstancesCollector";
3
+ import { RcsbFvTooltipInterface } from "@rcsb/rcsb-saguaro/lib/RcsbFv/RcsbFvTooltip/RcsbFvTooltipInterface";
4
+ import { ExternalTrackBuilderInterface } from "../../RcsbCollectTools/FeatureTools/ExternalTrackBuilderInterface";
5
+ export declare function addUnmodeledTrackBuilder(unmodeledTrackBuilder: UnmodeledTrackBuilder, externalTrackBuilder?: ExternalTrackBuilderInterface): ExternalTrackBuilderInterface;
6
+ export declare class UnmodeledTrackBuilder {
7
+ private readonly unmodeledDescription;
8
+ filterFeatures(data: {
9
+ annotations: Array<AnnotationFeatures>;
10
+ rcsbContext?: Partial<PolymerEntityInstanceInterface>;
11
+ }): Promise<Array<AnnotationFeatures>>;
12
+ getTooltip(): RcsbFvTooltipInterface;
13
+ private buildUnobserved;
14
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnmodeledTrackBuilder = exports.addUnmodeledTrackBuilder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const GqlTypes_1 = require("@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Borrego/GqlTypes");
6
+ const lodash_1 = require("lodash");
7
+ const RcsbRequestContextManager_1 = require("../../RcsbRequest/RcsbRequestContextManager");
8
+ const RcsbFvTooltip_1 = require("../../RcsbFvWeb/RcsbFvTooltip/RcsbFvTooltip");
9
+ function addUnmodeledTrackBuilder(unmodeledTrackBuilder, externalTrackBuilder) {
10
+ const trackBuilder = (data) => tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ var _a, _b;
12
+ return [
13
+ ...(_b = yield ((_a = externalTrackBuilder === null || externalTrackBuilder === void 0 ? void 0 : externalTrackBuilder.filterFeatures) === null || _a === void 0 ? void 0 : _a.call(externalTrackBuilder, data))) !== null && _b !== void 0 ? _b : [],
14
+ ...yield unmodeledTrackBuilder.filterFeatures(data)
15
+ ];
16
+ });
17
+ return Object.assign(Object.assign({}, externalTrackBuilder), { filterFeatures: (data) => tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ var _c, _d, _e;
19
+ (_c = externalTrackBuilder === null || externalTrackBuilder === void 0 ? void 0 : externalTrackBuilder.filterFeatures) === null || _c === void 0 ? void 0 : _c.call(externalTrackBuilder, data);
20
+ return trackBuilder({
21
+ annotations: (_e = yield ((_d = externalTrackBuilder === null || externalTrackBuilder === void 0 ? void 0 : externalTrackBuilder.filterFeatures) === null || _d === void 0 ? void 0 : _d.call(externalTrackBuilder, data))) !== null && _e !== void 0 ? _e : data.annotations,
22
+ rcsbContext: data.rcsbContext
23
+ });
24
+ }) });
25
+ }
26
+ exports.addUnmodeledTrackBuilder = addUnmodeledTrackBuilder;
27
+ class UnmodeledTrackBuilder {
28
+ constructor() {
29
+ this.unmodeledDescription = new Map();
30
+ }
31
+ filterFeatures(data) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ if (!data.rcsbContext)
34
+ return data.annotations;
35
+ return [
36
+ ...yield this.buildUnobserved(data.annotations, data.rcsbContext),
37
+ ...filterUnobserved(data.annotations)
38
+ ];
39
+ });
40
+ }
41
+ getTooltip() {
42
+ return new UnobservedToolTip(this.unmodeledDescription);
43
+ }
44
+ buildUnobserved(annotations, rcsbContext) {
45
+ var _a;
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ const nInstances = (yield RcsbRequestContextManager_1.rcsbRequestCtxManager.getEntityProperties((_a = rcsbContext.entityId) !== null && _a !== void 0 ? _a : "none"))[0].instances.length;
48
+ const featurePositions = Array.from(annotations.filter(ann => {
49
+ var _a, _b, _c;
50
+ return (_c = (_b = (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter(f => (f === null || f === void 0 ? void 0 : f.type) == GqlTypes_1.Type.UnobservedResidueXyz)) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0 > 0;
51
+ }).map(ann => {
52
+ var _a, _b;
53
+ return (_b = (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter((f) => (f === null || f === void 0 ? void 0 : f.type) == GqlTypes_1.Type.UnobservedResidueXyz)) !== null && _b !== void 0 ? _b : [];
54
+ }).flat().map(feature => {
55
+ var _a, _b;
56
+ return (_b = (_a = feature.feature_positions) === null || _a === void 0 ? void 0 : _a.filter((p) => typeof p != "undefined")) !== null && _b !== void 0 ? _b : [];
57
+ }).flat().map(p => p.beg_seq_id && p.end_seq_id ? (0, lodash_1.range)(p.beg_seq_id, p.end_seq_id + 1) : []).flat().reduce((map, idx) => { var _a; return map.set(idx, ((_a = map.get(idx)) !== null && _a !== void 0 ? _a : 0) + 1); }, new Map).entries()).map(([idx, unobserved]) => {
58
+ this.unmodeledDescription.set(`${rcsbContext.entityId}:${idx}`, [unobserved, nInstances]);
59
+ return {
60
+ beg_seq_id: idx,
61
+ values: [Math.round(unobserved / nInstances * 100) / 100]
62
+ };
63
+ });
64
+ return [{
65
+ source: GqlTypes_1.Source.PdbEntity,
66
+ target_id: rcsbContext.entityId,
67
+ features: [{
68
+ type: UNMODELED,
69
+ feature_positions: featurePositions
70
+ }]
71
+ }];
72
+ });
73
+ }
74
+ }
75
+ exports.UnmodeledTrackBuilder = UnmodeledTrackBuilder;
76
+ class UnobservedToolTip {
77
+ constructor(trackDescription) {
78
+ this.regularTooltip = new RcsbFvTooltip_1.RcsbFvTooltip();
79
+ this.trackDescription = trackDescription;
80
+ }
81
+ showTooltip(d) {
82
+ return this.regularTooltip.showTooltip(d);
83
+ }
84
+ showTooltipDescription(d) {
85
+ if (d.title == UNMODELED)
86
+ return this.overloadTooltipDescription(d);
87
+ return this.regularTooltip.showTooltipDescription(d);
88
+ }
89
+ overloadTooltipDescription(d) {
90
+ var _a;
91
+ if (!this.trackDescription.has(`${d.sourceId}:${d.begin}`))
92
+ return undefined;
93
+ const tooltipDescriptionDiv = document.createElement("div");
94
+ const [unobserved, total] = (_a = this.trackDescription.get(`${d.sourceId}:${d.begin}`)) !== null && _a !== void 0 ? _a : [0, 0];
95
+ tooltipDescriptionDiv.append(`Unmodeled in ${unobserved} of ${total} chains`);
96
+ return tooltipDescriptionDiv;
97
+ }
98
+ }
99
+ function filterUnobserved(annotations) {
100
+ return annotations.map(ann => {
101
+ var _a;
102
+ return Object.assign(Object.assign({}, ann), { features: (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter(f => (f === null || f === void 0 ? void 0 : f.type) != GqlTypes_1.Type.UnobservedResidueXyz && (f === null || f === void 0 ? void 0 : f.type) != GqlTypes_1.Type.UnobservedAtomXyz) });
103
+ });
104
+ }
105
+ const UNMODELED = "UNMODELED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcsb/rcsb-saguaro-app",
3
- "version": "6.0.13",
3
+ "version": "6.1.0",
4
4
  "description": "RCSB 1D Saguaro Web App",
5
5
  "main": "build/app.js",
6
6
  "files": [
@@ -92,7 +92,7 @@
92
92
  "worker-loader": "^3.0.8"
93
93
  },
94
94
  "dependencies": {
95
- "@rcsb/rcsb-charts": "^0.2.22",
95
+ "@rcsb/rcsb-charts": "^0.2.23",
96
96
  "@rcsb/rcsb-saguaro": "^3.0.8",
97
97
  "@rcsb/rcsb-search-tools": "^0.0.8",
98
98
  "ideogram": "^1.45.1",