genomer-plugin-summary 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in genomer-plugin-summary.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Michael Barton
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Genomer::Plugin::Summary
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'genomer-plugin-summary'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install genomer-plugin-summary
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ end
8
+
9
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,239 @@
1
+ Feature: Producing a summary of the scaffold gaps
2
+ In order to have an overview of the gaps in a scaffold
3
+ A user can use the "gaps" command
4
+ to generate the a tabular output of the scaffold gaps
5
+
6
+ @disable-bundler
7
+ Scenario: A single contig scaffold
8
+ Given I create a new genomer project
9
+ And I write to "assembly/scaffold.yml" with:
10
+ """
11
+ ---
12
+ -
13
+ sequence:
14
+ source: "contig00001"
15
+ """
16
+ And I write to "assembly/sequence.fna" with:
17
+ """
18
+ >contig00001
19
+ ATGGC
20
+ """
21
+ When I run `genomer summary gaps`
22
+ Then the exit status should be 0
23
+ And the output should contain:
24
+ """
25
+ +----------+----------+----------+----------+--------------+
26
+ | Scaffold Gaps |
27
+ +----------+----------+----------+----------+--------------+
28
+ | Number | Length | Start | End | Type |
29
+ +----------+----------+----------+----------+--------------+
30
+ +----------+----------+----------+----------+--------------+
31
+ """
32
+
33
+ @disable-bundler
34
+ Scenario: A single contig with an internal gap
35
+ Given I create a new genomer project
36
+ And I write to "assembly/scaffold.yml" with:
37
+ """
38
+ ---
39
+ -
40
+ sequence:
41
+ source: "contig00001"
42
+ """
43
+ And I write to "assembly/sequence.fna" with:
44
+ """
45
+ >contig00001
46
+ ATGNNNATG
47
+ """
48
+ When I run `genomer summary gaps`
49
+ Then the exit status should be 0
50
+ And the output should contain:
51
+ """
52
+ +----------+----------+----------+----------+--------------+
53
+ | Scaffold Gaps |
54
+ +----------+----------+----------+----------+--------------+
55
+ | Number | Length | Start | End | Type |
56
+ +----------+----------+----------+----------+--------------+
57
+ | 1 | 3 | 4 | 6 | contig |
58
+ +----------+----------+----------+----------+--------------+
59
+ """
60
+
61
+ @disable-bundler
62
+ Scenario: Two contigs separated by an unresolved region
63
+ Given I create a new genomer project
64
+ And I write to "assembly/scaffold.yml" with:
65
+ """
66
+ ---
67
+ -
68
+ sequence:
69
+ source: "contig00001"
70
+ -
71
+ unresolved:
72
+ length: 10
73
+ -
74
+ sequence:
75
+ source: "contig00001"
76
+ """
77
+ And I write to "assembly/sequence.fna" with:
78
+ """
79
+ >contig00001
80
+ ATGCC
81
+ """
82
+ When I run `genomer summary gaps`
83
+ Then the exit status should be 0
84
+ And the output should contain:
85
+ """
86
+ +----------+----------+----------+----------+--------------+
87
+ | Scaffold Gaps |
88
+ +----------+----------+----------+----------+--------------+
89
+ | Number | Length | Start | End | Type |
90
+ +----------+----------+----------+----------+--------------+
91
+ | 1 | 10 | 6 | 15 | unresolved |
92
+ +----------+----------+----------+----------+--------------+
93
+ """
94
+
95
+ @disable-bundler
96
+ Scenario: A mixture of contig gaps and unresolved regions
97
+ Given I create a new genomer project
98
+ And I write to "assembly/scaffold.yml" with:
99
+ """
100
+ ---
101
+ -
102
+ sequence:
103
+ source: "contig00001"
104
+ -
105
+ unresolved:
106
+ length: 10
107
+ -
108
+ sequence:
109
+ source: "contig00002"
110
+ """
111
+ And I write to "assembly/sequence.fna" with:
112
+ """
113
+ >contig00001
114
+ ATGNNNATG
115
+ >contig00002
116
+ ANG
117
+ """
118
+ When I run `genomer summary gaps`
119
+ Then the exit status should be 0
120
+ And the output should contain:
121
+ """
122
+ +----------+----------+----------+----------+--------------+
123
+ | Scaffold Gaps |
124
+ +----------+----------+----------+----------+--------------+
125
+ | Number | Length | Start | End | Type |
126
+ +----------+----------+----------+----------+--------------+
127
+ | 1 | 3 | 4 | 6 | contig |
128
+ | 2 | 10 | 10 | 19 | unresolved |
129
+ | 3 | 1 | 21 | 21 | contig |
130
+ +----------+----------+----------+----------+--------------+
131
+ """
132
+
133
+ @disable-bundler
134
+ Scenario: A single contig with an internal gap filled by an insert
135
+ Given I create a new genomer project
136
+ And I write to "assembly/scaffold.yml" with:
137
+ """
138
+ ---
139
+ -
140
+ sequence:
141
+ source: "contig00001"
142
+ inserts:
143
+ -
144
+ source: "insert_1"
145
+ open: 4
146
+ close: 6
147
+ """
148
+ And I write to "assembly/sequence.fna" with:
149
+ """
150
+ >contig00001
151
+ ATGNNNATG
152
+ >insert_1
153
+ AAA
154
+ """
155
+ When I run `genomer summary gaps`
156
+ Then the exit status should be 0
157
+ And the output should contain:
158
+ """
159
+ +----------+----------+----------+----------+--------------+
160
+ | Scaffold Gaps |
161
+ +----------+----------+----------+----------+--------------+
162
+ | Number | Length | Start | End | Type |
163
+ +----------+----------+----------+----------+--------------+
164
+ +----------+----------+----------+----------+--------------+
165
+ """
166
+
167
+ @disable-bundler
168
+ Scenario: A single contig with an internal gap partially filled by an insert
169
+ Given I create a new genomer project
170
+ And I write to "assembly/scaffold.yml" with:
171
+ """
172
+ ---
173
+ -
174
+ sequence:
175
+ source: "contig00001"
176
+ inserts:
177
+ -
178
+ source: "insert_1"
179
+ open: 4
180
+ close: 5
181
+ """
182
+ And I write to "assembly/sequence.fna" with:
183
+ """
184
+ >contig00001
185
+ ATGNNNATG
186
+ >insert_1
187
+ AAA
188
+ """
189
+ When I run `genomer summary gaps`
190
+ Then the exit status should be 0
191
+ And the output should contain:
192
+ """
193
+ +----------+----------+----------+----------+--------------+
194
+ | Scaffold Gaps |
195
+ +----------+----------+----------+----------+--------------+
196
+ | Number | Length | Start | End | Type |
197
+ +----------+----------+----------+----------+--------------+
198
+ | 1 | 1 | 7 | 7 | contig |
199
+ +----------+----------+----------+----------+--------------+
200
+ """
201
+
202
+ @disable-bundler
203
+ Scenario: A partially filled contig internal gap followed by an unresolved region
204
+ Given I create a new genomer project
205
+ And I write to "assembly/scaffold.yml" with:
206
+ """
207
+ ---
208
+ -
209
+ sequence:
210
+ source: "contig00001"
211
+ inserts:
212
+ -
213
+ source: "insert_1"
214
+ open: 4
215
+ close: 5
216
+ -
217
+ unresolved:
218
+ length: 5
219
+ """
220
+ And I write to "assembly/sequence.fna" with:
221
+ """
222
+ >contig00001
223
+ ATGNNNATG
224
+ >insert_1
225
+ AAA
226
+ """
227
+ When I run `genomer summary gaps`
228
+ Then the exit status should be 0
229
+ And the output should contain:
230
+ """
231
+ +----------+----------+----------+----------+--------------+
232
+ | Scaffold Gaps |
233
+ +----------+----------+----------+----------+--------------+
234
+ | Number | Length | Start | End | Type |
235
+ +----------+----------+----------+----------+--------------+
236
+ | 1 | 1 | 7 | 7 | contig |
237
+ | 2 | 5 | 11 | 15 | unresolved |
238
+ +----------+----------+----------+----------+--------------+
239
+ """
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+
10
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../spec')
12
+
13
+ require 'aruba/cucumber'
@@ -0,0 +1,5 @@
1
+ When /^I create a new genomer project$/ do
2
+ step 'I successfully run `genomer init project`'
3
+ step 'I cd to "project"'
4
+ step 'I append to "Gemfile" with "gem \'genomer-plugin-summary\', :path =>\'../../../\'"'
5
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Michael Barton"]
5
+ gem.email = ["mail@michaelbarton.me.uk"]
6
+ gem.description = %q{Genomer plugin for generating reports}
7
+ gem.summary = %q{Generates reports on the status of the genomer project}
8
+ gem.homepage = ""
9
+
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "genomer-plugin-summary"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = File.read 'VERSION'
16
+
17
+ gem.add_dependency "genomer", ">= 0.0.4"
18
+ gem.add_dependency "terminal-table", "~> 1.4.5"
19
+
20
+ gem.add_development_dependency 'rake', '~> 0.9.0'
21
+
22
+ gem.add_development_dependency 'rspec', '~> 2.9.0'
23
+ gem.add_development_dependency "heredoc_unindent", "~> 1.1.2"
24
+ gem.add_development_dependency "rr", "~> 1.0.4"
25
+
26
+ gem.add_development_dependency 'cucumber', '~> 1.1.9'
27
+ gem.add_development_dependency 'aruba', '~> 0.4.11'
28
+
29
+ end
@@ -0,0 +1,79 @@
1
+ require 'genomer'
2
+ require 'terminal-table'
3
+
4
+ class GenomerPluginSummary::Gaps < Genomer::Plugin
5
+
6
+ def run
7
+ tabulate determine_gaps scaffold
8
+ end
9
+
10
+ def headings
11
+ ['Number'.center(8),
12
+ 'Length'.center(8),
13
+ 'Start'.center(8),
14
+ 'End'.center(8),
15
+ 'Type'.center(12)]
16
+ end
17
+
18
+ def title
19
+ 'Scaffold Gaps'
20
+ end
21
+
22
+ def tabulate(contigs)
23
+ table = Terminal::Table.new(:title => title) do |t|
24
+ t << headings
25
+ t << :separator
26
+ contigs.each do |ctg|
27
+ t << [ctg[:number],
28
+ ctg[:length],
29
+ ctg[:start],
30
+ ctg[:end],
31
+ ctg[:type]]
32
+ end
33
+ end
34
+
35
+ table.style = {:width => 60}
36
+ table.align_column 0, :right
37
+ table.align_column 1, :right
38
+ table.align_column 2, :right
39
+ table.align_column 3, :right
40
+ table.align_column 4, :center
41
+
42
+ table
43
+ end
44
+
45
+ def gap_locations(seq)
46
+ seq.upcase.enum_for(:scan, /(N+)/).map do
47
+ (Regexp.last_match.begin(0)+1)..(Regexp.last_match.end(0))
48
+ end
49
+ end
50
+
51
+ def determine_gaps(scaffold)
52
+ count = 0
53
+ length = 0
54
+
55
+ scaffold.map do |entry|
56
+ gaps = case entry.entry_type
57
+ when :sequence then
58
+ gap_locations(entry.sequence).map do |gap|
59
+ count += 1
60
+ {:number => count,
61
+ :length => (gap.end - gap.begin) + 1,
62
+ :start => gap.begin + length,
63
+ :end => gap.end + length,
64
+ :type => :contig}
65
+ end
66
+ when :unresolved then
67
+ count += 1
68
+ {:number => count,
69
+ :length => entry.sequence.length,
70
+ :start => length + 1,
71
+ :end => length + entry.sequence.length,
72
+ :type => :unresolved}
73
+ end
74
+ length += entry.sequence.length
75
+ gaps
76
+ end.flatten
77
+ end
78
+
79
+ end
@@ -0,0 +1,14 @@
1
+ require "genomer"
2
+
3
+ class GenomerPluginSummary < Genomer::Plugin
4
+
5
+ def self.fetch(name)
6
+ require 'genomer-plugin-summary/' + name
7
+ const_get(name.capitalize)
8
+ end
9
+
10
+ def run
11
+ self.class.fetch(arguments.shift).new(arguments,flags).run
12
+ end
13
+
14
+ end
@@ -0,0 +1,38 @@
1
+ genomer-summary-gaps(1) -- summarise the gaps in the scaffold
2
+ =============================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `genomer summary gaps`
7
+
8
+ ## DESCRIPTION
9
+
10
+ Generates a summary of the gaps (regions of N characters) in the scaffolded
11
+ output sequence. This summary command lists these gaps with the following
12
+ attributes:
13
+
14
+ * Number:
15
+ Incremental gap number from the start of the sequence.
16
+
17
+ * Length:
18
+ The length of the gap sequence.
19
+
20
+ * Start:
21
+ The start of the gap sequence in the output sequence.
22
+
23
+ * End:
24
+ The end of the gap sequence in the output sequence.
25
+
26
+ * Type:
27
+ Whether the gap is **specified** in the scaffold file as an unresolved
28
+ region or is a **contig** gaps which appears in one of the contigs used to
29
+ build the scaffold.
30
+
31
+ ## BUGS
32
+
33
+ **Genomer-summary** is written in Ruby and uses several RubyGem dependencies.
34
+ See the .gemspec file in the install directory for version details.
35
+
36
+ ## COPYRIGHT
37
+
38
+ **Genomer** is Copyright (C) 2011 Michael Barton <http://michaelbarton.me.uk>
@@ -0,0 +1,27 @@
1
+ genomer-summary(1) -- generate summaries of genomer projects
2
+ ============================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `genomer summary` <summary-type> [<options>...]
7
+
8
+ ## DESCRIPTION
9
+
10
+ Generates different summary types for genomer projects. Each **summary-type**
11
+ has a corresponding man page which can be accessed using:
12
+
13
+ `genome man summary <summary-type>`
14
+
15
+ The following **summary-type** are available:
16
+
17
+ * `gaps`:
18
+ Summarises the gaps in the genome scaffold.
19
+
20
+ ## BUGS
21
+
22
+ **Genomer-summary** is written in Ruby and uses several RubyGem dependencies.
23
+ See the .gemspec file in the install directory for version details.
24
+
25
+ ## COPYRIGHT
26
+
27
+ **Genomer** is Copyright (C) 2011 Michael Barton <http://michaelbarton.me.uk>
@@ -0,0 +1,197 @@
1
+ require 'spec_helper'
2
+ require 'genomer-plugin-summary/gaps'
3
+
4
+ describe GenomerPluginSummary::Gaps do
5
+
6
+ describe "#tabulate" do
7
+
8
+ subject do
9
+ described_class.new([],{}).tabulate(contigs).to_s + "\n"
10
+ end
11
+
12
+ context "passed an empty array" do
13
+
14
+ let(:contigs) do
15
+ []
16
+ end
17
+
18
+ it do
19
+ should ==<<-EOS.unindent!
20
+ +----------+----------+----------+----------+--------------+
21
+ | Scaffold Gaps |
22
+ +----------+----------+----------+----------+--------------+
23
+ | Number | Length | Start | End | Type |
24
+ +----------+----------+----------+----------+--------------+
25
+ +----------+----------+----------+----------+--------------+
26
+ EOS
27
+ end
28
+
29
+ end
30
+
31
+ context "passed an array with one entry" do
32
+
33
+ let(:contigs) do
34
+ [{:number => 1, :length => 1, :start => 1, :end => 1, :type => :contig}]
35
+ end
36
+
37
+ it do
38
+ should ==<<-EOS.unindent!
39
+ +----------+----------+----------+----------+--------------+
40
+ | Scaffold Gaps |
41
+ +----------+----------+----------+----------+--------------+
42
+ | Number | Length | Start | End | Type |
43
+ +----------+----------+----------+----------+--------------+
44
+ | 1 | 1 | 1 | 1 | contig |
45
+ +----------+----------+----------+----------+--------------+
46
+ EOS
47
+ end
48
+
49
+ end
50
+
51
+ context "passed an array with two entries" do
52
+
53
+ let(:contigs) do
54
+ [{:number => 1, :length => 1, :start => 1, :end => 1, :type => :contig},
55
+ {:number => 2, :length => 2, :start => 2, :end => 2, :type => :unresolved}]
56
+ end
57
+
58
+ it do
59
+ should ==<<-EOS.unindent!
60
+ +----------+----------+----------+----------+--------------+
61
+ | Scaffold Gaps |
62
+ +----------+----------+----------+----------+--------------+
63
+ | Number | Length | Start | End | Type |
64
+ +----------+----------+----------+----------+--------------+
65
+ | 1 | 1 | 1 | 1 | contig |
66
+ | 2 | 2 | 2 | 2 | unresolved |
67
+ +----------+----------+----------+----------+--------------+
68
+ EOS
69
+ end
70
+
71
+ end
72
+
73
+ end
74
+
75
+ describe "#determine_gaps" do
76
+
77
+ def sequence(seq)
78
+ s = mock!
79
+ stub(s).sequence{ seq }
80
+ stub(s).entry_type{ :sequence }
81
+ s
82
+ end
83
+
84
+ def unresolved(seq)
85
+ s = mock!
86
+ stub(s).sequence{ seq }
87
+ stub(s).entry_type{ :unresolved }
88
+ s
89
+ end
90
+
91
+ subject do
92
+ described_class.new([],{}).determine_gaps(scaffold)
93
+ end
94
+
95
+ context "an empty scaffold" do
96
+ let(:scaffold) do
97
+ []
98
+ end
99
+
100
+ it{ should == []}
101
+ end
102
+
103
+ context "a scaffold with a single contig" do
104
+ let(:scaffold) do
105
+ [sequence('AAATTT')]
106
+ end
107
+
108
+ it{ should == []}
109
+ end
110
+
111
+ context "a scaffold with a single contig containing a gap" do
112
+ let(:scaffold) do
113
+ [sequence('AANNTT')]
114
+ end
115
+
116
+ it do
117
+ should == [{:number => 1, :length => 2, :start => 3, :end => 4, :type => :contig}]
118
+ end
119
+ end
120
+
121
+ context "a scaffold with a two contigs containing gaps" do
122
+ let(:scaffold) do
123
+ [sequence('AANNTT'), sequence('AANNTT')]
124
+ end
125
+
126
+ it do
127
+ should == [
128
+ {:number => 1, :length => 2, :start => 3, :end => 4, :type => :contig},
129
+ {:number => 2, :length => 2, :start => 9, :end => 10, :type => :contig}]
130
+ end
131
+ end
132
+
133
+ context "a scaffold with two contigs separated by an unresolved region" do
134
+ let(:scaffold) do
135
+ [sequence('AAT'),
136
+ unresolved('NNNNNNNNNN'),
137
+ sequence('AAT')]
138
+ end
139
+
140
+ it do
141
+ should == [
142
+ {:number => 1, :length => 10, :start => 4, :end => 13, :type => :unresolved}]
143
+ end
144
+ end
145
+
146
+ context "a scaffold with a mixture of gapped contigs and unresolved regions" do
147
+ let(:scaffold) do
148
+ [sequence('AAANNNTTT'),
149
+ unresolved('NNNNNNNNNN'),
150
+ sequence('AAANT'),
151
+ unresolved('NNNNNNNNNN')]
152
+ end
153
+
154
+ it do
155
+ should == [
156
+ {:number => 1, :length => 3, :start => 4, :end => 6, :type => :contig},
157
+ {:number => 2, :length => 10, :start => 10, :end => 19, :type => :unresolved},
158
+ {:number => 3, :length => 1, :start => 23, :end => 23, :type => :contig},
159
+ {:number => 4, :length => 10, :start => 25, :end => 34, :type => :unresolved}]
160
+ end
161
+ end
162
+ end
163
+
164
+ describe "#gap_locations" do
165
+
166
+ subject do
167
+ described_class.new([],{}).gap_locations(sequence)
168
+ end
169
+
170
+ context "an empty string" do
171
+ let(:sequence){ "" }
172
+ it{ should == []}
173
+ end
174
+
175
+ context "a sequence with no gaps" do
176
+ let(:sequence){ "ATGC" }
177
+ it{ should == []}
178
+ end
179
+
180
+ context "a sequence with a single gap" do
181
+ let(:sequence){ "ATGCNNNATGC" }
182
+ it{ should == [5..7]}
183
+ end
184
+
185
+ context "a sequence with a single character gap" do
186
+ let(:sequence){ "ANC" }
187
+ it{ should == [2..2]}
188
+ end
189
+
190
+ context "a sequence with two gaps" do
191
+ let(:sequence){ "ATGCNNNATGCNNNNATGC" }
192
+ it{ should == [5..7, 12..15]}
193
+ end
194
+
195
+ end
196
+
197
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe GenomerPluginSummary do
4
+
5
+ example = described_class::Example = Class.new(described_class)
6
+
7
+ before do
8
+ mock(described_class).require 'genomer-plugin-summary/example'
9
+ end
10
+
11
+ describe "#fetch" do
12
+
13
+ it "should return the required view plugin class" do
14
+ described_class.fetch('example').should == example
15
+ end
16
+
17
+ end
18
+
19
+ describe "#run" do
20
+
21
+ it "should initialize and run the required summary plugin" do
22
+ mock.proxy(example).new([:arg],:flags) do |instance|
23
+ mock(instance).run
24
+ end
25
+
26
+ described_class.new(['example',:arg],:flags).run
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,15 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'rspec'
4
+ require 'heredoc_unindent'
5
+ require 'genomer-plugin-summary'
6
+
7
+ # Requires supporting files with custom matchers and macros, etc,
8
+ # in ./support/ and its subdirectories.
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each do |f|
10
+ require File.expand_path(f)
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ config.mock_with :rr
15
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: genomer-plugin-summary
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael Barton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: genomer
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.0.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: terminal-table
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 1.4.5
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.5
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.9.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.9.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.9.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: heredoc_unindent
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.1.2
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.1.2
94
+ - !ruby/object:Gem::Dependency
95
+ name: rr
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 1.0.4
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.4
110
+ - !ruby/object:Gem::Dependency
111
+ name: cucumber
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.1.9
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.1.9
126
+ - !ruby/object:Gem::Dependency
127
+ name: aruba
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 0.4.11
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 0.4.11
142
+ description: Genomer plugin for generating reports
143
+ email:
144
+ - mail@michaelbarton.me.uk
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - Gemfile
151
+ - LICENSE
152
+ - README.md
153
+ - Rakefile
154
+ - VERSION
155
+ - features/gaps.feature
156
+ - features/support/env.rb
157
+ - features/support/genomer_steps.rb
158
+ - genomer-plugin-summary.gemspec
159
+ - lib/genomer-plugin-summary.rb
160
+ - lib/genomer-plugin-summary/gaps.rb
161
+ - man/genomer-summary-gaps.ronn
162
+ - man/genomer-summary.ronn
163
+ - spec/genomer-plugin-summary_spec.rb
164
+ - spec/genomer-plugin-summary_spec/gaps_spec.rb
165
+ - spec/spec_helper.rb
166
+ homepage: ''
167
+ licenses: []
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ segments:
179
+ - 0
180
+ hash: -2942156995405587810
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ segments:
188
+ - 0
189
+ hash: -2942156995405587810
190
+ requirements: []
191
+ rubyforge_project:
192
+ rubygems_version: 1.8.23
193
+ signing_key:
194
+ specification_version: 3
195
+ summary: Generates reports on the status of the genomer project
196
+ test_files:
197
+ - features/gaps.feature
198
+ - features/support/env.rb
199
+ - features/support/genomer_steps.rb
200
+ - spec/genomer-plugin-summary_spec.rb
201
+ - spec/genomer-plugin-summary_spec/gaps_spec.rb
202
+ - spec/spec_helper.rb