@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
48 lines • 2.46 kB
JavaScript
import { AnnotationReference } from "@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Types/Borrego/GqlTypes";
import { cloneDeep } from "lodash";
import { FeatureType } from "../../RcsbExport/FeatureType";
export function buriedResidues(annotations) {
var _a, _b;
const accThr = 6;
let buriedResidues = {};
let nBuried = 0;
mainloop: for (const ann of annotations) {
if (ann.source === 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.Asa) {
buriedResidues = cloneDeep(ann);
buriedResidues.source = AnnotationReference.PdbInstance;
const feature = cloneDeep(f);
feature.type = 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] : [];
}
export function buriedResiduesFilter(annotations) {
return 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.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); });
}
//# sourceMappingURL=BuriedResidues.js.map