https://github.com/kojix2/ruby-edlib
ruby-edlib is a wrapper for edlib
https://github.com/kojix2/ruby-edlib
bioinformatics edlib ruby
Last synced: about 1 year ago
JSON representation
ruby-edlib is a wrapper for edlib
- Host: GitHub
- URL: https://github.com/kojix2/ruby-edlib
- Owner: kojix2
- License: other
- Created: 2022-10-29T18:32:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-17T03:35:49.000Z (over 1 year ago)
- Last Synced: 2025-03-27T13:51:23.807Z (over 1 year ago)
- Topics: bioinformatics, edlib, ruby
- Language: C++
- Homepage: https://kojix2.github.io/ruby-edlib/
- Size: 155 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ruby-edlib
[](https://badge.fury.io/rb/edlib)
[](https://github.com/kojix2/ruby-edlib/actions/workflows/ci.yml)
[](https://zenodo.org/badge/latestdoi/559318048)
[Edlib](https://github.com/Martinsos/edlib) - A lightweight and super fast C/C++ library for sequence alignment using edit distance
## Installation
```
gem install edlib
```
The Gem compiles the edlib source code inside the gem at installation. If you want to use the latest edlib, see Development.
## Usage
```ruby
require "edlib"
a = Edlib::Aligner.new(mode: :hw, task: :path)
a.align("AACG", "TCAACCTG")
# {
# :edit_distance => 1,
# :alphabet_length => 4,
# :locations => [[2, 4], [2, 5]],
# :alignment => [0, 0, 0, 1],
# :cigar => "3=1I"
# }
```
|keyword argument |description|
|---------------------|-----------------------------------------------------------------------------|
|k |edit distance is not larger than k [-1] |
|mode |global (NW) , prefix (SHW) , infix (HW) ["NW"] |
|task |DISTANCE, LOC, PATH ["DISTANCE"] |
|additional_equalities|List of pairs of characters, where each pair defines two characters as equal. [NULL]|
```ruby
a.align("AACG", "TCAACCTG", nice: true)
# {
# :edit_distance=>1,
# :alphabet_length=>4,
# :locations=>[[2, 4], [2, 5]],
# :alignment=>[0, 0, 0, 1],
# :cigar=>"3=1I",
# :query_aligned=>"AACG",
# :match_aligned=>"|||-",
# :target_aligned=>"AAC-"
# }
```
## Documentation
https://kojix2.github.io/ruby-edlib/
## Development
Pull requests welcome!
```sh
git clone https://github.com/kojix2/ruby-edlib # Please fork repo
cd ruby-edlib
bundle install
bundle exec rake compile
bundle exec rake test
```
Use latest edlib
```sh
git clone https://github.com/kojix2/ruby-edlib
cd ruby-edlib
bundle install
bundle exec rake edlib:update # Download latest edlib.h and edlib.cpp
bundle exec rake compile
bundle exec rake test
```