Skip to content

Commit

Permalink
Backmerge: #5184 – Fix unresolved monomers bond establishing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
svvald committed Aug 8, 2024
1 parent 5e94631 commit 568d857
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 9 additions & 0 deletions packages/ketcher-core/src/application/editor/tools/Bond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { Coordinates } from '../shared/coordinates';
import { AttachmentPointName } from 'domain/types';
import { AttachmentPoint } from 'domain/AttachmentPoint';
import { Command } from 'domain/entities/Command';
import { UnresolvedMonomer } from "domain/entities";

class PolymerBond implements BaseTool {
private bondRenderer?: PolymerBondRenderer;
Expand Down Expand Up @@ -493,6 +494,14 @@ class PolymerBond implements BaseTool {
return true;
}

// Modal: Any or both monomers are unresolved
if (
firstMonomer instanceof UnresolvedMonomer ||
secondMonomer instanceof UnresolvedMonomer
) {
return true;
}

// Modal: One monomer is Peptide and another is RNA monomer
const rnaMonomerClasses = [Sugar, RNABase, Phosphate];
const firstMonomerIsRNA = rnaMonomerClasses.find(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { BaseMonomer } from './BaseMonomer';
import { ChemSubChain } from 'domain/entities/monomer-chains/ChemSubChain';
import { PeptideSubChain } from 'domain/entities/monomer-chains/PeptideSubChain';
import { SubChainNode } from 'domain/entities/monomer-chains/types';
import { Peptide } from 'domain/entities/Peptide';

export class UnresolvedMonomer extends BaseMonomer {
public getValidSourcePoint(_monomer?: BaseMonomer) {
return undefined;
public getValidSourcePoint(monomer?: BaseMonomer) {
return Peptide.prototype.getValidSourcePoint.call(this, monomer);
}

public getValidTargetPoint(_monomer: BaseMonomer) {
return undefined;
public getValidTargetPoint(monomer: BaseMonomer) {
return Peptide.prototype.getValidTargetPoint.call(this, monomer);
}

public get SubChainConstructor() {
Expand Down

0 comments on commit 568d857

Please sign in to comment.