Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The align_it and align_it_aa methods now belong to the module "Gotoh". #2

Merged
merged 31 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
540ab39
The align_it and align_it_aa methods now belong to the module "Gotoh".
Oct 24, 2024
9f69098
Added some setup for building a gem containing the Ruby Gotoh bindings.
Oct 25, 2024
c826091
WIP: copying in the cfe_scripts version of _alignment.rb as a startin…
Oct 29, 2024
fe4bc91
WIP: getting files moved into their new places.
Oct 29, 2024
5da3994
Some light refactoring before attempting surgery.
Oct 29, 2024
14716e3
WIP: refactoring in progress.
Oct 30, 2024
e2b64da
WIP: more refactoring in progress.
Oct 31, 2024
cd1bd2f
The gem now builds and can be 'require'd.
Nov 1, 2024
48243b6
Added a stub test file for filling out.
Nov 1, 2024
7456478
Starting to write some of the tests.
Nov 2, 2024
f9253b6
WIP: continuing to add tests.
Nov 6, 2024
6f2bd1b
WIP: more tests written.
Nov 7, 2024
13356f1
WIP: fixing tests. The frame_align tests still don't work.
Nov 9, 2024
2ed9270
First pass of testing is working.
Nov 13, 2024
2d2ce9a
Changed the require statement to hopefully work for both the gem and …
Nov 14, 2024
358479e
WIP: first pass at updating the rakefile. No idea if it works yet.
Nov 14, 2024
77da1d0
Cleaned up the rakefile so that the extension is built before tests run.
Nov 14, 2024
1a1342a
WIP: copied the .gitlab-ci.yml file from the hivdb_algorithm repo.
Nov 14, 2024
a5b9841
WIP: added the CI configuration from the Phylowatch repo as well.
Nov 15, 2024
584a132
WIP: added some basic devcontainer config and a simple Dockerfile bas…
Nov 16, 2024
ef9b8b6
First pass at CI configuration.
Nov 20, 2024
b8782fb
Tweaking CI configuration.
Nov 20, 2024
365fed5
Added more tests for remove_inserts.
Nov 20, 2024
916aecd
Fixed a broken test.
Nov 20, 2024
eec1c92
WIP: some more additions to the CI/CD configuration, and some fixes t…
Nov 21, 2024
0b5767b
Addressed some of David's findings, and added a CD workflow.
Nov 21, 2024
b2ada0f
Forgot to re-add the files that were renamed.
Nov 21, 2024
83e9b8e
Updated the actions to use newer versions after a warning on Github a…
Nov 21, 2024
3d4600c
Fixed a badly-named test, and added a test to check another edge case.
Nov 21, 2024
e75a1d8
Added a step to add the gem as an asset to the release; also streamli…
Nov 21, 2024
577f3a2
Some updates to the README.
Nov 22, 2024
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
31 changes: 31 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ARG UBUNTU_VERSION=20.04

FROM ubuntu:${UBUNTU_VERSION} AS base

LABEL org.opencontainers.image.source=https://github.com/cfe-lab/gotoh
LABEL org.opencontainers.image.description="Gotoh dev container for development and testing"

ARG DEBIAN_FRONTEND=noninteractive

ENV TZ=America/Vancouver \
RUBY_VERSION=2.2.2 \
BUNDLER_VERSION=1.17.3

RUN apt-get -y update &&\
apt-get -y upgrade &&\
apt-get install -y curl gpg

RUN echo "deb http://security.ubuntu.com/ubuntu/ bionic-security main" >> /etc/apt/sources.list &&\
echo "deb http://security.ubuntu.com/ubuntu/ bionic main" >> /etc/apt/sources.list &&\
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 &&\
apt update &&\
apt install -y \
gawk=1:4.1.4+dfsg-1build1

RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \
curl -sSL https://get.rvm.io | bash -s stable && \
usermod -a -G rvm root

RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh && rvm pkg install openssl"
RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh && rvm requirements && rvm install ${RUBY_VERSION} --with-openssl-dir=/usr/local/rvm/usr && rvm --default use ${RUBY_VERSION}"
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "CfE Ubuntu Ruby",

"build": {
"dockerfile": "Dockerfile"
},

"updateContentCommand": "cd /workspaces/gotoh/ruby && bundle install",

"features": {
"ghcr.io/devcontainers/features/git:1": {}
}
}
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Automated Tests

on: ["push"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code from repo
uses: actions/checkout@v3

- name: Log into GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build devcontainer and run tests
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/cfe-lab/gotoh_devcontainer
cacheFrom: ghcr.io/cfe-lab/gotoh_devcontainer
runCmd: cd /workspaces/gotoh/ruby && rake test

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
root_dir: ${{ github.workspace }}
files: ${{ github.workspace }}/ruby/coverage/coverage.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
env/
__pycache__/
.pytest_cache/
.DS_Store
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ to your `requirements.txt` file or similar method.

# Ruby Bindings

The `/ruby` directory contains the directory structure required to build a
gem containing Gotoh's Ruby bindings. This gem, named `gotoh`, contains
a module called `Gotoh` that holds the `align_it` and `align_it_aa` functions.

To build Gotoh's Ruby bindings (which are called "alignment" instead of "gotoh"
for arbitrary historical reasons), you'll need to have the following installed:

Expand All @@ -65,8 +69,23 @@ for arbitrary historical reasons), you'll need to have the following installed:
[RVM](https://rvm.io/) on Linux)
- A C++ compiler

With these installed, you should be able to build the extension module with
The "canonical" environment for building this package is the CfE-internal
`cfe_ubuntu` Ruby image based on Ubuntu 20.04 (this old version is required
to run Ruby 2.2.2).

In your build environment, you should be able to build the extension module
using the `build_gem.bash` script. By default this will make a gem with the
version number `0.1.0.pre`; set the environment variable `GOTOH_VERSION` before
building to assign a proper version number.

## Manually building the Ruby bindings

If you want to manually build the bindings, e.g. for testing/debugging/development,
copy `/ruby/ext/gotoh/extconf.rb` to the `/alignment/gotoh/` directory and
change the `create_makefile('gotoh/gotoh')` line to `create_makefile('gotoh')`;
then run
```
ruby extconf.rb
ruby extconf.rb # generates a Makefile and other supporting files
make
```
which will build `gotoh.so`, which can be `require`d from Ruby.
5 changes: 5 additions & 0 deletions alignment/gotoh/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Makefile
*.so
*.o
extconf.h
build/*
161 changes: 0 additions & 161 deletions alignment/gotoh/Makefile

This file was deleted.

4 changes: 0 additions & 4 deletions alignment/gotoh/extconf.rb

This file was deleted.

8 changes: 4 additions & 4 deletions alignment/gotoh/gotoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,11 @@ void widen_gaps(string* seq)
return ret;
}


extern "C" void Init_alignment()
extern "C" void Init_cfe_gotoh()
{
rb_define_global_function("align_it", (VALUE(*)(...))align_it, 4);
rb_define_global_function("align_it_aa", (VALUE(*)(...))align_it_aa, 4);
VALUE gotoh = rb_define_module("CfeGotoh");
rb_define_module_function(gotoh, "align_it", (VALUE(*)(...))align_it, 4);
rb_define_module_function(gotoh, "align_it_aa", (VALUE(*)(...))align_it_aa, 4);
}

#endif
3 changes: 3 additions & 0 deletions ruby/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.gem
coverage/*
.DS_Store
9 changes: 9 additions & 0 deletions ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source 'https://rubygems.org'
ruby '2.2.2'

# To install all these gems, run "gem install bundler", then "bundle install".

gem 'minitest', '5.15.0'
gem 'minitest-reporters', '1.7.1'
gem 'simplecov', '0.17.1'
gem 'simplecov-cobertura', '1.4.2'
36 changes: 36 additions & 0 deletions ruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
builder (3.3.0)
docile (1.3.5)
json (2.5.1)
minitest (5.15.0)
minitest-reporters (1.7.1)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
ruby-progressbar (1.13.0)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-cobertura (1.4.2)
simplecov (~> 0.8)
simplecov-html (0.10.2)

PLATFORMS
ruby

DEPENDENCIES
minitest (= 5.15.0)
minitest-reporters (= 1.7.1)
simplecov (= 0.17.1)
simplecov-cobertura (= 1.4.2)

RUBY VERSION
ruby 2.2.2p95

BUNDLED WITH
1.17.3
5 changes: 5 additions & 0 deletions ruby/build_gem.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env bash

cp ../alignment/gotoh/gotoh.cpp ext/cfe_gotoh/cfe_gotoh.cpp
gem build cfe_gotoh.gemspec
rm ext/cfe_gotoh/cfe_gotoh.cpp
18 changes: 18 additions & 0 deletions ruby/cfe_gotoh.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Gem::Specification.new do |s|
s.name = "cfe_gotoh"
s.version = ENV['CFE_GOTOH_VERSION'] || '0.1.0.pre'
s.summary = "CfE implementation of the Gotoh sequence alignment algorithm"
s.files = [
'lib/cfe_gotoh.rb',
'ext/cfe_gotoh/cfe_gotoh.cpp'
]
s.extensions = [
'ext/cfe_gotoh/extconf.rb',
]
s.authors = [
"Conan Woods",
"Jamie Kai",
"David Rickett",
"Richard Liang"
]
end
1 change: 1 addition & 0 deletions ruby/ext/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
6 changes: 6 additions & 0 deletions ruby/ext/cfe_gotoh/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cfe_gotoh.cpp
cfe_gotoh.o
cfe_gotoh.so
extconf.h
Makefile
mkmf.log
Loading
Loading