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

Save Name and Reaction Conditions to RDF Metadata #2404

Closed
yauhen-karmyzau opened this issue Sep 18, 2024 · 1 comment · Fixed by #2640
Closed

Save Name and Reaction Conditions to RDF Metadata #2404

yauhen-karmyzau opened this issue Sep 18, 2024 · 1 comment · Fixed by #2640
Assignees
Labels
Cascade reactions Feature MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes

Comments

@yauhen-karmyzau
Copy link
Collaborator

yauhen-karmyzau commented Sep 18, 2024

Background
Currently, the system lacks the capability to automatically detect and incorporate text annotations (Name and Reaction Conditions) located above reaction arrows into the RDF metadata. Implementing this feature will allow for a more comprehensive representation of reaction diagrams, including textual annotations directly associated with specific reactions and opening them in other applications with RDF support.

Solution

  1. Text Detection:
    Objective: Develop an automated feature in the system that detects text placed above reaction arrows and associates this text with the corresponding reaction.
    Details: Utilize text recognition algorithms to identify text blocks positioned strategically above reaction arrows on the canvas.
    If a KET text block will be within TEXTBLOCK_WIDTH/2 x TEXTBLOCK_HEIGHT/2, than this text must be understand as reaction's text.
    Multi-tailed arrow:
    Bottom left point of the text must be positioned inside the box. The box must be stick to spain.
    Image

    Simple arrow:
    Bottom center point of the text must be positioned inside the box. The box must be centred.
    Image

    If there are several text objects in the rectangle, than we should take the closest one: bottom-left point to head arrow x spine and bottom-center point to center of a simple arrow.

  2. Text parsing:
    Objective: Develop text parsing to recognise reaction's Name and Reaction Conditions.
    Details: We should read KET text object and understand text before the first empty line as Name and after, as Reaction Conditions.
    If there is no empty line, than we should understand this text as Name only.
    If there is an empty line at the very beginning, than we should understand text as Reaction Conditions.
    If there are several empty lines in the text block, that we should understand all empty lines after the first one as a part of Reaction Conditions.
    Image

  3. Insert Name and Reaction Conditions to RDF's metadata
    Objective: Name and Reaction Conditions should be added to reaction's metadata while saving to RDF format.
    Details: When user saves reactions to RDF, reaction's Name and Reaction Conditions should be added to reaction's metadata as a plain text. Metadata fields should be added after each reaction (RXN) inside RDF in $DTYPE - $DATUM pairs, where $DTYPE is a name of a field and $DATUM is a plain text information.

    If there is no Name or Reaction Condition, than $DATUM field should be "Not available"

    ...
    11 12  1  0
    11  4  4  0
    M  END
    $DTYPE Name
    $DATUM Reaction name is here
    $DTYPE Reaction Conditions
    $DATUM Reaction Conditions text
    ...
    
@yauhen-karmyzau yauhen-karmyzau added the MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes label Sep 18, 2024
@yauhen-karmyzau yauhen-karmyzau added this to the Indigo-1.26.0-rc.1 milestone Sep 30, 2024
@yauhen-karmyzau yauhen-karmyzau changed the title Save reactions with a text above and below reaction arrows to RDF Save Name and Reaction Conditions to RDF Metadata Oct 28, 2024
@even1024 even1024 linked a pull request Nov 18, 2024 that will close this issue
7 tasks
@ivanmaslow
Copy link
Collaborator

AC were confirmed with @yauhen-karmyzau:

  • In the case of Multi-Tailed Arrow if a KET text block will be within SPINE LENGTH/2 x HEAD ARROW LENGTH, than this text must be understood as reaction's text.
  • In the case of Simple Arrow if a KET text block will be within ARROW LENGTH/2 x ARROW LENGTH, than this text must be understood as reaction's text.
    Example of approximate area of bounding box:
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cascade reactions Feature MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants