genomer 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,45 @@
1
+ tmp
2
+ *.gem
3
+
4
+ # rcov generated
5
+ coverage
6
+
7
+ # rdoc generated
8
+ rdoc
9
+
10
+ # yard generated
11
+ doc
12
+ .yardoc
13
+
14
+ # bundler
15
+ .bundle
16
+
17
+ # jeweler generated
18
+ pkg
19
+
20
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
21
+ #
22
+ # * Create a file at ~/.gitignore
23
+ # * Include files you want ignored
24
+ # * Run: git config --global core.excludesfile ~/.gitignore
25
+ #
26
+ # After doing this, these files will be ignored in all your git projects,
27
+ # saving you from having to 'pollute' every project you touch with them
28
+ #
29
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
30
+ #
31
+ # For MacOS:
32
+ #
33
+ #.DS_Store
34
+ #
35
+ # For TextMate
36
+ #*.tmproj
37
+ #tmtags
38
+ #
39
+ # For emacs:
40
+ #*~
41
+ #\#*
42
+ #.\#*
43
+ #
44
+ # For vim:
45
+ #*.swp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Michael Barton
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,23 @@
1
+ == Synopsis
2
+
3
+ Genomer is a plugin-based framework for genome finishing. Plugins are installed
4
+ using the RubyGems package management system. Genome files are managed as a
5
+ directory and updated at the command line using the `genomer` command.
6
+
7
+ == Installing
8
+
9
+ Ruby and RubyGems are required to use genomer and related plugins. Genomer is
10
+ installed on the command line using:
11
+
12
+ $ gem install genomer
13
+
14
+ == Contact
15
+
16
+ Genomer is developed by Michael Barton (www.michaelbarton.me.uk). The source
17
+ code is available on github. Bug reports and feature requests should also be
18
+ made there.
19
+
20
+ == Copyright
21
+
22
+ Genomer copyright (c) 2010 by Michael Barton. Scaffolder is licensed under the
23
+ MIT license. See LICENSE.txt for further details.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'rake/dsl_definition'
11
+ require 'rspec/core'
12
+ require 'rspec/core/rake_task'
13
+ require 'cucumber/rake/task'
14
+
15
+ Bundler::GemHelper.install_tasks
16
+
17
+ RSpec::Core::RakeTask.new(:spec) do |spec|
18
+ spec.pattern = FileList['spec/**/*_spec.rb']
19
+ end
20
+
21
+ Cucumber::Rake::Task.new(:features)
22
+
23
+ task :default => :spec
data/bin/genomer ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+
4
+ require 'rubygems'
5
+ require 'configliere'
6
+ require 'genomer'
7
+ require 'ronn'
8
+
9
+ Settings.use :commandline
10
+ Settings.resolve!
11
+
12
+ begin
13
+ STDOUT.puts Genomer::Runtime.new(Settings).execute!
14
+ exit true
15
+ rescue Genomer::Error => e
16
+ STDERR.puts "Error. #{e.message}"
17
+ exit false
18
+ end
data/cucumber.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ default: --format progress --color
@@ -0,0 +1,152 @@
1
+ Feature: Changing annotation IDs
2
+ In order to tailor annotation IDs to specific genomes
3
+ A plugin developer can pass options to the #annotations method
4
+ So that the annotation IDs are correspondingly changed
5
+
6
+ @disable-bundler
7
+ Scenario: Adding a prefix to annotation IDs
8
+ Given I run the genomer command with the arguments "init project"
9
+ And I cd to "project"
10
+ And I append to "Gemfile" with:
11
+ """
12
+ gem 'genomer', :path => '../../../'
13
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
14
+ """
15
+ And I append to "assembly/scaffold.yml" with:
16
+ """
17
+ ---
18
+ -
19
+ sequence:
20
+ source: contig1
21
+
22
+ """
23
+ And I append to "assembly/sequence.fna" with:
24
+ """
25
+ >contig1
26
+ ATGCATGC
27
+ """
28
+ And I append to "assembly/annotations.gff" with:
29
+ """
30
+ ##gff-version 3
31
+ contig1 . gene 1 4 . + 1 ID=gene1
32
+ contig1 . gene 5 8 . + 1 ID=gene2
33
+ """
34
+ When I run the genomer command with the arguments "simple annotations --prefix=pre_"
35
+ Then the exit status should be 0
36
+ And the output should contain:
37
+ """
38
+ ##gff-version 3
39
+ scaffold . gene 1 4 . + 1 ID=pre_gene1
40
+ scaffold . gene 5 8 . + 1 ID=pre_gene2
41
+ """
42
+
43
+ @disable-bundler
44
+ Scenario: Reset locus tag numbering from the sequence start
45
+ Given I run the genomer command with the arguments "init project"
46
+ And I cd to "project"
47
+ And I append to "Gemfile" with:
48
+ """
49
+ gem 'genomer', :path => '../../../'
50
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
51
+ """
52
+ And I append to "assembly/scaffold.yml" with:
53
+ """
54
+ ---
55
+ -
56
+ sequence:
57
+ source: contig1
58
+
59
+ """
60
+ And I append to "assembly/sequence.fna" with:
61
+ """
62
+ >contig1
63
+ ATGCATGC
64
+ """
65
+ And I append to "assembly/annotations.gff" with:
66
+ """
67
+ ##gff-version 3
68
+ contig1 . gene 1 4 . + 1 ID=gene1
69
+ contig1 . gene 5 8 . + 1 ID=gene2
70
+ """
71
+ When I run the genomer command with the arguments "simple annotations --reset_locus_numbering"
72
+ Then the exit status should be 0
73
+ And the output should contain:
74
+ """
75
+ ##gff-version 3
76
+ scaffold . gene 1 4 . + 1 ID=000001
77
+ scaffold . gene 5 8 . + 1 ID=000002
78
+ """
79
+
80
+ @disable-bundler
81
+ Scenario: Reset locus tag numbering with at a specific value
82
+ Given I run the genomer command with the arguments "init project"
83
+ And I cd to "project"
84
+ And I append to "Gemfile" with:
85
+ """
86
+ gem 'genomer', :path => '../../../'
87
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
88
+ """
89
+ And I append to "assembly/scaffold.yml" with:
90
+ """
91
+ ---
92
+ -
93
+ sequence:
94
+ source: contig1
95
+
96
+ """
97
+ And I append to "assembly/sequence.fna" with:
98
+ """
99
+ >contig1
100
+ ATGCATGC
101
+ """
102
+ And I append to "assembly/annotations.gff" with:
103
+ """
104
+ ##gff-version 3
105
+ contig1 . gene 1 4 . + 1 ID=gene1
106
+ contig1 . gene 5 8 . + 1 ID=gene2
107
+ """
108
+ When I run the genomer command with the arguments "simple annotations --reset_locus_numbering=10"
109
+ Then the exit status should be 0
110
+ And the output should contain:
111
+ """
112
+ ##gff-version 3
113
+ scaffold . gene 1 4 . + 1 ID=000010
114
+ scaffold . gene 5 8 . + 1 ID=000011
115
+ """
116
+
117
+ @disable-bundler
118
+ Scenario: Reseting locus tag numbering and adding a prefix
119
+ Given I run the genomer command with the arguments "init project"
120
+ And I cd to "project"
121
+ And I append to "Gemfile" with:
122
+ """
123
+ gem 'genomer', :path => '../../../'
124
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
125
+ """
126
+ And I append to "assembly/scaffold.yml" with:
127
+ """
128
+ ---
129
+ -
130
+ sequence:
131
+ source: contig1
132
+
133
+ """
134
+ And I append to "assembly/sequence.fna" with:
135
+ """
136
+ >contig1
137
+ ATGCATGC
138
+ """
139
+ And I append to "assembly/annotations.gff" with:
140
+ """
141
+ ##gff-version 3
142
+ contig1 . gene 1 4 . + 1 ID=gene1
143
+ contig1 . gene 5 8 . + 1 ID=gene2
144
+ """
145
+ When I run the genomer command with the arguments "simple annotations --reset_locus_numbering --prefix=pre_"
146
+ Then the exit status should be 0
147
+ And the output should contain:
148
+ """
149
+ ##gff-version 3
150
+ scaffold . gene 1 4 . + 1 ID=pre_000001
151
+ scaffold . gene 5 8 . + 1 ID=pre_000002
152
+ """
@@ -0,0 +1,269 @@
1
+ Feature: Accessing scaffold annotations
2
+ In order to access gff annotations in a genomer plugin
3
+ A plugin developer can access annotations from the #annotations method
4
+ So that these annotations are available for use
5
+
6
+ @disable-bundler
7
+ Scenario: Two annotations on a single contig
8
+ Given I run the genomer command with the arguments "init project"
9
+ And I cd to "project"
10
+ And I append to "Gemfile" with:
11
+ """
12
+ gem 'genomer', :path => '../../../'
13
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
14
+ """
15
+ And I append to "assembly/scaffold.yml" with:
16
+ """
17
+ ---
18
+ -
19
+ sequence:
20
+ source: contig1
21
+
22
+ """
23
+ And I append to "assembly/sequence.fna" with:
24
+ """
25
+ >contig1
26
+ ATGCATGC
27
+ """
28
+ And I append to "assembly/annotations.gff" with:
29
+ """
30
+ ##gff-version 3
31
+ contig1 . gene 1 3 . + 1 .
32
+ contig1 . gene 5 7 . + 1 .
33
+ """
34
+ When I run the genomer command with the arguments "simple annotations"
35
+ Then the exit status should be 0
36
+ And the output should contain:
37
+ """
38
+ ##gff-version 3
39
+ scaffold . gene 1 3 . + 1 .
40
+ scaffold . gene 5 7 . + 1 .
41
+ """
42
+
43
+ @disable-bundler
44
+ Scenario: Two annotations on a two contigs
45
+ Given I run the genomer command with the arguments "init project"
46
+ And I cd to "project"
47
+ And I append to "Gemfile" with:
48
+ """
49
+ gem 'genomer', :path => '../../../'
50
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
51
+ """
52
+ And I append to "assembly/scaffold.yml" with:
53
+ """
54
+ ---
55
+ -
56
+ sequence:
57
+ source: contig1
58
+ -
59
+ sequence:
60
+ source: contig2
61
+
62
+ """
63
+ And I append to "assembly/sequence.fna" with:
64
+ """
65
+ >contig1
66
+ ATGCATGC
67
+ >contig2
68
+ ATGCATGC
69
+ """
70
+ And I append to "assembly/annotations.gff" with:
71
+ """
72
+ ##gff-version 3
73
+ contig1 . gene 1 3 . + 1 .
74
+ contig2 . gene 5 7 . + 1 .
75
+ """
76
+ When I run the genomer command with the arguments "simple annotations"
77
+ Then the exit status should be 0
78
+ And the output should contain:
79
+ """
80
+ ##gff-version 3
81
+ scaffold . gene 1 3 . + 1 .
82
+ scaffold . gene 13 15 . + 1 .
83
+ """
84
+
85
+ @disable-bundler
86
+ Scenario: Two annotations on a single contig with an unused annotation
87
+ Given I run the genomer command with the arguments "init project"
88
+ And I cd to "project"
89
+ And I append to "Gemfile" with:
90
+ """
91
+ gem 'genomer', :path => '../../../'
92
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
93
+ """
94
+ And I append to "assembly/scaffold.yml" with:
95
+ """
96
+ ---
97
+ -
98
+ sequence:
99
+ source: contig1
100
+
101
+ """
102
+ And I append to "assembly/sequence.fna" with:
103
+ """
104
+ >contig1
105
+ ATGCATGC
106
+ """
107
+ And I append to "assembly/annotations.gff" with:
108
+ """
109
+ ##gff-version 3
110
+ contig2 . gene 5 7 . + 1 .
111
+ contig1 . gene 1 3 . + 1 .
112
+ contig1 . gene 5 7 . + 1 .
113
+ """
114
+ When I run the genomer command with the arguments "simple annotations"
115
+ Then the exit status should be 0
116
+ And the output should contain:
117
+ """
118
+ ##gff-version 3
119
+ scaffold . gene 1 3 . + 1 .
120
+ scaffold . gene 5 7 . + 1 .
121
+ """
122
+
123
+ @disable-bundler
124
+ Scenario: Three unordered annotations on a single contig
125
+ Given I run the genomer command with the arguments "init project"
126
+ And I cd to "project"
127
+ And I append to "Gemfile" with:
128
+ """
129
+ gem 'genomer', :path => '../../../'
130
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
131
+ """
132
+ And I append to "assembly/scaffold.yml" with:
133
+ """
134
+ ---
135
+ -
136
+ sequence:
137
+ source: contig1
138
+
139
+ """
140
+ And I append to "assembly/sequence.fna" with:
141
+ """
142
+ >contig1
143
+ ATGCATGCATGC
144
+ """
145
+ And I append to "assembly/annotations.gff" with:
146
+ """
147
+ ##gff-version 3
148
+ contig1 . gene 9 11 . + 1 .
149
+ contig1 . gene 1 3 . + 1 .
150
+ contig1 . gene 5 7 . + 1 .
151
+ """
152
+ When I run the genomer command with the arguments "simple annotations"
153
+ Then the exit status should be 0
154
+ And the output should contain:
155
+ """
156
+ ##gff-version 3
157
+ scaffold . gene 1 3 . + 1 .
158
+ scaffold . gene 5 7 . + 1 .
159
+ scaffold . gene 9 11 . + 1 .
160
+ """
161
+
162
+ @disable-bundler
163
+ Scenario: Four unordered annotations on a two contigs
164
+ Given I run the genomer command with the arguments "init project"
165
+ And I cd to "project"
166
+ And I append to "Gemfile" with:
167
+ """
168
+ gem 'genomer', :path => '../../../'
169
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
170
+ """
171
+ And I append to "assembly/scaffold.yml" with:
172
+ """
173
+ ---
174
+ -
175
+ sequence:
176
+ source: contig1
177
+ -
178
+ sequence:
179
+ source: contig2
180
+
181
+ """
182
+ And I append to "assembly/sequence.fna" with:
183
+ """
184
+ >contig1
185
+ ATGCATGC
186
+ >contig2
187
+ ATGCATGC
188
+ """
189
+ And I append to "assembly/annotations.gff" with:
190
+ """
191
+ ##gff-version 3
192
+ contig2 . gene 5 7 . + 1 .
193
+ contig2 . gene 1 3 . + 1 .
194
+ contig1 . gene 1 3 . + 1 .
195
+ contig1 . gene 5 7 . + 1 .
196
+ """
197
+ When I run the genomer command with the arguments "simple annotations"
198
+ Then the exit status should be 0
199
+ And the output should contain:
200
+ """
201
+ ##gff-version 3
202
+ scaffold . gene 1 3 . + 1 .
203
+ scaffold . gene 5 7 . + 1 .
204
+ scaffold . gene 9 11 . + 1 .
205
+ scaffold . gene 13 15 . + 1 .
206
+
207
+ """
208
+
209
+ @disable-bundler
210
+ Scenario: Annotations on reversed and trimmed contigs with inserts
211
+ Given I run the genomer command with the arguments "init project"
212
+ And I cd to "project"
213
+ And I append to "Gemfile" with:
214
+ """
215
+ gem 'genomer', :path => '../../../'
216
+ gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
217
+ """
218
+ And I append to "assembly/scaffold.yml" with:
219
+ """
220
+ ---
221
+ - sequence:
222
+ source: contig1
223
+ stop: 6
224
+ - sequence:
225
+ source: contig2
226
+ reverse: true
227
+ inserts:
228
+ -
229
+ source: insert1
230
+ open: 6
231
+ close: 7
232
+ - sequence:
233
+ source: contig3
234
+ start: 3
235
+
236
+ """
237
+ And I append to "assembly/sequence.fna" with:
238
+ """
239
+ > contig1
240
+ AAAAAGGG
241
+ > contig2
242
+ AAAAAGGGGGC
243
+ > contig3
244
+ AAAAAGGG
245
+ > insert1
246
+ TTT
247
+ """
248
+ And I append to "assembly/annotations.gff" with:
249
+ """
250
+ ##gff-version 3
251
+ contig1 . gene 1 4 . + 1 ID=gene1
252
+ contig1 . gene 5 8 . + 1 ID=gene2
253
+ contig2 . gene 1 4 . + 1 ID=gene3
254
+ contig2 . gene 8 11 . + 1 ID=gene4
255
+ contig3 . gene 1 3 . + 1 ID=gene5
256
+ contig3 . gene 4 8 . + 1 ID=gene6
257
+
258
+ """
259
+ When I run the genomer command with the arguments "simple annotations"
260
+ Then the exit status should be 0
261
+ And the output should contain:
262
+ """
263
+ ##gff-version 3
264
+ scaffold . gene 1 4 . + 1 ID=gene1
265
+ scaffold . gene 7 10 . - 1 ID=gene4
266
+ scaffold . gene 15 18 . - 1 ID=gene3
267
+ scaffold . gene 20 24 . + 1 ID=gene6
268
+
269
+ """