genomer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/features/api/annotation_ids.feature +16 -16
- data/features/api/annotation_location.feature +24 -24
- data/features/cli/error.feature +0 -1
- data/features/cli/help.feature +1 -1
- data/features/cli/init.feature +69 -0
- data/features/cli/man.feature +4 -4
- data/features/cli/plugins.feature +2 -2
- data/lib/genomer/files.rb +51 -0
- data/lib/genomer/runtime.rb +16 -3
- data/lib/genomer/version.rb +1 -1
- data/spec/genomer/runtime_spec.rb +54 -0
- metadata +5 -5
- data/features/api/scaffold.feature +0 -38
- data/features/cli/create.feature +0 -19
@@ -7,12 +7,12 @@ Feature: Changing annotation IDs
|
|
7
7
|
Scenario: Adding a prefix to annotation IDs
|
8
8
|
Given I run the genomer command with the arguments "init project"
|
9
9
|
And I cd to "project"
|
10
|
-
And I
|
10
|
+
And I overwrite "Gemfile" with:
|
11
11
|
"""
|
12
12
|
gem 'genomer', :path => '../../../'
|
13
13
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
14
14
|
"""
|
15
|
-
And I
|
15
|
+
And I overwrite "assembly/scaffold.yml" with:
|
16
16
|
"""
|
17
17
|
---
|
18
18
|
-
|
@@ -20,12 +20,12 @@ Feature: Changing annotation IDs
|
|
20
20
|
source: contig1
|
21
21
|
|
22
22
|
"""
|
23
|
-
And I
|
23
|
+
And I overwrite "assembly/sequence.fna" with:
|
24
24
|
"""
|
25
25
|
>contig1
|
26
26
|
ATGCATGC
|
27
27
|
"""
|
28
|
-
And I
|
28
|
+
And I overwrite "assembly/annotations.gff" with:
|
29
29
|
"""
|
30
30
|
##gff-version 3
|
31
31
|
contig1 . gene 1 4 . + 1 ID=gene1
|
@@ -44,12 +44,12 @@ Feature: Changing annotation IDs
|
|
44
44
|
Scenario: Reset locus tag numbering from the sequence start
|
45
45
|
Given I run the genomer command with the arguments "init project"
|
46
46
|
And I cd to "project"
|
47
|
-
And I
|
47
|
+
And I overwrite "Gemfile" with:
|
48
48
|
"""
|
49
49
|
gem 'genomer', :path => '../../../'
|
50
50
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
51
51
|
"""
|
52
|
-
And I
|
52
|
+
And I overwrite "assembly/scaffold.yml" with:
|
53
53
|
"""
|
54
54
|
---
|
55
55
|
-
|
@@ -57,12 +57,12 @@ Feature: Changing annotation IDs
|
|
57
57
|
source: contig1
|
58
58
|
|
59
59
|
"""
|
60
|
-
And I
|
60
|
+
And I overwrite "assembly/sequence.fna" with:
|
61
61
|
"""
|
62
62
|
>contig1
|
63
63
|
ATGCATGC
|
64
64
|
"""
|
65
|
-
And I
|
65
|
+
And I overwrite "assembly/annotations.gff" with:
|
66
66
|
"""
|
67
67
|
##gff-version 3
|
68
68
|
contig1 . gene 1 4 . + 1 ID=gene1
|
@@ -81,12 +81,12 @@ Feature: Changing annotation IDs
|
|
81
81
|
Scenario: Reset locus tag numbering with at a specific value
|
82
82
|
Given I run the genomer command with the arguments "init project"
|
83
83
|
And I cd to "project"
|
84
|
-
And I
|
84
|
+
And I overwrite "Gemfile" with:
|
85
85
|
"""
|
86
86
|
gem 'genomer', :path => '../../../'
|
87
87
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
88
88
|
"""
|
89
|
-
And I
|
89
|
+
And I overwrite "assembly/scaffold.yml" with:
|
90
90
|
"""
|
91
91
|
---
|
92
92
|
-
|
@@ -94,12 +94,12 @@ Feature: Changing annotation IDs
|
|
94
94
|
source: contig1
|
95
95
|
|
96
96
|
"""
|
97
|
-
And I
|
97
|
+
And I overwrite "assembly/sequence.fna" with:
|
98
98
|
"""
|
99
99
|
>contig1
|
100
100
|
ATGCATGC
|
101
101
|
"""
|
102
|
-
And I
|
102
|
+
And I overwrite "assembly/annotations.gff" with:
|
103
103
|
"""
|
104
104
|
##gff-version 3
|
105
105
|
contig1 . gene 1 4 . + 1 ID=gene1
|
@@ -118,12 +118,12 @@ Feature: Changing annotation IDs
|
|
118
118
|
Scenario: Reseting locus tag numbering and adding a prefix
|
119
119
|
Given I run the genomer command with the arguments "init project"
|
120
120
|
And I cd to "project"
|
121
|
-
And I
|
121
|
+
And I overwrite "Gemfile" with:
|
122
122
|
"""
|
123
123
|
gem 'genomer', :path => '../../../'
|
124
124
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
125
125
|
"""
|
126
|
-
And I
|
126
|
+
And I overwrite "assembly/scaffold.yml" with:
|
127
127
|
"""
|
128
128
|
---
|
129
129
|
-
|
@@ -131,12 +131,12 @@ Feature: Changing annotation IDs
|
|
131
131
|
source: contig1
|
132
132
|
|
133
133
|
"""
|
134
|
-
And I
|
134
|
+
And I overwrite "assembly/sequence.fna" with:
|
135
135
|
"""
|
136
136
|
>contig1
|
137
137
|
ATGCATGC
|
138
138
|
"""
|
139
|
-
And I
|
139
|
+
And I overwrite "assembly/annotations.gff" with:
|
140
140
|
"""
|
141
141
|
##gff-version 3
|
142
142
|
contig1 . gene 1 4 . + 1 ID=gene1
|
@@ -7,12 +7,12 @@ Feature: Accessing scaffold annotations
|
|
7
7
|
Scenario: Two annotations on a single contig
|
8
8
|
Given I run the genomer command with the arguments "init project"
|
9
9
|
And I cd to "project"
|
10
|
-
And I
|
10
|
+
And I overwrite "Gemfile" with:
|
11
11
|
"""
|
12
12
|
gem 'genomer', :path => '../../../'
|
13
13
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
14
14
|
"""
|
15
|
-
And I
|
15
|
+
And I overwrite "assembly/scaffold.yml" with:
|
16
16
|
"""
|
17
17
|
---
|
18
18
|
-
|
@@ -20,12 +20,12 @@ Feature: Accessing scaffold annotations
|
|
20
20
|
source: contig1
|
21
21
|
|
22
22
|
"""
|
23
|
-
And I
|
23
|
+
And I overwrite "assembly/sequence.fna" with:
|
24
24
|
"""
|
25
25
|
>contig1
|
26
26
|
ATGCATGC
|
27
27
|
"""
|
28
|
-
And I
|
28
|
+
And I overwrite "assembly/annotations.gff" with:
|
29
29
|
"""
|
30
30
|
##gff-version 3
|
31
31
|
contig1 . gene 1 3 . + 1 .
|
@@ -44,12 +44,12 @@ Feature: Accessing scaffold annotations
|
|
44
44
|
Scenario: Two annotations on a two contigs
|
45
45
|
Given I run the genomer command with the arguments "init project"
|
46
46
|
And I cd to "project"
|
47
|
-
And I
|
47
|
+
And I overwrite "Gemfile" with:
|
48
48
|
"""
|
49
49
|
gem 'genomer', :path => '../../../'
|
50
50
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
51
51
|
"""
|
52
|
-
And I
|
52
|
+
And I overwrite "assembly/scaffold.yml" with:
|
53
53
|
"""
|
54
54
|
---
|
55
55
|
-
|
@@ -60,14 +60,14 @@ Feature: Accessing scaffold annotations
|
|
60
60
|
source: contig2
|
61
61
|
|
62
62
|
"""
|
63
|
-
And I
|
63
|
+
And I overwrite "assembly/sequence.fna" with:
|
64
64
|
"""
|
65
65
|
>contig1
|
66
66
|
ATGCATGC
|
67
67
|
>contig2
|
68
68
|
ATGCATGC
|
69
69
|
"""
|
70
|
-
And I
|
70
|
+
And I overwrite "assembly/annotations.gff" with:
|
71
71
|
"""
|
72
72
|
##gff-version 3
|
73
73
|
contig1 . gene 1 3 . + 1 .
|
@@ -86,12 +86,12 @@ Feature: Accessing scaffold annotations
|
|
86
86
|
Scenario: Two annotations on a single contig with an unused annotation
|
87
87
|
Given I run the genomer command with the arguments "init project"
|
88
88
|
And I cd to "project"
|
89
|
-
And I
|
89
|
+
And I overwrite "Gemfile" with:
|
90
90
|
"""
|
91
91
|
gem 'genomer', :path => '../../../'
|
92
92
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
93
93
|
"""
|
94
|
-
And I
|
94
|
+
And I overwrite "assembly/scaffold.yml" with:
|
95
95
|
"""
|
96
96
|
---
|
97
97
|
-
|
@@ -99,12 +99,12 @@ Feature: Accessing scaffold annotations
|
|
99
99
|
source: contig1
|
100
100
|
|
101
101
|
"""
|
102
|
-
And I
|
102
|
+
And I overwrite "assembly/sequence.fna" with:
|
103
103
|
"""
|
104
104
|
>contig1
|
105
105
|
ATGCATGC
|
106
106
|
"""
|
107
|
-
And I
|
107
|
+
And I overwrite "assembly/annotations.gff" with:
|
108
108
|
"""
|
109
109
|
##gff-version 3
|
110
110
|
contig2 . gene 5 7 . + 1 .
|
@@ -124,12 +124,12 @@ Feature: Accessing scaffold annotations
|
|
124
124
|
Scenario: Three unordered annotations on a single contig
|
125
125
|
Given I run the genomer command with the arguments "init project"
|
126
126
|
And I cd to "project"
|
127
|
-
And I
|
127
|
+
And I overwrite "Gemfile" with:
|
128
128
|
"""
|
129
129
|
gem 'genomer', :path => '../../../'
|
130
130
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
131
131
|
"""
|
132
|
-
And I
|
132
|
+
And I overwrite "assembly/scaffold.yml" with:
|
133
133
|
"""
|
134
134
|
---
|
135
135
|
-
|
@@ -137,12 +137,12 @@ Feature: Accessing scaffold annotations
|
|
137
137
|
source: contig1
|
138
138
|
|
139
139
|
"""
|
140
|
-
And I
|
140
|
+
And I overwrite "assembly/sequence.fna" with:
|
141
141
|
"""
|
142
142
|
>contig1
|
143
143
|
ATGCATGCATGC
|
144
144
|
"""
|
145
|
-
And I
|
145
|
+
And I overwrite "assembly/annotations.gff" with:
|
146
146
|
"""
|
147
147
|
##gff-version 3
|
148
148
|
contig1 . gene 9 11 . + 1 .
|
@@ -163,12 +163,12 @@ Feature: Accessing scaffold annotations
|
|
163
163
|
Scenario: Four unordered annotations on a two contigs
|
164
164
|
Given I run the genomer command with the arguments "init project"
|
165
165
|
And I cd to "project"
|
166
|
-
And I
|
166
|
+
And I overwrite "Gemfile" with:
|
167
167
|
"""
|
168
168
|
gem 'genomer', :path => '../../../'
|
169
169
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
170
170
|
"""
|
171
|
-
And I
|
171
|
+
And I overwrite "assembly/scaffold.yml" with:
|
172
172
|
"""
|
173
173
|
---
|
174
174
|
-
|
@@ -179,14 +179,14 @@ Feature: Accessing scaffold annotations
|
|
179
179
|
source: contig2
|
180
180
|
|
181
181
|
"""
|
182
|
-
And I
|
182
|
+
And I overwrite "assembly/sequence.fna" with:
|
183
183
|
"""
|
184
184
|
>contig1
|
185
185
|
ATGCATGC
|
186
186
|
>contig2
|
187
187
|
ATGCATGC
|
188
188
|
"""
|
189
|
-
And I
|
189
|
+
And I overwrite "assembly/annotations.gff" with:
|
190
190
|
"""
|
191
191
|
##gff-version 3
|
192
192
|
contig2 . gene 5 7 . + 1 .
|
@@ -210,12 +210,12 @@ Feature: Accessing scaffold annotations
|
|
210
210
|
Scenario: Annotations on reversed and trimmed contigs with inserts
|
211
211
|
Given I run the genomer command with the arguments "init project"
|
212
212
|
And I cd to "project"
|
213
|
-
And I
|
213
|
+
And I overwrite "Gemfile" with:
|
214
214
|
"""
|
215
215
|
gem 'genomer', :path => '../../../'
|
216
216
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
217
217
|
"""
|
218
|
-
And I
|
218
|
+
And I overwrite "assembly/scaffold.yml" with:
|
219
219
|
"""
|
220
220
|
---
|
221
221
|
- sequence:
|
@@ -234,7 +234,7 @@ Feature: Accessing scaffold annotations
|
|
234
234
|
start: 3
|
235
235
|
|
236
236
|
"""
|
237
|
-
And I
|
237
|
+
And I overwrite "assembly/sequence.fna" with:
|
238
238
|
"""
|
239
239
|
> contig1
|
240
240
|
AAAAAGGG
|
@@ -245,7 +245,7 @@ Feature: Accessing scaffold annotations
|
|
245
245
|
> insert1
|
246
246
|
TTT
|
247
247
|
"""
|
248
|
-
And I
|
248
|
+
And I overwrite "assembly/annotations.gff" with:
|
249
249
|
"""
|
250
250
|
##gff-version 3
|
251
251
|
contig1 . gene 1 4 . + 1 ID=gene1
|
data/features/cli/error.feature
CHANGED
@@ -6,7 +6,6 @@ Feature: Reporting genomer errors
|
|
6
6
|
Scenario: Calling a non-specified genomer plugin
|
7
7
|
Given I run the genomer command with the arguments "init project"
|
8
8
|
And I cd to "project"
|
9
|
-
And I append to "Gemfile" with ""
|
10
9
|
When I run the genomer command with the arguments "simple"
|
11
10
|
Then the exit status should be 1
|
12
11
|
And the output should contain:
|
data/features/cli/help.feature
CHANGED
@@ -35,7 +35,7 @@ Feature: Listing available commands
|
|
35
35
|
Scenario: Running help with a single genomer plugins specified
|
36
36
|
Given I run the genomer command with the arguments "init project"
|
37
37
|
And I cd to "project"
|
38
|
-
And I
|
38
|
+
And I overwrite "Gemfile" with:
|
39
39
|
"""
|
40
40
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
41
41
|
"""
|
@@ -0,0 +1,69 @@
|
|
1
|
+
Feature: Creating a new genomer project
|
2
|
+
In order to build a genome
|
3
|
+
A user can create a new genomer project
|
4
|
+
So that they can use the genomer commands and organise their data
|
5
|
+
|
6
|
+
Scenario: Creating a new project
|
7
|
+
When I run the genomer command with the arguments "init project"
|
8
|
+
Then the exit status should be 0
|
9
|
+
And a directory named "project" should exist
|
10
|
+
And a directory named "project/assembly" should exist
|
11
|
+
And a file named "project/assembly/scaffold.yml" should exist
|
12
|
+
And the file "project/assembly/scaffold.yml" should contain exactly:
|
13
|
+
"""
|
14
|
+
# Specify your genome scaffold in YAML format here. Reference nucleotide
|
15
|
+
# sequences in the 'sequences.fna' file using the first space delimited
|
16
|
+
# word of each fasta header.
|
17
|
+
#
|
18
|
+
# Go to http://next.gs/getting-started/ to start writing genome scaffold
|
19
|
+
# files.
|
20
|
+
#
|
21
|
+
# A simple one contig example is also provided below. Delete this as you
|
22
|
+
# start writing your own scaffold.
|
23
|
+
---
|
24
|
+
-
|
25
|
+
sequence:
|
26
|
+
source: "contig1"
|
27
|
+
|
28
|
+
"""
|
29
|
+
And a file named "project/assembly/sequence.fna" should exist
|
30
|
+
And the file "project/assembly/sequence.fna" should contain exactly:
|
31
|
+
"""
|
32
|
+
; Add your assembled contigs and scaffolds sequences to this file.
|
33
|
+
; These sequences can be referenced in the 'scaffold.yml' file
|
34
|
+
; using the first space delimited word in each fasta header.
|
35
|
+
> contig1
|
36
|
+
ATGC
|
37
|
+
|
38
|
+
"""
|
39
|
+
And a file named "project/assembly/annotations.gff" should exist
|
40
|
+
And the file "project/assembly/annotations.gff" should contain exactly:
|
41
|
+
"""
|
42
|
+
##gff-version 3
|
43
|
+
## Add your gff3 formatted annotations to this file
|
44
|
+
|
45
|
+
"""
|
46
|
+
And a file named "project/Gemfile" should exist
|
47
|
+
And the file "project/Gemfile" should contain exactly:
|
48
|
+
"""
|
49
|
+
source :rubygems
|
50
|
+
|
51
|
+
gem 'genomer', '~> 0.0.0'
|
52
|
+
|
53
|
+
"""
|
54
|
+
|
55
|
+
@disable-bundler
|
56
|
+
Scenario: Using the files generated in a new project
|
57
|
+
Given I run the genomer command with the arguments "init project"
|
58
|
+
And I cd to "project"
|
59
|
+
And I overwrite "Gemfile" with:
|
60
|
+
"""
|
61
|
+
gem 'genomer', :path => '../../../'
|
62
|
+
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
63
|
+
"""
|
64
|
+
When I run the genomer command with the arguments "simple describe"
|
65
|
+
Then the exit status should be 0
|
66
|
+
And the output should contain:
|
67
|
+
"""
|
68
|
+
The scaffold contains 1 entries
|
69
|
+
"""
|
data/features/cli/man.feature
CHANGED
@@ -17,7 +17,7 @@ Feature: Showing man pages for available commands
|
|
17
17
|
Scenario: Getting the man page for a plugin
|
18
18
|
Given I run the genomer command with the arguments "init project"
|
19
19
|
And I cd to "project"
|
20
|
-
And I
|
20
|
+
And I overwrite "Gemfile" with:
|
21
21
|
"""
|
22
22
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
23
23
|
"""
|
@@ -29,7 +29,7 @@ Feature: Showing man pages for available commands
|
|
29
29
|
Scenario: Getting the man page for a plugin subcommand
|
30
30
|
Given I run the genomer command with the arguments "init project"
|
31
31
|
And I cd to "project"
|
32
|
-
And I
|
32
|
+
And I overwrite "Gemfile" with:
|
33
33
|
"""
|
34
34
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
35
35
|
"""
|
@@ -41,7 +41,7 @@ Feature: Showing man pages for available commands
|
|
41
41
|
Scenario: Trying to get a man page for an unknown plugin
|
42
42
|
Given I run the genomer command with the arguments "init project"
|
43
43
|
And I cd to "project"
|
44
|
-
And I
|
44
|
+
And I overwrite "Gemfile" with:
|
45
45
|
"""
|
46
46
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
47
47
|
"""
|
@@ -58,7 +58,7 @@ Feature: Showing man pages for available commands
|
|
58
58
|
Scenario: Trying to get a man page for an unknown subcommand
|
59
59
|
Given I run the genomer command with the arguments "init project"
|
60
60
|
And I cd to "project"
|
61
|
-
And I
|
61
|
+
And I overwrite "Gemfile" with:
|
62
62
|
"""
|
63
63
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
64
64
|
"""
|
@@ -7,7 +7,7 @@ Feature: Calling genomer plugins in a genomer project
|
|
7
7
|
Scenario: Calling a genomer plugin with no command
|
8
8
|
Given I run the genomer command with the arguments "init project"
|
9
9
|
And I cd to "project"
|
10
|
-
And I
|
10
|
+
And I overwrite "Gemfile" with:
|
11
11
|
"""
|
12
12
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
13
13
|
"""
|
@@ -22,7 +22,7 @@ Feature: Calling genomer plugins in a genomer project
|
|
22
22
|
Scenario: Calling a genomer plugin with a command
|
23
23
|
Given I run the genomer command with the arguments "init project"
|
24
24
|
And I cd to "project"
|
25
|
-
And I
|
25
|
+
And I overwrite "Gemfile" with:
|
26
26
|
"""
|
27
27
|
gem 'genomer-plugin-simple', :path => '../../../genomer-plugin-simple'
|
28
28
|
"""
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'genomer/version'
|
2
|
+
|
3
|
+
class Genomer::Files
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def gemfile
|
7
|
+
version = Genomer::VERSION.split('.')[0..1].<<(0).join('.')
|
8
|
+
<<-EOF.unindent
|
9
|
+
source :rubygems
|
10
|
+
|
11
|
+
gem 'genomer', '~> #{version}'
|
12
|
+
EOF
|
13
|
+
end
|
14
|
+
|
15
|
+
def scaffold_yml
|
16
|
+
<<-EOF.unindent
|
17
|
+
# Specify your genome scaffold in YAML format here. Reference nucleotide
|
18
|
+
# sequences in the 'sequences.fna' file using the first space delimited
|
19
|
+
# word of each fasta header.
|
20
|
+
#
|
21
|
+
# Go to http://next.gs/getting-started/ to start writing genome scaffold
|
22
|
+
# files.
|
23
|
+
#
|
24
|
+
# A simple one contig example is also provided below. Delete this as you
|
25
|
+
# start writing your own scaffold.
|
26
|
+
---
|
27
|
+
-
|
28
|
+
sequence:
|
29
|
+
source: "contig1"
|
30
|
+
EOF
|
31
|
+
end
|
32
|
+
|
33
|
+
def sequence_fna
|
34
|
+
<<-EOF.unindent
|
35
|
+
; Add your assembled contigs and scaffolds sequences to this file.
|
36
|
+
; These sequences can be referenced in the 'scaffold.yml' file
|
37
|
+
; using the first space delimited word in each fasta header.
|
38
|
+
> contig1
|
39
|
+
ATGC
|
40
|
+
EOF
|
41
|
+
end
|
42
|
+
|
43
|
+
def annotations_gff
|
44
|
+
<<-EOF.unindent
|
45
|
+
##gff-version 3
|
46
|
+
## Add your gff3 formatted annotations to this file
|
47
|
+
EOF
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
data/lib/genomer/runtime.rb
CHANGED
@@ -87,9 +87,22 @@ class Genomer::Runtime
|
|
87
87
|
project_name = arguments.first
|
88
88
|
if File.exists?(project_name)
|
89
89
|
raise Genomer::Error, "Directory '#{project_name}' already exists."
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
end
|
91
|
+
|
92
|
+
require 'genomer/files'
|
93
|
+
|
94
|
+
Dir.mkdir project_name
|
95
|
+
Dir.mkdir File.join(project_name,'assembly')
|
96
|
+
|
97
|
+
|
98
|
+
File.open(File.join(project_name,'Gemfile'),'w') do |file|
|
99
|
+
file.print Genomer::Files.gemfile
|
100
|
+
end
|
101
|
+
|
102
|
+
['scaffold.yml','sequence.fna','annotations.gff'].each do |name|
|
103
|
+
File.open(File.join(project_name,'assembly',name),'w') do |file|
|
104
|
+
file.print Genomer::Files.send(name.gsub('.','_').to_sym)
|
105
|
+
end
|
93
106
|
end
|
94
107
|
end
|
95
108
|
|
data/lib/genomer/version.rb
CHANGED
@@ -60,6 +60,60 @@ describe Genomer::Runtime do
|
|
60
60
|
File.exists?(File.join('project_name','assembly')).should be_true
|
61
61
|
end
|
62
62
|
|
63
|
+
it "should create a 'scaffold.yml' file" do
|
64
|
+
file = File.join('project_name','assembly','scaffold.yml')
|
65
|
+
File.exists?(file).should be_true
|
66
|
+
File.read(file).should == <<-EOF.unindent
|
67
|
+
# Specify your genome scaffold in YAML format here. Reference nucleotide
|
68
|
+
# sequences in the 'sequences.fna' file using the first space delimited
|
69
|
+
# word of each fasta header.
|
70
|
+
#
|
71
|
+
# Go to http://next.gs/getting-started/ to start writing genome scaffold
|
72
|
+
# files.
|
73
|
+
#
|
74
|
+
# A simple one contig example is also provided below. Delete this as you
|
75
|
+
# start writing your own scaffold.
|
76
|
+
---
|
77
|
+
-
|
78
|
+
sequence:
|
79
|
+
source: "contig1"
|
80
|
+
EOF
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should create a 'sequence.fna' file" do
|
84
|
+
file = File.join('project_name','assembly','sequence.fna')
|
85
|
+
File.exists?(file).should be_true
|
86
|
+
File.read(file).should == <<-EOF.unindent
|
87
|
+
; Add your assembled contigs and scaffolds sequences to this file.
|
88
|
+
; These sequences can be referenced in the 'scaffold.yml' file
|
89
|
+
; using the first space delimited word in each fasta header.
|
90
|
+
> contig1
|
91
|
+
ATGC
|
92
|
+
EOF
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should create a 'annotations.gff' file" do
|
96
|
+
file = File.join('project_name','assembly','annotations.gff')
|
97
|
+
|
98
|
+
File.exists?(file).should be_true
|
99
|
+
File.read(file).should == <<-EOF.unindent
|
100
|
+
##gff-version 3
|
101
|
+
## Add your gff3 formatted annotations to this file
|
102
|
+
EOF
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should create a 'Gemfile' file" do
|
106
|
+
file = File.join('project_name','Gemfile')
|
107
|
+
version = Genomer::VERSION.split('.')[0..1] << '0'
|
108
|
+
|
109
|
+
|
110
|
+
File.exists?(file).should be_true
|
111
|
+
File.read(file).should == <<-EOF.unindent
|
112
|
+
source :rubygems
|
113
|
+
|
114
|
+
gem 'genomer', '~> #{version.join('.')}'
|
115
|
+
EOF
|
116
|
+
end
|
63
117
|
end
|
64
118
|
|
65
119
|
describe "when project already exists" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genomer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -238,10 +238,9 @@ files:
|
|
238
238
|
- cucumber.yml
|
239
239
|
- features/api/annotation_ids.feature
|
240
240
|
- features/api/annotation_location.feature
|
241
|
-
- features/api/scaffold.feature
|
242
|
-
- features/cli/create.feature
|
243
241
|
- features/cli/error.feature
|
244
242
|
- features/cli/help.feature
|
243
|
+
- features/cli/init.feature
|
245
244
|
- features/cli/man.feature
|
246
245
|
- features/cli/plugins.feature
|
247
246
|
- features/step_definitions/genomer_steps.rb
|
@@ -253,6 +252,7 @@ files:
|
|
253
252
|
- genomer.gemspec
|
254
253
|
- lib/genomer.rb
|
255
254
|
- lib/genomer/error.rb
|
255
|
+
- lib/genomer/files.rb
|
256
256
|
- lib/genomer/plugin.rb
|
257
257
|
- lib/genomer/runtime.rb
|
258
258
|
- lib/genomer/version.rb
|
@@ -275,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
275
|
version: '0'
|
276
276
|
segments:
|
277
277
|
- 0
|
278
|
-
hash: -
|
278
|
+
hash: -2433583334421431310
|
279
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
280
|
none: false
|
281
281
|
requirements:
|
@@ -1,38 +0,0 @@
|
|
1
|
-
Feature: Plugins accessing the scaffold in a genomer project
|
2
|
-
In order to access the scaffold in a genomer plugin
|
3
|
-
A plugin developer can access the scaffold using the #scaffold method
|
4
|
-
So that the scaffold can be used
|
5
|
-
|
6
|
-
@disable-bundler
|
7
|
-
Scenario: Plugin accessing the scaffold
|
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
|
-
sequence:
|
23
|
-
source: contig2
|
24
|
-
|
25
|
-
"""
|
26
|
-
And I append to "assembly/sequence.fna" with:
|
27
|
-
"""
|
28
|
-
>contig1
|
29
|
-
ATGC
|
30
|
-
>contig2
|
31
|
-
ATGC
|
32
|
-
"""
|
33
|
-
When I run the genomer command with the arguments "simple describe"
|
34
|
-
Then the exit status should be 0
|
35
|
-
And the output should contain:
|
36
|
-
"""
|
37
|
-
The scaffold contains 2 entries
|
38
|
-
"""
|
data/features/cli/create.feature
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Feature: Creating a new genomer project
|
2
|
-
In order to build a genome
|
3
|
-
A user can create a new genomer project
|
4
|
-
So that they can use the genomer commands and organise their data
|
5
|
-
|
6
|
-
Scenario: Creating a new project
|
7
|
-
When I run the genomer command with the arguments "init project"
|
8
|
-
Then the exit status should be 0
|
9
|
-
And a directory named "project" should exist
|
10
|
-
And a directory named "project/assembly" should exist
|
11
|
-
|
12
|
-
Scenario: Creating a new project where the directory already exists
|
13
|
-
Given a directory named "project"
|
14
|
-
When I run the genomer command with the arguments "init project"
|
15
|
-
Then the exit status should be 1
|
16
|
-
And the stderr should contain:
|
17
|
-
"""
|
18
|
-
Error. Directory 'project' already exists.
|
19
|
-
"""
|