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

Backmerge: #4399 - Different chains shown by the same sequence in sequence mode (system ignores sugar presence) #4644

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ test.describe('1. User can expand hydrogens for ', () => {
for (const fileName of fileNames) {
test(`by ${fileName}`, async ({ page }) => {
if (temporaryFailedTestsFileNames.includes(fileName)) {
test.setTimeout(150000);
test.fail();
}

test.setTimeout(120000);
// Performance degradation problem - https://github.com/epam/Indigo/issues/1835 - REMOVE AFTER FIX
await openFileAndAddToCanvasAsNewProject(
`KET/Toggle-Explicit-Hydrogens-With-Respect-To-Selected-Atoms/All types of bond/${fileName}`,
Expand Down Expand Up @@ -654,8 +656,10 @@ test.describe('2. User can expand hydrogens for ', () => {
for (const fileName of fileNames) {
test(`by ${fileName}`, async ({ page }) => {
if (temporaryFailedTestsFileNames.includes(fileName)) {
test.setTimeout(150000);
test.fail();
}

test.setTimeout(120000);
// Performance degradation problem - https://github.com/epam/Indigo/issues/1835 - REMOVE AFTER FIX
await openFileAndAddToCanvasAsNewProject(
`KET/Toggle-Explicit-Hydrogens-With-Respect-To-Selected-Atoms/A on the canvas/${fileName}`,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Nucleoside, Phosphate } from 'domain/entities';
import { getNextMonomerInChain } from 'domain/helpers/monomers';
import { RNASequenceItemRenderer } from './RNASequenceItemRenderer';
import { D3SvgElementSelection } from 'application/render/types';

export class NucleosideSequenceItemRenderer extends RNASequenceItemRenderer {
private nucleosideCircleElement?: D3SvgElementSelection<
SVGCircleElement,
void
>;

protected drawModification() {
const node = this.node as Nucleoside;
const nextNode = getNextMonomerInChain(node.sugar);

this.drawCommonModification(node);

if (this.nucleosideCircleElement) {
this.nucleosideCircleElement.remove();
}

// show modification for not last Nucleoside
if (nextNode && !(nextNode instanceof Phosphate)) {
this.nucleosideCircleElement = this.rootElement
?.append('circle')
.attr('r', '3px')
.attr(
'stroke',
this.isSequenceEditInRnaBuilderModeTurnedOn ? '#24545A' : '#585858',
)
.attr('stroke-width', '1px')
.attr('fill', 'none')
.attr('cx', '10')
.attr('cy', '-16');
}
}
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,23 @@
import { BaseSequenceItemRenderer } from 'application/render/renderers/sequence/BaseSequenceItemRenderer';
import { Nucleotide } from 'domain/entities';
import { D3SvgElementSelection } from 'application/render/types';

export class NucleotideSequenceItemRenderer extends BaseSequenceItemRenderer {
import { RNASequenceItemRenderer } from './RNASequenceItemRenderer';

export class NucleotideSequenceItemRenderer extends RNASequenceItemRenderer {
private phosphateModificationCircleElement?: D3SvgElementSelection<
SVGCircleElement,
void
>;

get symbolToDisplay(): string {
return (
this.node.monomer.attachmentPointsToBonds.R3?.getAnotherMonomer(
this.node.monomer,
)?.monomerItem?.props.MonomerNaturalAnalogCode || '@'
);
}

protected drawModification() {
drawModification() {
const node = this.node as Nucleotide;

this.drawCommonModification(node);

if (this.phosphateModificationCircleElement) {
this.phosphateModificationCircleElement.remove();
}

if (node.rnaBase.isModification) {
this.backgroundElement?.attr(
'fill',
this.node.monomer.selected
? this.isSequenceEditInRnaBuilderModeTurnedOn
? '#41A8B2'
: '#3ACA6A'
: this.isSequenceEditModeTurnedOn
? '#ff7a004f'
: '#CAD3DD',
);
}

if (node.sugar.isModification) {
this.backgroundElement
?.attr(
'stroke',
this.isSequenceEditInRnaBuilderModeTurnedOn ? '#24545A' : '#585858',
)
.attr('stroke-width', '1px');
}

if (node.phosphate?.isModification) {
this.phosphateModificationCircleElement = this.rootElement
?.append('circle')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { BaseSequenceItemRenderer } from 'application/render/renderers/sequence/BaseSequenceItemRenderer';
import { Nucleoside, Nucleotide } from 'domain/entities';

export abstract class RNASequenceItemRenderer extends BaseSequenceItemRenderer {
get symbolToDisplay(): string {
return (
this.node.monomer.attachmentPointsToBonds.R3?.getAnotherMonomer(
this.node.monomer,
)?.monomerItem?.props.MonomerNaturalAnalogCode || '@'
);
}

protected drawCommonModification(node: Nucleoside | Nucleotide) {
if (node.rnaBase.isModification) {
this.backgroundElement?.attr(
'fill',
this.node.monomer.selected
? this.isSequenceEditInRnaBuilderModeTurnedOn
? '#41A8B2'
: '#3ACA6A'
: this.isSequenceEditModeTurnedOn
? '#ff7a004f'
: '#CAD3DD',
);
}

if (node.sugar.isModification) {
this.backgroundElement
?.attr(
'stroke',
this.isSequenceEditInRnaBuilderModeTurnedOn ? '#24545A' : '#585858',
)
.attr('stroke-width', '1px');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { EmptySequenceItemRenderer } from 'application/render/renderers/sequence
import { BaseMonomerRenderer } from 'application/render';
import { BaseSequenceItemRenderer } from 'application/render/renderers/sequence/BaseSequenceItemRenderer';
import { LinkerSequenceNode } from 'domain/entities/LinkerSequenceNode';
import { NucleosideSequenceItemRenderer } from './NucleosideSequenceItemRenderer';

export class SequenceNodeRendererFactory {
static fromNode(
Expand All @@ -30,7 +31,7 @@ export class SequenceNodeRendererFactory {
RendererClass = NucleotideSequenceItemRenderer;
break;
case Nucleoside:
RendererClass = NucleotideSequenceItemRenderer;
RendererClass = NucleosideSequenceItemRenderer;
break;
case EmptySequenceNode:
RendererClass = EmptySequenceItemRenderer;
Expand Down
7 changes: 6 additions & 1 deletion packages/ketcher-core/src/domain/entities/Nucleoside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { RNABase } from 'domain/entities/RNABase';
import { Sugar } from 'domain/entities/Sugar';
import assert from 'assert';
import {
getNextMonomerInChain,
getRnaBaseFromSugar,
isValidNucleoside,
isValidNucleotide,
Expand Down Expand Up @@ -97,6 +98,10 @@ export class Nucleoside {
}

public get modified() {
return this.rnaBase.isModification || this.sugar.isModification;
const isNotLastNode = !!getNextMonomerInChain(this.sugar);

return (
this.rnaBase.isModification || this.sugar.isModification || isNotLastNode
);
}
}
Loading