Skip to main content

glycorender Logo

glycorender

A bespoke SVG to PDF/PNG renderer for the GlycoDraw platform, specialized in accurately rendering glycan structures with support for chemical notations and path-based text positioning.

PyPI version Python Version License

Features

  • Accurate SVG to PDF and PNG conversion for glycan structures
  • Support for text on paths with proper positioning and orientation
  • Special handling for monosaccharide properties like "Df" with proper styling
  • Gradient fills for circles and shapes
  • Precise connection path rendering between glycan elements
  • Support for various SVG path commands

Installation

pip install glycorender

Quick Start

from glycorender import convert_svg_to_pdf, convert_svg_to_png

# Convert SVG file to PDF
with open('glycan_structure.svg', 'r') as f:
    svg_data = f.read()
    
convert_svg_to_pdf(svg_data, 'output.pdf')

# Convert SVG file to PNG
convert_svg_to_png(svg_data, 'output.png')

# Or directly from SVG data
svg_data = """..."""
convert_svg_to_pdf(svg_data, 'output.pdf')
convert_svg_to_png(svg_data, 'output.png')

Use Cases

GlycoRender is specifically designed for:

  • Converting glycan structure diagrams from GlycoDraw to publication-quality PDFs or PNGs
  • Preserving the exact layout and styling of complex carbohydrate representations
  • Ensuring chemical notations are properly formatted in the output
  • Maintaining the correct connections between monosaccharide units

API Reference

convert_svg_to_pdf(svg_data, pdf_file_path)

convert_svg_to_png(svg_data, png_file_path)

Converts SVG data to a PDF/PNG file.

Parameters:

  • svg_data (str or bytes): SVG content either as a string or bytes
  • png_file_path (str): Path where the output PNG should be saved

Supported SVG Elements

  • <path>: Full support for path commands (M, L, H, V, Z, etc.)
  • <circle>: Support for basic circles and gradient-filled circles
  • <rect>: Support for rectangles with stroke and fill
  • <text> and <textPath>: Support for text placement along paths with proper orientation
  • <defs>: Support for path and gradient definitions
  • <radialGradient>: Support for radial gradients with stops

Dependencies

  • numpy

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glycorender-0.4.0.tar.gz (148.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glycorender-0.4.0-py3-none-any.whl (148.5 kB view details)

Uploaded Python 3

File details

Details for the file glycorender-0.4.0.tar.gz.

File metadata

  • Download URL: glycorender-0.4.0.tar.gz
  • Upload date:
  • Size: 148.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for glycorender-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9ac225e10fca60bb62eb380760b9969d7e1e324a3e598fc8e273c28096c0d294
MD5 29ef3809193219f320f6876eba98969b
BLAKE2b-256 fef2f848f8ef4d348ddaed7c99965669b58cfb5124915ed37bb11b9d6593ae0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for glycorender-0.4.0.tar.gz:

Publisher: python-publish.yml on BojarLab/glycorender

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file glycorender-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: glycorender-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 148.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for glycorender-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 477bdb8f42c828b50e93cff50f7ac5daee7b3b60288d7b862cb5bea26529c4d3
MD5 43dfa878741446bdbf2000bed415d493
BLAKE2b-256 863bddd8f67c142992e8cf04193c979b139d0ba69819fd420e76048d4f92d306

See more details on using hashes here.

Provenance

The following attestation bundles were made for glycorender-0.4.0-py3-none-any.whl:

Publisher: python-publish.yml on BojarLab/glycorender

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page