From 5d269fd77cc1da48be69552c17fd92bfec97c2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= <michal.maly@ibt.cas.cz> Date: Tue, 17 Jan 2023 09:31:08 +0100 Subject: [PATCH] Check for discontinuities when buiilding Confal pyramids mesh --- src/extensions/dnatco/confal-pyramids/representation.ts | 2 ++ src/extensions/dnatco/confal-pyramids/util.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/extensions/dnatco/confal-pyramids/representation.ts b/src/extensions/dnatco/confal-pyramids/representation.ts index f55cb6ef9..80d9e852a 100644 --- a/src/extensions/dnatco/confal-pyramids/representation.ts +++ b/src/extensions/dnatco/confal-pyramids/representation.ts @@ -88,6 +88,8 @@ function createConfalPyramidsMesh(ctx: VisualContext, unit: Unit, structure: Str const it = new ConfalPyramidsIterator(structure, unit); while (it.hasNext) { const allPoints = it.move(); + if (!allPoints) + continue; for (const points of allPoints) { const { O3, P, OP1, OP2, O5, confalScore } = points; diff --git a/src/extensions/dnatco/confal-pyramids/util.ts b/src/extensions/dnatco/confal-pyramids/util.ts index 6ab28c6f5..c35f3270e 100644 --- a/src/extensions/dnatco/confal-pyramids/util.ts +++ b/src/extensions/dnatco/confal-pyramids/util.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2018-2023 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Michal Malý <michal.maly@ibt.cas.cz> * @author Jiří Černý <jiri.cerny@ibt.cas.cz> @@ -48,6 +48,10 @@ export class ConfalPyramidsIterator { this.residueOne = DnatcoUtil.copyResidue(this.residueTwo); this.residueTwo = DnatcoUtil.copyResidue(this.residueIt.move())!; + // Check for discontinuity + if (this.residueTwo.index !== (this.residueOne!.index + 1)) + return void 0; + return this.toPyramids(this.residueOne!, this.residueTwo); } -- GitLab