How glycoinfo/glycanformatconverter works
Project Type and Purpose
• This is a Java-based, Maven-packaged core library (GlycanFormatConverter) for converting glycan text representations between multiple formats. It also provides CLI entry points and a companion WURCSFramework module.
• It is not a full-stack web app but an API/library (with a command-line client) that can be embedded in other systems or called via the published REST API or CLI.
File-Structure Analysis
• Top-level files: pom.xml (build descriptor), README, CHANGELOG, LICENSE, .gitlab-ci.yml (CI pipeline).
• src/main/java/org/glycoinfo/GlycanFormatconverter:
• Glycan: domain model classes (GlycanGraph, Monosaccharide, Linkage, etc.).
• exec: command-line entry-point classes for each conversion mode (e.g., execConverterWithWURCS).
• io: importer/exporter interfaces and implementations for each format (GlycoCT, IUPAC, JSON, KCF, LinearCode, WURCS).
• util: shared utilities (traversers, validators, analyzers, graph exchangers).
• src/main/java/org/glycoinfo/WURCSFramework: a separate package providing low-level WURCS I/O and utilities.
• src/test: comprehensive unit and integration tests exercising each format converter, exchange path, and validator.
Key README Insights
• Java 8+, Maven 3.6+
• Provides both an API library and a CLI client.
• Published to Maven Central and exposed via a REST API.
• Restriction notes and publication reference.
a. Core Domain Layer
– Domain model (org.glycoinfo.GlycanFormatconverter.Glycan).
– Conversion engine that builds or consumes GlycanGraph objects.
b. Adapter Layer (I/O)
– Importers and exporters for each format.
– Implements ExporterInterface/ImporterInterface.
c. Utility Layer
– Validators, analyzers, traversers, comparators, graph exchangers (e.g., GlyContainerToWURCSGraph).
d. CLI Module
– exec package entry points, each class invoking the core + adapter + util layers.
e. WURCSFramework Submodule
– Stand-alone I/O and utility classes supporting WURCS format.
f. Build & Publication
– Maven POM, CI pipeline, deployment to Maven Central, REST API service (external).
Relationships & Interactions
• CLI entry classes (exec) depend on the Adapter and Core layers.
• Adapter implementations invoke Core Domain services and may call Utility classes for validation or graph transformations.
• Core Domain may leverage WURCSFramework utilities when performing WURCS-specific conversions.
• Utilities (validators, analyzers) are shared across adapters to enforce format rules.
• Packaging layer (Maven) bundles all modules into a JAR published to Central; client or REST service consumes the JAR.
Architectural Patterns & Principles
• Layered architecture: Domain → Adapter → CLI
• Strategy/Factory patterns for selecting importers/exporters by format.
• Visitor pattern in traversers and validators (Visitable/Visitor).
• Separation of concerns: model, I/O, utilities, presentation (CLI).