ruby-minigraph 0.0.20.0 → 0.0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +38 -6
- data/lib/minigraph/ffi/constants.rb +1 -1
- data/lib/minigraph/ffi/functions.rb +56 -2
- data/lib/minigraph/version.rb +1 -1
- data/lib/minigraph.rb +1 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 934b7b35cb14c887f287dc2544e808861427238fb58ff46ba5b8f6692dc68052
|
4
|
+
data.tar.gz: 05eee8eb22678f9f06aa5cf015fdb12e5d9fadc9292ccf42eeed4efaf8d01035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f708b8f786eba2ac9bfbb6c532e24baf8bd2c062c794de09d76109bab27d9080a5ecad2d7a2307c1edc2a5e6d1ccbdd1cc2efd43c6f0f2b5cc91e5a177e960
|
7
|
+
data.tar.gz: 850538b9318cb51ca6180b081fe0a2004830406965aa87211018c9a421ab0b8d272630b1fb0238c6b3f50851661660fde9e3fd5d5b3a274bce1741511c99e40b
|
data/README.md
CHANGED
@@ -12,7 +12,12 @@
|
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
```sh
|
16
|
+
gem install ruby-minigraph
|
17
|
+
```
|
18
|
+
|
19
|
+
<details>
|
20
|
+
<summary><b>Compiling from source</b></summary>
|
16
21
|
|
17
22
|
```sh
|
18
23
|
git clone --recursive https://github.com/kojix2/ruby-minigraph
|
@@ -22,20 +27,47 @@ bundle exec rake minigraph:build
|
|
22
27
|
bundle exec rake install
|
23
28
|
```
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
```
|
28
|
-
bundle exec rake test
|
29
|
-
```
|
30
|
+
</details>
|
30
31
|
|
31
32
|
## Quick Start
|
32
33
|
|
33
34
|
```ruby
|
34
35
|
require "minigraph"
|
36
|
+
|
37
|
+
Minigraph.execute("--version")
|
35
38
|
```
|
36
39
|
|
37
40
|
## APIs
|
38
41
|
|
42
|
+
Only low-level functions are provided at this time.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require "minigraph"
|
46
|
+
|
47
|
+
MG = Minigraph
|
48
|
+
|
49
|
+
n_threads = 4
|
50
|
+
|
51
|
+
target = "ext/minigraph/test/MT-human.fa"
|
52
|
+
queries = ["ext/minigraph/test/MT-orangeA.fa"]
|
53
|
+
|
54
|
+
opt = MG::FFI::MapOpt.new
|
55
|
+
ipt = MG::FFI::IdxOpt.new
|
56
|
+
gpt = MG::FFI::GGOpt.new
|
57
|
+
|
58
|
+
MG::FFI.mg_opt_set(0, ipt, opt, gpt)
|
59
|
+
|
60
|
+
g = MG::FFI.gfa_read(target)
|
61
|
+
|
62
|
+
ptr = FFI::MemoryPointer.new(:pointer, queries.length)
|
63
|
+
ptrs = queries.map{ FFI::MemoryPointer.from_string(_1) }
|
64
|
+
ptr.write_array_of_pointer(ptrs)
|
65
|
+
|
66
|
+
MG::FFI.mg_map_files(g, 1, ptr, ipt, opt, n_threads)
|
67
|
+
|
68
|
+
MG::FFI.gfa_destroy(g)
|
69
|
+
```
|
70
|
+
|
39
71
|
## Development
|
40
72
|
|
41
73
|
```sh
|
@@ -9,10 +9,22 @@ module Minigraph
|
|
9
9
|
|
10
10
|
# options
|
11
11
|
attach_function \
|
12
|
-
:mg_opt_set,
|
13
|
-
[:
|
12
|
+
:mg_opt_set_raw, :mg_opt_set,
|
13
|
+
[:pointer, IdxOpt.by_ref, MapOpt.by_ref, GGOpt.by_ref],
|
14
14
|
:int
|
15
15
|
|
16
|
+
private_class_method :mg_opt_set_raw
|
17
|
+
|
18
|
+
def self.mg_opt_set(preset, io, mo, go)
|
19
|
+
ptr = case preset
|
20
|
+
when 0, nil
|
21
|
+
::FFI::Pointer.new(:int, 0)
|
22
|
+
else
|
23
|
+
::FFI::MemoryPointer.from_string(preset.to_s)
|
24
|
+
end
|
25
|
+
mg_opt_set_raw(ptr, io, mo, go)
|
26
|
+
end
|
27
|
+
|
16
28
|
attach_function \
|
17
29
|
:mg_opt_check,
|
18
30
|
[IdxOpt.by_ref, MapOpt.by_ref, GGOpt.by_ref],
|
@@ -66,5 +78,47 @@ module Minigraph
|
|
66
78
|
:mg_ggen,
|
67
79
|
[:pointer, :int32, :pointer, IdxOpt.by_ref, MapOpt.by_ref, GGOpt.by_ref, :int], # FIXME: gfa_t
|
68
80
|
:int
|
81
|
+
|
82
|
+
attach_function \
|
83
|
+
:mg_idxopt_init,
|
84
|
+
[IdxOpt.by_ref],
|
85
|
+
:void
|
86
|
+
|
87
|
+
attach_function \
|
88
|
+
:mg_mapopt_init,
|
89
|
+
[MapOpt.by_ref],
|
90
|
+
:void
|
91
|
+
|
92
|
+
attach_function \
|
93
|
+
:mg_ggopt_init,
|
94
|
+
[GGOpt.by_ref],
|
95
|
+
:void
|
96
|
+
|
97
|
+
# gfa.h
|
98
|
+
|
99
|
+
attach_function \
|
100
|
+
:gfa_init,
|
101
|
+
[:void],
|
102
|
+
:pointer # gfa_t *
|
103
|
+
|
104
|
+
attach_function \
|
105
|
+
:gfa_destroy,
|
106
|
+
[:pointer], # gfa_t *
|
107
|
+
:void
|
108
|
+
|
109
|
+
attach_function \
|
110
|
+
:gfa_read,
|
111
|
+
[:string],
|
112
|
+
:pointer # gfa_t *
|
113
|
+
|
114
|
+
attach_function \
|
115
|
+
:gfa_print,
|
116
|
+
%i[pointer pointer int],
|
117
|
+
:void
|
118
|
+
|
119
|
+
attach_function \
|
120
|
+
:gfa_sort_ref_arc,
|
121
|
+
[:pointer], # gfa_t *
|
122
|
+
:void
|
69
123
|
end
|
70
124
|
end
|
data/lib/minigraph/version.rb
CHANGED
data/lib/minigraph.rb
CHANGED
@@ -10,6 +10,7 @@ require_relative "minigraph/version"
|
|
10
10
|
# https://github.com/lh3/minigraph
|
11
11
|
# Li, H., Feng, X. & Chu, C. The design and construction of reference pangenome graphs
|
12
12
|
# with minigraph. Genome Biol 21, 265 (2020). https://doi.org/10.1186
|
13
|
+
|
13
14
|
module Minigraph
|
14
15
|
class Error < StandardError; end
|
15
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-minigraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.20.
|
4
|
+
version: 0.0.20.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -137,7 +137,7 @@ homepage: https://github.com/kojix2/ruby-minigraph
|
|
137
137
|
licenses:
|
138
138
|
- MIT
|
139
139
|
metadata: {}
|
140
|
-
post_install_message:
|
140
|
+
post_install_message:
|
141
141
|
rdoc_options: []
|
142
142
|
require_paths:
|
143
143
|
- lib
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubygems_version: 3.4.10
|
156
|
-
signing_key:
|
156
|
+
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Ruby bindings for minigraph
|
159
159
|
test_files: []
|