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

Read Name and Reaction Conditions from RDF Metadata as a text #2559

Open
yauhen-karmyzau opened this issue Oct 16, 2024 · 0 comments
Open

Read Name and Reaction Conditions from RDF Metadata as a text #2559

yauhen-karmyzau opened this issue Oct 16, 2024 · 0 comments
Assignees
Labels
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 Oct 16, 2024

Background
In the current implementation, Indigo handles RDF files containing reactions (RXN) but lacks the capability to utilize metadata associated with these reactions. Metadata fields are crucial for detailed documentation and readability of chemical reactions. We want to use $DTYPE Name and $DTYPE Reaction Conditions Metadata fields to enhance documentation capabilities and allow users to leverage text for better clarity and communication, there is a need to introduce support for reading text description thru the metadata fields.

Solution

  1. Metadata Reading and Parsing:

    Objective: Enable Indigo to accurately read and parse content from Name and Reaction Conditions metadata fields.
    Details:

    1. There are pairs of metadata in key-value format ($DTYPE-$DATUM) which can be located in RDF file after each reaction.
    ...
    11 12  1  0
    11  4  4  0
    M  END
    $DTYPE Name
    $DATUM Reaction name is here
    $DTYPE Reference
    $DATUM Not available
    $DTYPE Reaction Conditions
    $DATUM Reaction Conditions text
    ...
    
    1. We should read Name as text in bold and Reaction Conditions as text in italic
    2. If $DATUM contains "Not available" or empty, than we should ignore this field.
  2. Prepare text block:
    Truncated text will be lost!

    Objective: Prepare text block to display near reaction's arrow and truncate large text to layout reactions in readable format.
    Details:

    1. Name as text in bold and Reaction Conditions as text in italic should be added to one KET text object.
    2. If Name and Reaction Conditions are exist, than empty line should be added after the name of reaction.
    3. Text must fit a rectangle using the following conditions:
    • not more that 32 symbols in a line of text for width;
    • text block height must be equal 1/2 multi-tailed arrow's spine height exclude reaction-component-margin-size, however, not less, than 9 lines of text, including empty line between Name and Reaction Conditions.

    Initial requirements of 2.3 are here. However, we can't calculate exact text dimensions and will use other solution.
    maximum 6.5 default sizes of the bond for width exclude left and right reaction-component-margin-size and maximum 4.5 default sizes of the bond for height exclude bottom reaction-component-margin-size.
    Max width: 6.5 - 2*reaction-component-margin-size (6.5 - current arrow length, the same constant must be use!)
    Max hight: 4.5 - reaction-component-margin-size
    render-font-size parameter is already available in Indigo.


    Image

    1. If text line is too long to fit maximum width, than it must be broken into several lines to fit maximum width. In this case, line break must before a word which is not fitting maximum width.
    2. If a word is too wide to fit maximum width, than the line break should be added before the symbol which is not fitting maximum width.
    3. Text exceeding these box limits will be truncated with an ellipsis ("..."): 2 last symbols of the last word which is not fitting maximum width should be replaced by ellipsis.

    Image
    Image

    Image
    Image

  3. Dynamic Positioning and Alignment:

    1. Text block sticked to reaction's arrow with a margin, centered horizontally above a single arrow or aligned to the left for multi-tailed arrows.
      Image

Automatic Layout Adjustments is out of scope! Keep it for history!

  1. Automatic Layout Adjustments:

    Objective: Dynamically adjust the layout of reaction diagrams based on the presence and size of text annotations.
    Details:

    1. The vertical spacing and positioning of reactions should be modified to accommodate blocks of text, ensuring a visually balanced and uncluttered diagram.
      Without text:
      Image
      With text:
      Image

    2. Multi-tailed arrow's spine hight should be adjusted to fit Text Above Reaction Arrows and all the reactants. Head arrow should be centred, as it is.
      If current hight/2 size of the spine is less, than text box - spine's hight must be adjusted.

    3. If multi-tailed arrow's spine was increased, than tails and tree nodes should be adjusted proportionally.
      image

@yauhen-karmyzau yauhen-karmyzau changed the title Enhance Indigo to Support Metadata Reading and Conversion in RDF Files Enhance Indigo to Support Metadata Reading and Conversion of Name and Reaction Conditions in RDF Files Oct 16, 2024
@yauhen-karmyzau yauhen-karmyzau changed the title Enhance Indigo to Support Metadata Reading and Conversion of Name and Reaction Conditions in RDF Files Read Name and Reaction Conditions from RDF Metadata as a text Oct 21, 2024
@yauhen-karmyzau yauhen-karmyzau added the MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes
Projects
None yet
Development

No branches or pull requests

2 participants