@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
52 lines (51 loc) • 2.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.buriedResidues = buriedResidues;
exports.buriedResiduesFilter = buriedResiduesFilter;
const GqlTypes_1 = require("@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Types/Borrego/GqlTypes");
const lodash_1 = require("lodash");
const FeatureType_1 = require("../../RcsbExport/FeatureType");
function buriedResidues(annotations) {
var _a, _b;
const accThr = 6;
let buriedResidues = {};
let nBuried = 0;
mainloop: for (const ann of annotations) {
if (ann.source === GqlTypes_1.AnnotationReference.PdbInstance) {
for (const f of (_a = ann.features) !== null && _a !== void 0 ? _a : []) {
if ((f === null || f === void 0 ? void 0 : f.type) === FeatureType_1.FeatureType.Asa) {
buriedResidues = (0, lodash_1.cloneDeep)(ann);
buriedResidues.source = GqlTypes_1.AnnotationReference.PdbInstance;
const feature = (0, lodash_1.cloneDeep)(f);
feature.type = FeatureType_1.FeatureType.BuriedResidues;
feature.name = "Unbound chain core residues";
feature.description = `Residue accessibility lower than ${accThr}Å`;
(_b = feature.feature_positions) === null || _b === void 0 ? void 0 : _b.forEach(p => {
var _a;
if (p)
p.values = (_a = p.values) === null || _a === void 0 ? void 0 : _a.map((v) => {
if (v) {
const acc = (v < accThr ? Math.floor(v * 100) / 100 : 0);
nBuried += acc;
return acc;
}
else {
return 0;
}
});
});
buriedResidues.features = [feature];
break mainloop;
}
}
}
}
return nBuried > 0 && buriedResidues ? [buriedResidues] : [];
}
function buriedResiduesFilter(annotations) {
return (0, lodash_1.cloneDeep)(annotations).map(ann => {
var _a;
ann.features = (_a = ann.features) === null || _a === void 0 ? void 0 : _a.filter(f => ((f === null || f === void 0 ? void 0 : f.type) !== FeatureType_1.FeatureType.Asa));
return ann;
}).filter(ann => { var _a, _b; return (((_b = (_a = ann.features) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0); });
}