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: #5848 - Unable to establish connection between micro structure and sugar or phopshate (and partially - unresolved monomer) #5871

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
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class BondRenderer extends BaseRenderer {

private appendRootElement() {
return this.canvas
.append('g')
.insert('g', ':first-child')
.data([this])
.attr(
'transform',
Expand Down
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
Loading