From 25da773da1a36b26aba5389d4c018605f3fbb1ed Mon Sep 17 00:00:00 2001 From: arose <alexander.rose@weirdbyte.de> Date: Thu, 28 Jun 2018 19:33:17 -0700 Subject: [PATCH] fixes --- .../structure/visual/polymer-backbone-cylinder.ts | 10 ++++++++-- .../representation/structure/visual/util/polymer.ts | 12 ++++++------ .../structure/model/formats/mmcif/atomic.ts | 4 +--- src/mol-view/stage.ts | 3 ++- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts b/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts index 7c63398f5..9068225e5 100644 --- a/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts +++ b/src/mol-geo/representation/structure/visual/polymer-backbone-cylinder.ts @@ -46,10 +46,12 @@ async function createPolymerBackboneCylinderMesh(ctx: RuntimeContext, unit: Unit const residuesIt = Segmentation.transientSegments(residueSegments, elements); let i = 0 + let first = true while (polymerIt.hasNext) { const polymerSegment = polymerIt.move(); residuesIt.setSegment(polymerSegment); + first = true while (residuesIt.hasNext) { const residueSegment = residuesIt.move(); l.element = elements[residueSegment.start]; @@ -70,8 +72,12 @@ async function createPolymerBackboneCylinderMesh(ctx: RuntimeContext, unit: Unit } pos(l.element, curV) - builder.setId(residueSegment.start) - builder.addCylinder(prevV, curV, 1, { radiusTop: 0.2, radiusBottom: 0.2 }) + if (!first) { + builder.setId(residueSegment.start) + builder.addCylinder(prevV, curV, 1, { radiusTop: 0.2, radiusBottom: 0.2 }) + } else { + first = false + } Vec3.copy(prevV, curV) diff --git a/src/mol-geo/representation/structure/visual/util/polymer.ts b/src/mol-geo/representation/structure/visual/util/polymer.ts index e54cf1e01..3f8c7bf3f 100644 --- a/src/mol-geo/representation/structure/visual/util/polymer.ts +++ b/src/mol-geo/representation/structure/visual/util/polymer.ts @@ -13,14 +13,14 @@ export function getPolymerElementCount(unit: Unit) { const { elements } = unit const l = Element.Location(unit) if (Unit.isAtomic(unit)) { - const { chainSegments, residueSegments } = unit.model.atomicHierarchy - const chainsIt = Segmentation.transientSegments(chainSegments, elements); + const { polymerSegments, residueSegments } = unit.model.atomicHierarchy + const polymerIt = Segmentation.transientSegments(polymerSegments, elements); const residuesIt = Segmentation.transientSegments(residueSegments, elements); - while (chainsIt.hasNext) { - residuesIt.setSegment(chainsIt.move()); + while (polymerIt.hasNext) { + residuesIt.setSegment(polymerIt.move()); while (residuesIt.hasNext) { - l.element = elements[residuesIt.move().start]; - if (StructureProperties.entity.type(l) === 'polymer') count++ + residuesIt.move(); + count++ } } } else if (Unit.isSpheres(unit)) { diff --git a/src/mol-model/structure/model/formats/mmcif/atomic.ts b/src/mol-model/structure/model/formats/mmcif/atomic.ts index b38b230d4..736c81fe6 100644 --- a/src/mol-model/structure/model/formats/mmcif/atomic.ts +++ b/src/mol-model/structure/model/formats/mmcif/atomic.ts @@ -29,14 +29,12 @@ function findHierarchyOffsets(atom_site: AtomSite) { for (let i = start + 1; i < end; i++) { const newChain = !label_entity_id.areValuesEqual(i - 1, i) || !label_asym_id.areValuesEqual(i - 1, i); - // TODO improve??? - const newPolymer = newChain - || label_seq_id.value(i - 1) !== label_seq_id.value(i) - 1; const newResidue = newChain || !label_seq_id.areValuesEqual(i - 1, i) || !auth_seq_id.areValuesEqual(i - 1, i) || !pdbx_PDB_ins_code.areValuesEqual(i - 1, i) || !label_comp_id.areValuesEqual(i - 1, i); + const newPolymer = newResidue && label_seq_id.value(i - 1) !== label_seq_id.value(i) - 1; if (newResidue) residues[residues.length] = i as Element; if (newPolymer) polymers[polymers.length] = i as Element; diff --git a/src/mol-view/stage.ts b/src/mol-view/stage.ts index 49eef29d6..3809a7271 100644 --- a/src/mol-view/stage.ts +++ b/src/mol-view/stage.ts @@ -74,9 +74,10 @@ export class Stage { // this.loadPdbid('3pqr') // inter unit bonds // this.loadPdbid('4v5a') // ribosome // this.loadPdbid('3j3q') // ... + this.loadPdbid('3sn6') // ... // this.loadMmcifUrl(`../../examples/1cbs_full.bcif`) - this.loadMmcifUrl(`../../../test/pdb-dev/PDBDEV_00000001.cif`) + // this.loadMmcifUrl(`../../../test/pdb-dev/PDBDEV_00000001.cif`) } async loadMmcifUrl (url: string) { -- GitLab