GlyContact
Glycan 3D structures, analyzed at scale.
Hand it a sequence. It brings the conformers and returns contacts, surface accessibility, flexibility, torsions, and hydrogen bonds.
Glycans are branched and flexible, so much of their function lives in a 3D landscape that a linear sequence only hints at. GlyContact connects the sequence you already have to atomic-resolution structures from GlycoShape molecular dynamics, NMR, or X-ray crystallography, and turns them into numbers, figures, and machine learning features.
- Sequence in, structures out. Pass an IUPAC sequence and GlyContact fetches its conformers from the GlycoShape API and caches them. Your own PDB files work the same way, through
my_path. - Ensembles, not snapshots. Contact frequencies, torsions, and hydrogen bonds are computed across conformer clusters and weighted by their populations.
- Free, bound, and attached. Binding pockets, per-contact interaction classes, and glycan shielding cover lectin complexes and glycoproteins alike.
- Ready for machine learning. 1,476 annotated structure graphs ship with the package, and the
[ml]extra trains models that sample structure ensembles for any sequence. - Figures worth publishing. Every plot is drawn with viscose, and one word changes its palette.
Documentation: https://bojarlab.github.io/glycontact/ · Examples: lectin complexes and glycoproteins · Cite: Thomès et al., 2025
Install
pip install glycontact
pip install "glycontact[ml]" # adds torch and torch-geometric for the machine learning layer
See it in 3D
plot_glycan_3D draws any conformer with 3D-SNFG symbols in an interactive py3Dmol view, inside your notebook. The structure at the top of this page comes from this call.
from glycontact.visualize import plot_glycan_3D
glycan = "Gal(b1-4)GlcNAc(b1-2)Man(a1-3)[Gal(b1-4)GlcNAc(b1-2)Man(a1-6)]Man(b1-4)GlcNAc(b1-4)[Fuc(a1-6)]GlcNAc"
plot_glycan_3D(glycan)
Contact maps
Contact maps show which monosaccharides sit close together in space, and so which parts of a glycan act as one surface. You get one table per conformer cluster, with the closest contacts drawn darkest.
from glycontact.process import get_contact_tables
from glycontact.visualize import draw_contact_map
contact_tables = get_contact_tables(glycan, level = "monosaccharide")
draw_contact_map(contact_tables[0], size = 1.0)
Surface accessibility and flexibility
Solvent-accessible surface area and flexibility decide what a binding partner can reach. plot_glycan_score paints them straight onto the SNFG drawing, with the most exposed residues glowing strongest.
from glycontact.visualize import plot_glycan_score
plot_glycan_score(glycan, attribute = "SASA")
Torsion angles
Glycosidic torsions set the overall shape of a glycan. ramachandran_plot pools them across every structure that carries a linkage.
from glycontact.visualize import ramachandran_plot
fig = ramachandran_plot("Gal(b1-4)GlcNAc")
get_linkage_conformations gives the same view for one glycan, weighted by conformer population and with gg/gt/tg rotamers for linkages to O6.
from glycontact.process import get_linkage_conformations
print(get_linkage_conformations(glycan).head().to_string(index = False))
linkage n_conformers phi_mean phi_sd psi_mean psi_sd omega_mean omega_sd gg gt tg
10_NAG-9_MAN 5 -80.07 12.60 167.23 5.29 NaN NaN NaN NaN NaN
11_GAL-10_NAG 5 -64.52 5.33 -116.76 8.54 NaN NaN NaN NaN NaN
3_FUC-2_NAG 5 -76.55 2.46 177.25 13.46 -83.72 10.23 1.0 0.0 0.0
4_NAG-2_NAG 5 -76.48 3.29 -121.53 9.13 NaN NaN NaN NaN NaN
5_BMA-4_NAG 5 -84.01 38.24 -123.50 15.52 NaN NaN NaN NaN NaN
Hydrogen bonds
get_hydrogen_bonds finds the inter-residue hydrogen bonds that hold a conformation together, with their occupancy across the ensemble.
from glycontact.process import get_hydrogen_bonds
print(get_hydrogen_bonds(glycan).head().to_string(index = False))
donor_residue donor donor_atom acceptor_residue acceptor acceptor_atom occupancy distance angle
10 GlcNAc(b1-2) O3 11 Gal(b1-4) O5 0.8 3.00 141.68
4 GlcNAc(b1-4) N2 3 Fuc(a1-6) O2 0.6 3.01 156.65
2 GlcNAc(b1-1) O3 4 GlcNAc(b1-4) O5 0.6 2.80 141.05
7 GlcNAc(b1-2) O3 8 Gal(b1-4) O5 0.6 2.80 159.19
3 Fuc(a1-6) O2 7 GlcNAc(b1-2) O3 0.4 2.79 157.55
What a motif does to a structure
find_difference compares every pair of glycans that differ only by a motif and tests the change in any structural property.
from glycontact.process import structure_graphs
from glycontact.visualize import find_difference
result = find_difference(list(structure_graphs), pattern = "[Fuc(a1-6)]", metric = "SASA", plot = True)
Glycans bound to proteins
glycontact.structure works on any PDB file. It reads the glycans out of it and classifies every contact with the protein into hydrogen bonds, CH-π stacking, metal coordination, covalent bonds, and van der Waals contacts.
from glycontact.structure import get_glycan_sequences_from_pdb, get_glycan_protein_interactions
print(get_glycan_sequences_from_pdb("3ZW1.pdb"))
interactions = get_glycan_protein_interactions("Fuc(a1-3)[Gal(b1-4)]GlcNAc(b1-3)Gal", "3ZW1.pdb")
print(interactions.head().to_string(index = False))
['Fuc(a1-3)[Gal(b1-4)]GlcNAc(b1-3)Gal', 'Fuc(a1-3)GlcNAc']
glycan_chain glycan_residue IUPAC glycan_atom chain resSeq resName protein_atom distance interaction
D 4_GAL Gal(b1-4) O6 A 8 TRP NE1 3.254790 hydrogen_bond
D 3_FUC Fuc(a1-3) O5 A 15 ARG NH2 2.825438 hydrogen_bond
D 3_FUC Fuc(a1-3) O4 A 15 ARG NE 2.905937 hydrogen_bond
D 3_FUC Fuc(a1-3) O5 A 15 ARG NE 3.352896 hydrogen_bond
D 4_GAL Gal(b1-4) C6 A 15 ARG NH2 3.831360 van_der_Waals
One word, four palettes
Every plotting function takes palette, and viscose.set_palette sets one for a whole session.
fig = ramachandran_plot("Gal(b1-4)GlcNAc", palette = "lumen")
Everything in the box
| Retrieve | download_from_glycoshape, get_example_pdb, fetch_pdbs, convert_ID, get_all_clusters_frequency, extract_3D_coordinates |
| Contacts | get_contact_tables, make_atom_contact_table, make_monosaccharide_contact_table, inter_structure_frequency_table, inter_structure_variability_table |
| Surface and flexibility | get_sasa_table, compute_merge_SASA_flexibility, calculate_torsion_flexibility_per_residue |
| Geometry | get_glycosidic_torsions, get_linkage_conformations, get_ring_conformations, get_hydrogen_bonds, analyze_torsion_torsion_correlations |
| Proteins | get_binding_pocket, get_glycan_shielding, get_glycan_protein_interactions, get_glycan_sequences_from_pdb, annotation_pipeline |
| Comparison | superimpose_glycans, get_similar_glycans, find_difference |
| Plots | draw_contact_map, plot_glycan_3D, plot_glycan_score, plot_superimposed_glycans, plot_monosaccharide_instability, ramachandran_plot, show_correlations, show_correlation_dendrogram, make_gif |
| Machine learning | get_all_structure_graphs, create_dataset, train_model, evaluate_model, predict_structure_ensemble, GINSweetNet, VonMisesSweetNet |
The documentation covers each of them, and examples.ipynb and ConformerLearning.ipynb walk through lectin complexes, glycoproteins, and conformer prediction.
Citation
If you use GlyContact in your research, please cite Thomès et al., GlyContact analyzes glycan 3D structures at scale. Nat Commun 16:11136, 2025.
Contributing and license
Contributions are welcome, so please feel free to open a pull request. GlyContact is released under the MIT License, as detailed in the LICENSE file.
Metadata
Release files for glycontact 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| glycontact-0.7.0.tar.gz | 20.2 MB | With provenance | Details for glycontact-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| glycontact-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for glycontact-0.7.0-py3-none-any.whl |
Total release size: 23.4 MB
Release files / glycontact-0.7.0.tar.gz
| Download URL | glycontact-0.7.0.tar.gz |
|---|---|
| Size | 20.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
068e2e79248e6fda08e16f1cc97076da0fe8c33738c3467826560cfa63903243
|
|
BLAKE2b-256 checksum How to use checksums |
e6aecff7beb47b108fb33a6eef08c3587a075f45b3b701bfd5a99b74cc702f7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logRelease files / glycontact-0.7.0-py3-none-any.whl
| Download URL | glycontact-0.7.0-py3-none-any.whl |
|---|---|
| Size | 3.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41aeb39f31ad473e205a236c4979ee3dd33c1fc6b7c8859777224956d9d59356
|
|
BLAKE2b-256 checksum How to use checksums |
898b51c490249ab5b910ff78b6c5237c539f4e5ac3aa0f3f3721f0747b657eaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logSecurity for glycontact 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for glycontact-0.7.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.