Skip to content

Commit

Permalink
#5848 - Unable to establish connection between micro structure and su…
Browse files Browse the repository at this point in the history
…gar or phopshate (and partially - unresolved monomer) (#5866)
  • Loading branch information
rrodionov91 committed Oct 25, 2024
1 parent 6591956 commit 6e55cbc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 8 additions & 0 deletions packages/ketcher-core/src/domain/entities/Phosphate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,21 @@ export class Phosphate extends BaseMonomer {
}

public getValidSourcePoint(secondMonomer: BaseMonomer) {
if (!secondMonomer) {
return this.firstFreeAttachmentPoint;
}

return this.getValidPoint(
secondMonomer,
secondMonomer.potentialSecondAttachmentPointForBond,
);
}

public getValidTargetPoint(firstMonomer: BaseMonomer) {
if (!firstMonomer) {
return this.firstFreeAttachmentPoint;
}

// same implementation for both source and target attachment points
return this.getValidPoint(
firstMonomer,
Expand Down
10 changes: 9 additions & 1 deletion packages/ketcher-core/src/domain/entities/Sugar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ import { isRnaBaseOrAmbiguousRnaBase } from 'domain/helpers/monomers';
import { IVariantMonomer } from 'domain/entities/types';

export class Sugar extends BaseMonomer {
public getValidSourcePoint(secondMonomer: BaseMonomer & IVariantMonomer) {
public getValidSourcePoint(secondMonomer?: BaseMonomer & IVariantMonomer) {
if (!secondMonomer) {
return this.firstFreeAttachmentPoint;
}

return this.getValidPoint(
secondMonomer,
secondMonomer.potentialSecondAttachmentPointForBond,
);
}

public getValidTargetPoint(firstMonomer: BaseMonomer & IVariantMonomer) {
if (!firstMonomer) {
return this.firstFreeAttachmentPoint;
}

// same implementation for both source and target attachment points
return this.getValidPoint(
firstMonomer,
Expand Down
16 changes: 12 additions & 4 deletions packages/ketcher-core/src/domain/entities/UnresolvedMonomer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ import { SubChainNode } from 'domain/entities/monomer-chains/types';
import { Peptide } from 'domain/entities/Peptide';

export class UnresolvedMonomer extends BaseMonomer {
public getValidSourcePoint(monomer?: BaseMonomer) {
return Peptide.prototype.getValidSourcePoint.call(this, monomer);
public getValidSourcePoint(secondMonomer?: BaseMonomer) {
if (!secondMonomer) {
return this.firstFreeAttachmentPoint;
}

return Peptide.prototype.getValidSourcePoint.call(this, secondMonomer);
}

public getValidTargetPoint(monomer: BaseMonomer) {
return Peptide.prototype.getValidTargetPoint.call(this, monomer);
public getValidTargetPoint(firstMonomer: BaseMonomer) {
if (!firstMonomer) {
return this.firstFreeAttachmentPoint;
}

return Peptide.prototype.getValidTargetPoint.call(this, firstMonomer);
}

public get SubChainConstructor() {
Expand Down

0 comments on commit 6e55cbc

Please sign in to comment.