genomer-plugin-summary 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/spec/spec_helper.rb CHANGED
@@ -16,7 +16,7 @@ RSpec.configure do |config|
16
16
  def sequence(seq, source=nil)
17
17
  s = mock!
18
18
  stub(s).sequence{ seq }
19
- stub(s).source{ source } if source
19
+ stub(s).source{ source }
20
20
  stub(s).entry_type{ :sequence }
21
21
  s
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genomer-plugin-summary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-10-19 00:00:00.000000000 Z
12
+ date: 2012-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: genomer
@@ -168,23 +168,30 @@ files:
168
168
  - README.md
169
169
  - Rakefile
170
170
  - VERSION
171
+ - features/contigs.feature
171
172
  - features/gaps.feature
172
- - features/scaffold.feature
173
+ - features/genome.feature
173
174
  - features/sequences.feature
174
175
  - features/support/env.rb
175
176
  - features/support/genomer_steps.rb
176
177
  - genomer-plugin-summary.gemspec
177
178
  - lib/genomer-plugin-summary.rb
179
+ - lib/genomer-plugin-summary/contigs.rb
180
+ - lib/genomer-plugin-summary/enumerators.rb
181
+ - lib/genomer-plugin-summary/format.rb
178
182
  - lib/genomer-plugin-summary/gaps.rb
183
+ - lib/genomer-plugin-summary/genome.rb
179
184
  - lib/genomer-plugin-summary/metrics.rb
180
- - lib/genomer-plugin-summary/scaffold.rb
181
185
  - lib/genomer-plugin-summary/sequences.rb
182
186
  - man/genomer-summary-gaps.ronn
183
187
  - man/genomer-summary.ronn
184
188
  - spec/genomer-plugin-summary_spec.rb
189
+ - spec/genomer-plugin-summary_spec/contigs_spec.rb
190
+ - spec/genomer-plugin-summary_spec/enumerators_spec.rb
191
+ - spec/genomer-plugin-summary_spec/format_spec.rb
185
192
  - spec/genomer-plugin-summary_spec/gaps_spec.rb
193
+ - spec/genomer-plugin-summary_spec/genome_spec.rb
186
194
  - spec/genomer-plugin-summary_spec/metrics_spec.rb
187
- - spec/genomer-plugin-summary_spec/scaffold_spec.rb
188
195
  - spec/genomer-plugin-summary_spec/sequences_spec.rb
189
196
  - spec/spec_helper.rb
190
197
  homepage: ''
@@ -201,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
208
  version: '0'
202
209
  segments:
203
210
  - 0
204
- hash: 4220695143332306969
211
+ hash: 2735699573861550577
205
212
  required_rubygems_version: !ruby/object:Gem::Requirement
206
213
  none: false
207
214
  requirements:
@@ -210,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
217
  version: '0'
211
218
  segments:
212
219
  - 0
213
- hash: 4220695143332306969
220
+ hash: 2735699573861550577
214
221
  requirements: []
215
222
  rubyforge_project:
216
223
  rubygems_version: 1.8.23
@@ -218,14 +225,18 @@ signing_key:
218
225
  specification_version: 3
219
226
  summary: Generates reports on the status of the genomer project
220
227
  test_files:
228
+ - features/contigs.feature
221
229
  - features/gaps.feature
222
- - features/scaffold.feature
230
+ - features/genome.feature
223
231
  - features/sequences.feature
224
232
  - features/support/env.rb
225
233
  - features/support/genomer_steps.rb
226
234
  - spec/genomer-plugin-summary_spec.rb
235
+ - spec/genomer-plugin-summary_spec/contigs_spec.rb
236
+ - spec/genomer-plugin-summary_spec/enumerators_spec.rb
237
+ - spec/genomer-plugin-summary_spec/format_spec.rb
227
238
  - spec/genomer-plugin-summary_spec/gaps_spec.rb
239
+ - spec/genomer-plugin-summary_spec/genome_spec.rb
228
240
  - spec/genomer-plugin-summary_spec/metrics_spec.rb
229
- - spec/genomer-plugin-summary_spec/scaffold_spec.rb
230
241
  - spec/genomer-plugin-summary_spec/sequences_spec.rb
231
242
  - spec/spec_helper.rb
@@ -1,122 +0,0 @@
1
- Feature: Producing a summary of the scaffold
2
- In order to have an overview of the scaffold
3
- A user can use the "scaffod" command
4
- to generate the a tabular output of the scaffold
5
-
6
- Scenario: A scaffold with a single sequence
7
- Given I create a new genomer project
8
- And I write to "assembly/scaffold.yml" with:
9
- """
10
- ---
11
- -
12
- sequence:
13
- source: contig0001
14
- """
15
- And I write to "assembly/sequence.fna" with:
16
- """
17
- >contig0001
18
- ATGC
19
- """
20
- When I run `genomer summary scaffold`
21
- Then the exit status should be 0
22
- And the output should contain:
23
- """
24
- +--------------+-----------+
25
- | Scaffold |
26
- +--------------+-----------+
27
- | Contigs (#) | 1 |
28
- | Gaps (#) | 0 |
29
- +--------------+-----------+
30
- | Size (bp) | 4 |
31
- | Contigs (bp) | 4 |
32
- | Gaps (bp) | 0 |
33
- +--------------+-----------+
34
- | G+C (%) | 50.00 |
35
- | Contigs (%) | 100.00 |
36
- | Gaps (%) | 0.00 |
37
- +--------------+-----------+
38
-
39
- """
40
-
41
- Scenario: A scaffold with a two sequences
42
- Given I create a new genomer project
43
- And I write to "assembly/scaffold.yml" with:
44
- """
45
- ---
46
- -
47
- sequence:
48
- source: contig0001
49
- -
50
- sequence:
51
- source: contig0002
52
- """
53
- And I write to "assembly/sequence.fna" with:
54
- """
55
- >contig0001
56
- ATGC
57
- >contig0002
58
- GGGC
59
- """
60
- When I run `genomer summary scaffold`
61
- Then the exit status should be 0
62
- And the output should contain:
63
- """
64
- +--------------+-----------+
65
- | Scaffold |
66
- +--------------+-----------+
67
- | Contigs (#) | 2 |
68
- | Gaps (#) | 0 |
69
- +--------------+-----------+
70
- | Size (bp) | 8 |
71
- | Contigs (bp) | 8 |
72
- | Gaps (bp) | 0 |
73
- +--------------+-----------+
74
- | G+C (%) | 75.00 |
75
- | Contigs (%) | 100.00 |
76
- | Gaps (%) | 0.00 |
77
- +--------------+-----------+
78
-
79
- """
80
-
81
- Scenario: A scaffold with a two sequences and a gap
82
- Given I create a new genomer project
83
- And I write to "assembly/scaffold.yml" with:
84
- """
85
- ---
86
- -
87
- sequence:
88
- source: contig0001
89
- -
90
- unresolved:
91
- length: 5
92
- -
93
- sequence:
94
- source: contig0002
95
- """
96
- And I write to "assembly/sequence.fna" with:
97
- """
98
- >contig0001
99
- ATGC
100
- >contig0002
101
- GGGC
102
- """
103
- When I run `genomer summary scaffold`
104
- Then the exit status should be 0
105
- And the output should contain:
106
- """
107
- +--------------+-----------+
108
- | Scaffold |
109
- +--------------+-----------+
110
- | Contigs (#) | 2 |
111
- | Gaps (#) | 1 |
112
- +--------------+-----------+
113
- | Size (bp) | 13 |
114
- | Contigs (bp) | 8 |
115
- | Gaps (bp) | 5 |
116
- +--------------+-----------+
117
- | G+C (%) | 75.00 |
118
- | Contigs (%) | 61.54 |
119
- | Gaps (%) | 38.46 |
120
- +--------------+-----------+
121
-
122
- """
@@ -1,56 +0,0 @@
1
- require 'genomer'
2
- require 'genomer-plugin-summary/metrics'
3
- require 'terminal-table'
4
-
5
- class GenomerPluginSummary::Scaffold < Genomer::Plugin
6
- include GenomerPluginSummary::Metrics
7
-
8
- LAYOUT = [
9
- {:name => 'Contigs (#)', :entry_type => :sequence, :method => :count},
10
- {:name => 'Gaps (#)', :entry_type => :unresolved, :method => :count},
11
- :separator,
12
- {:name => 'Size (bp)', :entry_type => :all, :method => :length},
13
- {:name => 'Contigs (bp)', :entry_type => :sequence, :method => :length},
14
- {:name => 'Gaps (bp)', :entry_type => :unresolved, :method => :length},
15
- :separator,
16
- {:name => 'G+C (%)', :entry_type => :all, :method => :gc_content},
17
- {:name => 'Contigs (%)', :entry_type => :sequence, :method => :percent},
18
- {:name => 'Gaps (%)', :entry_type => :unresolved, :method => :percent}
19
- ]
20
-
21
- def run
22
- tabulate calculate_metrics(LAYOUT, scaffold)
23
- end
24
-
25
- def title
26
- 'Scaffold'
27
- end
28
-
29
- def tabulate(data)
30
- table = Terminal::Table.new(:title => title) do |t|
31
- data.each do |(k,v)|
32
- t << if k == :separator
33
- :separator
34
- else
35
- v = sprintf('%#.2f',v) if v.class == Float
36
- [k.ljust(12),v.to_s.rjust(9)]
37
- end
38
- end
39
- end
40
-
41
- table.align_column 0, :left
42
- table.align_column 1, :right
43
- table.to_s
44
- end
45
-
46
- def calculate_metrics(specs,scaffold)
47
- specs.map do |spec|
48
- if spec == :separator
49
- spec
50
- else
51
- [spec[:name], send(spec[:method],spec[:entry_type],scaffold)]
52
- end
53
- end
54
- end
55
-
56
- end