44
55** A comprehensive Go implementation of the EnzymeML data exchange format for enzymatic data**
66
7- [ ![ Go Version] ( https://img.shields.io/badge/Go-1.19 +-00ADD8?style=flat-square&logo=go )] ( https://golang.org/ )
7+ [ ![ Go Version] ( https://img.shields.io/badge/Go-1.25 +-00ADD8?style=flat-square&logo=go )] ( https://golang.org/ )
88[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square )] ( https://opensource.org/licenses/MIT )
99
1010---
2222 - [ Requirements] ( #requirements )
2323 - [ 📖 Usage] ( #-usage )
2424 - [ Quick Start] ( #quick-start )
25+ - [ 🌐 Start v2 REST API] ( #-start-v2-rest-api )
2526 - [ 🗄️ Database Example] ( #️-database-example )
2627 - [ 🤝 Contributing] ( #-contributing )
2728 - [ 📄 License] ( #-license )
@@ -50,12 +51,12 @@ EnzymeML Go implements the complete **EnzymeML v2 specification**, providing you
5051Get started with EnzymeML Go in seconds:
5152
5253``` bash
53- go get github.com/enzymeml-go
54+ go get github.com/EnzymeML/ enzymeml-go
5455```
5556
5657### Requirements
5758
58- - ** Go 1.19 +** - Ensure you have a recent version of Go installed
59+ - ** Go 1.25 +** - Ensure you have a recent version of Go installed
5960- ** Modern Go modules** - This package uses Go modules for dependency management
6061
6162## 📖 Usage
@@ -67,28 +68,112 @@ package main
6768
6869import (
6970 " fmt"
70- " github.com/enzymeml-go"
71+ enzymeml_v2 " github.com/EnzymeML/ enzymeml-go/src "
7172)
7273
7374func main () {
74- // Your EnzymeML Go code here
75- fmt.Println (" Welcome to EnzymeML Go! " )
75+ doc := enzymeml_v2. EnzymeMLDocument {Name: " Example " }
76+ fmt.Println (doc. Name )
7677}
7778```
7879
80+ ### 🌐 Start v2 REST API
81+
82+ Create a ` main.go ` :
83+
84+ ``` go
85+ package main
86+
87+ import (
88+ " log"
89+ " net/http"
90+
91+ apiv2 " github.com/EnzymeML/enzymeml-go/src/api/v2"
92+ enzymeml_v2 " github.com/EnzymeML/enzymeml-go/src"
93+ database " github.com/EnzymeML/enzymeml-go/src/database/v2"
94+ )
95+
96+ func main () {
97+ models := []interface {}{
98+ &enzymeml_v2.EnzymeMLDocument {},
99+ &enzymeml_v2.Creator {},
100+ &enzymeml_v2.Vessel {},
101+ &enzymeml_v2.Protein {},
102+ &enzymeml_v2.Complex {},
103+ &enzymeml_v2.SmallMolecule {},
104+ &enzymeml_v2.Reaction {},
105+ &enzymeml_v2.ReactionElement {},
106+ &enzymeml_v2.ModifierElement {},
107+ &enzymeml_v2.Equation {},
108+ &enzymeml_v2.Variable {},
109+ &enzymeml_v2.Parameter {},
110+ &enzymeml_v2.Measurement {},
111+ &enzymeml_v2.MeasurementData {},
112+ &enzymeml_v2.UnitDefinition {},
113+ &enzymeml_v2.BaseUnit {},
114+ }
115+
116+ dbManager , err := database.NewDBManager (" enzymeml.db" , models)
117+ if err != nil {
118+ log.Fatalf (" failed to init DB: %v " , err)
119+ }
120+ defer dbManager.Close ()
121+
122+ handler , err := apiv2.NewHandler (dbManager)
123+ if err != nil {
124+ log.Fatalf (" failed to build API handler: %v " , err)
125+ }
126+
127+ log.Println (" v2 API listening on :8080" )
128+ log.Fatal (http.ListenAndServe (" :8080" , handler))
129+ }
130+ ```
131+
132+ Run:
133+
134+ ``` bash
135+ go run .
136+ ```
137+
138+ Example CRUD for documents:
139+
140+ ``` bash
141+ curl -X POST http://localhost:8080/v2/documents \
142+ -H " Content-Type: application/json" \
143+ -d ' {"name":"my-doc","version":"2.0.0"}'
144+
145+ curl http://localhost:8080/v2/documents
146+ curl http://localhost:8080/v2/documents/1
147+
148+ curl -X PUT http://localhost:8080/v2/documents/1 \
149+ -H " Content-Type: application/json" \
150+ -d ' {"name":"my-doc-updated","version":"2.0.1"}'
151+
152+ curl -X DELETE http://localhost:8080/v2/documents/1
153+ ```
154+
155+ The API exposes CRUD for all v2 resources under ` /v2 ` :
156+ ` documents ` , ` creators ` , ` vessels ` , ` proteins ` , ` complexes ` , ` small-molecules ` , ` reactions ` , ` reaction-elements ` , ` modifier-elements ` , ` equations ` , ` variables ` , ` parameters ` , ` measurements ` , ` measurement-data ` , ` unit-definitions ` , ` base-units ` .
157+
158+ With Huma, docs/spec are available automatically:
159+
160+ - ` http://localhost:8080/v2/docs `
161+ - ` http://localhost:8080/v2/openapi.json `
162+ - ` http://localhost:8080/v2/openapi.yaml `
163+
79164### 🗄️ Database Example
80165
81166For a comprehensive example of how to use EnzymeML Go to create an enzymatic data database and power web applications, check out our detailed example:
82167
83168** 👉 [ Database Example] ( ./examples/database_example/ ) **
84169
85170This example demonstrates:
171+
86172- Setting up an EnzymeML-compliant database
87173- Storing and retrieving enzymatic data
88174- Web application integration
89175- Best practices for data management
90176
91-
92177## 🤝 Contributing
93178
94179We welcome contributions from the community! Please feel free to submit a pull request.
@@ -101,4 +186,4 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE)
101186
102187<div align =" center " >
103188<strong >Made with ❤️ by the EnzymeML Team</strong >
104- </div >
189+ </div >
0 commit comments