Skip to content

Commit

Permalink
#3874 - Macro: R2 label is displayed on attachment atom instead of le…
Browse files Browse the repository at this point in the history
…aving group in monomer preview (#3875)

- fixed leaving group searching during ket deserialization

Co-authored-by: Roman Rodionov <[email protected]>
  • Loading branch information
rrodionov91 and rrodionov91 authored Jan 12, 2024
1 parent 8873d19 commit 8e5617a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import { BaseMonomer } from 'domain/entities/BaseMonomer';
import { validate } from 'domain/serializers/ket/validate';
import { MacromoleculesConverter } from 'application/editor/MacromoleculesConverter';
import { convertAttachmentPointNumberToLabel } from 'domain/helpers/attachmentPointCalculations';
import { isNumber } from 'lodash';

function parseNode(node: any, struct: any) {
const type = node.type;
Expand Down Expand Up @@ -331,9 +332,12 @@ export class KetSerializer implements Serializer<Struct> {

template.attachmentPoints?.forEach(
(attachmentPoint, attachmentPointIndex) => {
const firstAtomInLeavingGroup =
attachmentPoint.leavingGroup?.atoms[0];
const leavingGroupAtom = monomer.monomerItem.struct.atoms.get(
attachmentPoint.leavingGroup?.atoms[0] ||
attachmentPoint.attachmentAtom,
isNumber(firstAtomInLeavingGroup)
? firstAtomInLeavingGroup
: attachmentPoint.attachmentAtom,
);
assert(leavingGroupAtom);
leavingGroupAtom.rglabel = (
Expand Down

0 comments on commit 8e5617a

Please sign in to comment.