diff --git a/src/mol-model/structure/model/properties/utils/atomic-ranges.ts b/src/mol-model/structure/model/properties/utils/atomic-ranges.ts index dd136ad27272606a16dffcb3b4d7e193dd5c1f0e..9c9d48d2653b5197909dfcef1e01ef31e1db2698 100644 --- a/src/mol-model/structure/model/properties/utils/atomic-ranges.ts +++ b/src/mol-model/structure/model/properties/utils/atomic-ranges.ts @@ -45,7 +45,7 @@ export function getAtomicRanges(hierarchy: AtomicHierarchy, entities: Entities, const residueIt = Segmentation.transientSegments(hierarchy.residueAtomSegments, Interval.ofBounds(0, hierarchy.atoms._rowCount)) const { index, derived } = hierarchy const { label_seq_id } = hierarchy.residues - // const { label_entity_id } = hierarchy.chains + const { label_entity_id } = hierarchy.chains const { moleculeType, traceElementIndex } = derived.residue let prevSeqId: number @@ -61,18 +61,20 @@ export function getAtomicRanges(hierarchy: AtomicHierarchy, entities: Entities, prevEnd = -1 startIndex = -1 + const eI = entities.getEntityIndex(label_entity_id.value(chainSegment.index)) + const seq = sequence.byEntityKey[eI] + const maxSeqId = seq ? seq.sequence.seqId.value(seq.sequence.seqId.rowCount - 1) : -1 + + // check cyclic peptides, seqIds and distance must be compatible const riStart = hierarchy.residueAtomSegments.index[chainSegment.start] const riEnd = hierarchy.residueAtomSegments.index[chainSegment.end - 1] - if (areBackboneConnected(riStart, riEnd, conformation, index, derived)) { + const seqIdStart = label_seq_id.value(riStart) + const seqIdEnd = label_seq_id.value(riEnd) + if (seqIdStart === 1 && seqIdEnd === maxSeqId && areBackboneConnected(riStart, riEnd, conformation, index, derived)) { cyclicPolymerMap.set(riStart, riEnd) cyclicPolymerMap.set(riEnd, riStart) } - // TODO - // const eI = entities.getEntityIndex(label_entity_id.value(chainSegment.index)) - // const seq = sequence.byEntityKey[eI] - // const maxSeqId = seq ? seq.sequence.seqId.value(seq.sequence.seqId.rowCount - 1) : -1 - while (residueIt.hasNext) { const residueSegment = residueIt.move(); const residueIndex = residueSegment.index