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

annotate_figure() cannot draw terminal glycans #51

Closed
mattias-erhardsson opened this issue Jun 27, 2024 · 1 comment
Closed

annotate_figure() cannot draw terminal glycans #51

mattias-erhardsson opened this issue Jun 27, 2024 · 1 comment

Comments

@mattias-erhardsson
Copy link
Contributor

anootate_figure() does not draw terminal glycan structures generated by for example get_differential_expression(). Example code:

import pandas as pd
from glycowork.motif.analysis import get_differential_expression
from glycowork.motif.analysis import get_volcano
from glycowork.motif.draw import annotate_figure
from glycowork.motif.draw import GlycoDraw
data = {
    'Glycan': ['Gal(b1-3)GalNAc', 'GalOS(b1-3)GalNAc', 'Gal(b1-3)[Fuc(a1-?)]GalNAc', 'GlcNAc(b1-2)Man(a1-3)Man', 'Man(a1-6)[Man(a1-3)]Man(b1-4)GlcNAc(b1-4)GlcNAc', 'Neu5Ac(a2-6)Gal(b1-4)GlcNAc(b1-2)Man', 'Neu5Ac(a2-3)Gal(b1-3)GalNAc'],
    'Sample1': [1.1, 0.2, 0.3, 0.5, 0.7, 1.0, 0.6],
    'Sample2': [1.2, 0.1, 0.2, 0.4, 0.8, 0.9, 0.5],
    'Sample3': [0.1, 1.8, 1.9, 0.3, 0.6, 0.8, 1.2],
    'Sample4': [0.2, 1.1, 1.2, 0.2, 0.5, 0.7, 1.1],
    'Sample5': [1.3, 0.3, 0.4, 0.6, 0.9, 1.1, 0.7],
    'Sample6': [1.4, 0.4, 0.5, 0.7, 1.0, 1.2, 0.8],
    'Sample7': [0.3, 1.9, 2.0, 0.4, 0.7, 0.9, 1.3],
    'Sample8': [0.4, 1.2, 1.3, 0.3, 0.6, 0.8, 1.2]
}
differential_glycomics_df = pd.DataFrame(data)

# Define the groups
group1 = ['Sample1', 'Sample2', 'Sample5', 'Sample6']
group2 = ['Sample3', 'Sample4', 'Sample7', 'Sample8']

differential_expression = get_differential_expression(df = differential_glycomics_df,
                            group1 = group1,
                            group2 = group2,
                            motifs = True,
                            feature_set = ['terminal1', 'terminal2', 'terminal3'],
                            paired = False,
                            min_samples = 0.1)

print(differential_expression)
# Differential glycomics volcano plot
volcano = get_volcano(differential_expression,
                      y_thresh = 0.05,
                      annotate_volcano = True,
                      filepath = './volcano.svg')

For an example that works, just replace the feature_set with 'exhaustive' or 'known'.

GlycoDraw can draw terminal glycans, even though it looks a bit weird. It seems to be interpreted as a modification called "Terminal_" on the left-most glycan. Example:

GlycoDraw('Terminal_Gal(b1-?)[Fuc(a1-?)]GalNAc')

A more logical representation might perhaps be to draw a linkage at the reducing end? If so it seems to me that this would require changes in how terminal structures are determined.

@Bribak
Copy link
Contributor

Bribak commented Jun 27, 2024

Thanks! On the dev branch, we have recently changed the nomenclature of dynamically generated terminal motifs, to have a "Terminal_" prefix (to really make it clear that this is a terminal motif, rather than the implicit dangling linkage we had before). But you're right in that GlycoDraw was not yet synced with this. Now GlycoDraw correctly handles terminal structures again

The same with annotate_figure; it basically looks for text on the figure that could be a glycan; was confused with the "Terminal_" but now can handle it

This issue is fixed with 21049e1

@Bribak Bribak closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants