Skip to content

Commit

Permalink
#4936-Disable stereochemistry button for monomers
Browse files Browse the repository at this point in the history
  • Loading branch information
beisenova-aliya committed Jul 16, 2024
1 parent cecc56f commit 3948e73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function fromStereoFlagUpdate(restruct, frid, flag = null) {
if (!flag) {
const struct = restruct.molecule;
const frag = restruct.molecule.frags.get(frid);
frag.stereoAtoms.forEach((aid) => {
frag?.stereoAtoms.forEach((aid) => {
if (struct.atoms.get(aid).stereoLabel === null) {
action.addOp(new FragmentDeleteStereoAtom(frid, aid));
}
Expand Down
8 changes: 6 additions & 2 deletions packages/ketcher-core/src/application/editor/actions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
AtomAttributes,
AtomQueryProperties,
Bond,
MonomerMicromolecule,
Struct,
Vec2,
} from 'domain/entities';
Expand All @@ -28,7 +29,6 @@ import { difference } from 'lodash';
import { ReStruct } from 'application/render';
import { selectionKeys } from '../shared/constants';
import { EditorSelection } from '../editor.types';

export type AtomType = 'single' | 'list' | 'pseudo';
export type AtomAttributeName = keyof AtomAttributes;
export type AtomQueryPropertiesName = keyof AtomQueryProperties;
Expand Down Expand Up @@ -63,7 +63,11 @@ export function findStereoAtoms(
struct: Struct,
atomIds: number[] | undefined,
): number[] {
if (!atomIds) {
const isMonomer = struct.sgroups.find(
(_, sgroup) => sgroup instanceof MonomerMicromolecule,
);

if (isMonomer !== null || !atomIds) {
return [] as number[];
}

Expand Down

0 comments on commit 3948e73

Please sign in to comment.