Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: CI

on:
push:
branches: [ library-api, GoogleImport, master ]
pull_request:
branches: [ library-api, GoogleImport, master ]

jobs:

# ── Linux ──────────────────────────────────────────────────────────────────
linux:
runs-on: ubuntu-latest
strategy:
matrix:
cc: [gcc, clang]
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev

- name: Build CLI + library
run: make CC=${{ matrix.cc }}

- name: Build static library
run: make libprodigal.a CC=${{ matrix.cc }}

- name: Build and run tests
run: make test CC=${{ matrix.cc }}

- name: Regression - metagenomic GFF
run: |
./prodigal -i anthus_aco.fas -p meta -f gff -q -o /tmp/meta.gff
diff testdata/ground_truth/ref_meta.gff /tmp/meta.gff

- name: Regression - metagenomic GBK
run: |
./prodigal -i anthus_aco.fas -p meta -f gbk -q -o /tmp/meta.gbk
diff testdata/ground_truth/ref_meta.gbk /tmp/meta.gbk

- name: Regression - metagenomic SCO
run: |
./prodigal -i anthus_aco.fas -p meta -f sco -q -o /tmp/meta.sco
diff testdata/ground_truth/ref_meta.sco /tmp/meta.sco

- name: Regression - metagenomic proteins
run: |
./prodigal -i anthus_aco.fas -p meta -f gff -q -o /dev/null \
-a /tmp/meta.proteins
diff testdata/ground_truth/ref_meta.proteins /tmp/meta.proteins

- name: Regression - metagenomic nucleotides
run: |
./prodigal -i anthus_aco.fas -p meta -f gff -q -o /dev/null \
-d /tmp/meta.nucl
diff testdata/ground_truth/ref_meta.nucl /tmp/meta.nucl

- name: Regression - single genome GFF
run: |
./prodigal -i anthus_aco.fas -p single -f gff -q -o /tmp/single.gff
diff testdata/ground_truth/ref_single.gff /tmp/single.gff

- name: Regression - training file round-trip
run: |
./prodigal -i anthus_aco.fas -t /tmp/train.bin -q
diff testdata/ground_truth/ref_train.bin /tmp/train.bin
./prodigal -i anthus_aco.fas -t /tmp/train.bin -f gff -q \
-o /tmp/trained.gff
diff testdata/ground_truth/ref_trained.gff /tmp/trained.gff

# ── macOS ──────────────────────────────────────────────────────────────────
# Reference binaries were generated on Linux x86_64. struct _training has
# different padding on ARM64, so training-file comparisons use self-
# consistent round-trips rather than cross-platform reference files.
# Text output (GFF, GBK, etc.) is architecture-independent.
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Build CLI + library
run: make

- name: Build and run tests
run: make test

- name: Regression - metagenomic GFF
run: |
./prodigal -i anthus_aco.fas -p meta -f gff -q -o /tmp/meta.gff
diff testdata/ground_truth/ref_meta.gff /tmp/meta.gff

- name: Regression - single genome GFF
run: |
./prodigal -i anthus_aco.fas -p single -f gff -q -o /tmp/single.gff
diff testdata/ground_truth/ref_single.gff /tmp/single.gff

- name: Regression - training file round-trip (self-consistent)
run: |
./prodigal -i anthus_aco.fas -t /tmp/train1.bin -q
./prodigal -i anthus_aco.fas -t /tmp/train1.bin -f gff -q \
-o /tmp/trained1.gff
./prodigal -i anthus_aco.fas -t /tmp/train2.bin -q
diff /tmp/train1.bin /tmp/train2.bin
./prodigal -i anthus_aco.fas -t /tmp/train2.bin -f gff -q \
-o /tmp/trained2.gff
diff /tmp/trained1.gff /tmp/trained2.gff

# ── WASM (library only, via Emscripten) ────────────────────────────────────
wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14

- name: Build library with emcc
run: |
CORE="bitmap.c dprog.c gene.c metagenomic.c node.c sequence.c training.c prodigal_api.c"
emcc -O3 -Wall -DPRODIGAL_NO_MAIN -c $CORE
emar rcs libprodigal.a *.o
echo "WASM library build succeeded"

- name: Build and run test suite in Node.js
run: |
CORE="bitmap.c dprog.c gene.c metagenomic.c node.c sequence.c training.c prodigal_api.c"
emcc -O3 -Wall -DPRODIGAL_NO_MAIN $CORE test_api.c -o test_api.js \
-s ALLOW_MEMORY_GROWTH=1 \
-s INITIAL_MEMORY=134217728 \
-lm
node test_api.js

# ── Windows (MSYS2/MinGW-w64) ─────────────────────────────────────────────
windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4

- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: mingw-w64-ucrt-x86_64-gcc make mingw-w64-ucrt-x86_64-zlib diffutils

- name: Build CLI + library
run: make

- name: Build and run tests
run: make test

- name: Regression - metagenomic GFF (determinism)
run: |
./prodigal -i anthus_aco.fas -p meta -f gff -q -o /tmp/meta1.gff
./prodigal -i anthus_aco.fas -p meta -f gff -q -o /tmp/meta2.gff
diff /tmp/meta1.gff /tmp/meta2.gff
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
*.o
*.pic.o
prodigal
prodigal_native
libprodigal.a
libprodigal.so
test_api
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
VERSION 2.6.4

* Added a reentrant embeddable API
* Added basic CI testing (Linux, macOS, Windows, WASM)

VERSION 2.6.3

* Fixed a bug in protein translation output of partial genes where TTG/GTG
Expand Down
66 changes: 53 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,73 @@ CFLAGS += -pedantic -Wall -O3 -DSUPPORT_GZIP_COMPRESSED
LFLAGS = -lm $(LDFLAGS) -lz

TARGET = prodigal
ZTARGET = zprodigal
SOURCES = $(shell echo *.c)
INSTALLDIR = /usr/local/bin

# Source file groups
CORE_SOURCES = bitmap.c dprog.c gene.c metagenomic.c node.c sequence.c training.c
API_SOURCES = prodigal_api.c
CLI_SOURCE = main.c
TEST_SOURCE = test_api.c

HEADERS = $(shell echo *.h)
OBJECTS = $(SOURCES:.c=.o)
ZOBJECTS = $(SOURCES:.c=.oz)

INSTALLDIR = /usr/local/bin
# CLI objects (no PRODIGAL_NO_MAIN)
CLI_OBJ = $(CLI_SOURCE:.c=.o)
CLI_CORE_OBJS = $(CORE_SOURCES:.c=.o)
CLI_API_OBJ = $(API_SOURCES:.c=.o)

all: $(TARGET)
# Library objects (with PRODIGAL_NO_MAIN to suppress stderr writes)
LIB_CORE_OBJS = $(CORE_SOURCES:.c=.lib.o)
LIB_API_OBJ = $(API_SOURCES:.c=.lib.o)
LIB_OBJS = $(LIB_CORE_OBJS) $(LIB_API_OBJ)

$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS)
# Default: build CLI binary
all: $(TARGET)

# CLI objects: compiled WITHOUT PRODIGAL_NO_MAIN
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c -o $@ $<

# Library objects: compiled WITH PRODIGAL_NO_MAIN (suppresses stderr in core)
%.lib.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -DPRODIGAL_NO_MAIN -c -o $@ $<

# Static library
libprodigal.a: $(LIB_OBJS)
ar rcs $@ $^

# CLI binary: link CLI main.o + core objects (not using lib to keep stderr)
$(TARGET): $(CLI_OBJ) $(CLI_CORE_OBJS) $(CLI_API_OBJ)
$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS)

# PIC objects for shared library
%.pic.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -fPIC -DPRODIGAL_NO_MAIN -c -o $@ $<

LIB_PIC_OBJS = $(CORE_SOURCES:.c=.pic.o) $(API_SOURCES:.c=.pic.o)

# Shared library
libprodigal.so: $(LIB_PIC_OBJS)
$(CC) -shared -o $@ $^ -lm

# Test runner (linked against static library)
test_api: $(TEST_SOURCE) libprodigal.a
$(CC) $(CFLAGS) -DPRODIGAL_NO_MAIN -o $@ $< -L. -lprodigal $(LFLAGS)

test: test_api
./test_api

install: $(TARGET)
install -d -m 0755 $(INSTALLDIR)
install -m 0755 $(TARGET) $(INSTALLDIR)

uninstall:
-rm $(INSTALLDIR)/$(TARGET)

clean:
-rm -f $(OBJECTS) $(ZOBJECTS)
-rm -f *.o *.lib.o *.pic.o

distclean: clean
-rm -f $(TARGET)
-rm -f $(TARGET) libprodigal.a libprodigal.so test_api

.PHONY: all install uninstall clean distclean
.PHONY: all install uninstall clean distclean test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ prodigal -i my.metagenome.fna -o my.genes -a my.proteins.faa -p meta
prodigal -h
```

### New in 2.6.4 (April 2026)
* Reentrant API created

### New in 2.6.3 (February 2016)
* Fixed a bug in protein translation output of partial genes where TTG/GTG
codons were being incorrectly translated to methionine.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.6.3: February 2016
v2.6.4: April 2026
2 changes: 2 additions & 0 deletions gene.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ int add_genes(struct _gene *glist, struct _node *nod, int dbeg) {
}
path = nod[path].tracef;
if(ctr == MAX_GENES) {
#ifndef PRODIGAL_NO_MAIN
fprintf(stderr, "warning, max # of genes exceeded, truncating...\n");
#endif
return ctr;
}
}
Expand Down
Loading