Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4508 – Macro: In the Text-editing mode, when selecting nucleotides linked through phosphates R2-R2, an error appears in the Console #4538

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/ketcher-core/src/domain/entities/BaseMonomer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,6 @@ export abstract class BaseMonomer extends DrawingEntity {
return this.SubChainConstructor !== monomerToChain.SubChainConstructor;
}

public get isPartOfRna() {
return false;
}

public get isModification() {
return this.monomerItem.props.MonomerNaturalAnalogCode !== this.label;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ export class DrawingEntitiesManager {
) {
return { command, drawingEntities };
}
if (drawingEntity.isPartOfRna && drawingEntity instanceof Sugar) {
if (drawingEntity instanceof Sugar && drawingEntity.isPartOfRNA) {
const sugar = drawingEntity;
if (isValidNucleoside(sugar)) {
const nucleoside = Nucleoside.fromSugar(sugar);
Expand Down
4 changes: 0 additions & 4 deletions packages/ketcher-core/src/domain/entities/DrawingEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,4 @@ export abstract class DrawingEntity {
public setBaseRenderer(renderer: BaseRenderer) {
this.baseRenderer = renderer;
}

public get isPartOfRna() {
return false;
}
}
18 changes: 0 additions & 18 deletions packages/ketcher-core/src/domain/entities/Phosphate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BaseMonomer } from './BaseMonomer';
import { AttachmentPointName, MonomerItemType } from 'domain/types';
import { Vec2 } from './vec2';
import { Sugar } from './Sugar';
import { RNABase } from 'domain/entities/RNABase';
import { PhosphateSubChain } from 'domain/entities/monomer-chains/PhosphateSubChain';
import { SubChainNode } from 'domain/entities/monomer-chains/types';
import { RnaSubChain } from 'domain/entities/monomer-chains/RnaSubChain';
Expand Down Expand Up @@ -93,21 +92,4 @@ export class Phosphate extends BaseMonomer {
public get SubChainConstructor() {
return PhosphateSubChain;
}

get isPartOfRna() {
const previousMonomer =
this.attachmentPointsToBonds.R1?.getAnotherMonomer(this);
const isPreviousMonomerSugar = previousMonomer instanceof Sugar;
const isSugarConnectedToBase =
previousMonomer?.attachmentPointsToBonds.R3?.getAnotherMonomer(
previousMonomer,
) instanceof RNABase;
const nextMonomer =
this.attachmentPointsToBonds.R2?.getAnotherMonomer(this);
const isNextMonomerRna = nextMonomer?.isPartOfRna;
DmitriiP-EPAM marked this conversation as resolved.
Show resolved Hide resolved

// isNextMonomerRna used here because we need to interpret last phosphate of rna chain
// as not a part of nucleoTide but as phosphate connected to nucleoSide
return isPreviousMonomerSugar && isSugarConnectedToBase && isNextMonomerRna;
}
}
2 changes: 1 addition & 1 deletion packages/ketcher-core/src/domain/entities/PolymerBond.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class PolymerBond extends DrawingEntity {
return this.position;
}

public getAnotherMonomer(monomer: BaseMonomer) {
public getAnotherMonomer(monomer: BaseMonomer): BaseMonomer | undefined {
return this.firstMonomer === monomer
? this.secondMonomer
: this.firstMonomer;
Expand Down
7 changes: 0 additions & 7 deletions packages/ketcher-core/src/domain/entities/RNABase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BaseMonomer } from 'domain/entities/BaseMonomer';
import { Sugar } from 'domain/entities/Sugar';
import { ChemSubChain } from 'domain/entities/monomer-chains/ChemSubChain';

export class RNABase extends BaseMonomer {
Expand All @@ -20,10 +19,4 @@ export class RNABase extends BaseMonomer {
public get SubChainConstructor() {
return ChemSubChain;
}

public get isPartOfRna(): boolean {
return (
this.attachmentPointsToBonds.R1?.getAnotherMonomer(this) instanceof Sugar
);
}
}
2 changes: 1 addition & 1 deletion packages/ketcher-core/src/domain/entities/Sugar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Sugar extends BaseMonomer {
);
}

public get isPartOfRna(): boolean {
public get isPartOfRNA(): boolean {
return (
this.attachmentPointsToBonds.R3?.getAnotherMonomer(this) instanceof
RNABase
Expand Down
Loading