Skip to content
Snippets Groups Projects
Commit 0b42379c authored by Michal Malý's avatar Michal Malý
Browse files

Do not draw a NtC tube segment unless we have all required atoms

parent 414c3499
No related branches found
No related tags found
No related merge requests found
...@@ -14,11 +14,12 @@ import { ChainIndex, ElementIndex, ResidueIndex, Structure, StructureElement, Un ...@@ -14,11 +14,12 @@ import { ChainIndex, ElementIndex, ResidueIndex, Structure, StructureElement, Un
function getAtomPosition(vec: Vec3, loc: StructureElement.Location, residue: DnatcoUtil.Residue, names: string[], altId: string, insCode: string) { function getAtomPosition(vec: Vec3, loc: StructureElement.Location, residue: DnatcoUtil.Residue, names: string[], altId: string, insCode: string) {
const eI = DnatcoUtil.getAtomIndex(loc, residue, names, altId, insCode); const eI = DnatcoUtil.getAtomIndex(loc, residue, names, altId, insCode);
if (eI !== -1) if (eI !== -1) {
loc.unit.conformation.invariantPosition(eI, vec); loc.unit.conformation.invariantPosition(eI, vec);
else { return true;
vec[0] = 0; vec[1] = 0; vec[2] = 0;
} }
return false; // Atom not found
} }
const p_1 = Vec3(); const p_1 = Vec3();
...@@ -29,19 +30,38 @@ const p3 = Vec3(); ...@@ -29,19 +30,38 @@ const p3 = Vec3();
const p4 = Vec3(); const p4 = Vec3();
const pP = Vec3(); const pP = Vec3();
const C5PrimeNames = ['C5\'', 'C5*'];
const O3PrimeNames = ['O3\'', 'O3*'];
const O5PrimeNames = ['O5\'', 'O5*'];
const PNames = ['P'];
function getPoints( function getPoints(
loc: StructureElement.Location, loc: StructureElement.Location,
r0: DnatcoUtil.Residue | undefined, r1: DnatcoUtil.Residue, r2: DnatcoUtil.Residue, r0: DnatcoUtil.Residue | undefined, r1: DnatcoUtil.Residue, r2: DnatcoUtil.Residue,
altId0: string, altId1: string, altId2: string, altId0: string, altId1: string, altId2: string,
insCode0: string, insCode1: string, insCode2: string, insCode0: string, insCode1: string, insCode2: string,
) { ) {
if (r0) getAtomPosition(p_1, loc, r0, ['C5\'', 'C5*'], altId0, insCode0); if (r0) {
r0 ? getAtomPosition(p0, loc, r0, ['O3\'', 'O3*'], altId0, insCode0) : getAtomPosition(p0, loc, r1, ['O5\'', 'O5*'], altId1, insCode1); if (!getAtomPosition(p_1, loc, r0, C5PrimeNames, altId0, insCode0))
getAtomPosition(p1, loc, r1, ['C5\'', 'C5*'], altId1, insCode1); return void 0;
getAtomPosition(p2, loc, r1, ['O3\'', 'O3*'], altId1, insCode1); if (!getAtomPosition(p0, loc, r0, O3PrimeNames, altId0, insCode0))
getAtomPosition(p3, loc, r2, ['C5\'', 'C5*'], altId2, insCode2); return void 0;
getAtomPosition(p4, loc, r2, ['O3\'', 'O3*'], altId2, insCode2); } else {
getAtomPosition(pP, loc, r2, ['P'], altId2, insCode2); if (!getAtomPosition(p0, loc, r1, O5PrimeNames, altId1, insCode1))
return void 0;
}
if (!getAtomPosition(p1, loc, r1, C5PrimeNames, altId1, insCode1))
return void 0;
if (!getAtomPosition(p2, loc, r1, O3PrimeNames, altId1, insCode1))
return void 0;
if (!getAtomPosition(p3, loc, r2, C5PrimeNames, altId2, insCode2))
return void 0;
if (!getAtomPosition(p4, loc, r2, O3PrimeNames, altId2, insCode2))
return void 0;
if (!getAtomPosition(pP, loc, r2, PNames, altId2, insCode2))
return void 0;
return { p_1, p0, p1, p2, p3, p4, pP }; return { p_1, p0, p1, p2, p3, p4, pP };
} }
...@@ -142,9 +162,12 @@ export class NtCTubeSegmentsIterator { ...@@ -142,9 +162,12 @@ export class NtCTubeSegmentsIterator {
const insCodeTwo = step.PDB_ins_code_2; const insCodeTwo = step.PDB_ins_code_2;
const followsGap = !!r0 && hasGapElements(r0, this.loc.unit) && hasGapElements(r1, this.loc.unit); const followsGap = !!r0 && hasGapElements(r0, this.loc.unit) && hasGapElements(r1, this.loc.unit);
const precedesDiscontinuity = r3 ? r3.index !== r2.index + 1 : false; const precedesDiscontinuity = r3 ? r3.index !== r2.index + 1 : false;
const points = getPoints(this.loc, r0, r1, r2, altIdPrev, this.altIdOne, altIdTwo, insCodePrev, this.insCodeOne, insCodeTwo);
if (!points)
return void 0;
return { return {
...getPoints(this.loc, r0, r1, r2, altIdPrev, this.altIdOne, altIdTwo, insCodePrev, this.insCodeOne, insCodeTwo), ...points,
stepIdx, stepIdx,
followsGap, followsGap,
firstInChain: !r0, firstInChain: !r0,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment