fasta_read 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +92 -0
- data/Guardfile +33 -0
- data/LICENSE.txt +7 -0
- data/README.md +87 -0
- data/README.rdoc +23 -0
- data/Rakefile +66 -0
- data/bin/fasta_read +74 -0
- data/fasta_read.gemspec +28 -0
- data/features/fasta_read.feature +72 -0
- data/features/step_definitions/fasta_read_steps.rb +13 -0
- data/features/support/env.rb +16 -0
- data/lib/fasta_read/version.rb +3 -0
- data/lib/fasta_read.rb +5 -0
- data/spec/something_spec.rb +5 -0
- data/stories.txt +28 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 558118906f7e4faa7a55c5c377a7df9b92f49504
|
4
|
+
data.tar.gz: 352cc6460c3d3e90d37bc00ad3270490c7dd2215
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e79237df90e5409df718a2331bb028ee6fb28afd23c5e26e03105694cf71995ab949b7d77b092cf3b97e6315c3cab4fb19cb5e30611470c4f954d2b5f3c05ed8
|
7
|
+
data.tar.gz: 761c230b6fb31d9ebd2b847026def6e4348a879b99d2d813868e1d475fd9630b8e01f90beec532acb804d75888ef102f02688a4aea43faab09935ddf695cae8b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fasta_read (1.0.0)
|
5
|
+
methadone (~> 1.3.2)
|
6
|
+
rake (~> 0.9)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
aruba (0.5.4)
|
12
|
+
childprocess (>= 0.3.6)
|
13
|
+
cucumber (>= 1.1.1)
|
14
|
+
rspec-expectations (>= 2.7.0)
|
15
|
+
builder (3.2.2)
|
16
|
+
celluloid (0.15.2)
|
17
|
+
timers (~> 1.1.0)
|
18
|
+
celluloid-io (0.15.0)
|
19
|
+
celluloid (>= 0.15.0)
|
20
|
+
nio4r (>= 0.5.0)
|
21
|
+
childprocess (0.5.2)
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
23
|
+
coderay (1.1.0)
|
24
|
+
cucumber (1.3.14)
|
25
|
+
builder (>= 2.1.2)
|
26
|
+
diff-lcs (>= 1.1.3)
|
27
|
+
gherkin (~> 2.12)
|
28
|
+
multi_json (>= 1.7.5, < 2.0)
|
29
|
+
multi_test (>= 0.1.1)
|
30
|
+
diff-lcs (1.2.5)
|
31
|
+
ffi (1.9.3)
|
32
|
+
formatador (0.2.4)
|
33
|
+
gherkin (2.12.2)
|
34
|
+
multi_json (~> 1.3)
|
35
|
+
guard (2.6.0)
|
36
|
+
formatador (>= 0.2.4)
|
37
|
+
listen (~> 2.7)
|
38
|
+
lumberjack (~> 1.0)
|
39
|
+
pry (>= 0.9.12)
|
40
|
+
thor (>= 0.18.1)
|
41
|
+
guard-cucumber (1.4.1)
|
42
|
+
cucumber (>= 1.2.0)
|
43
|
+
guard (>= 1.1.0)
|
44
|
+
guard-rspec (4.2.8)
|
45
|
+
guard (~> 2.1)
|
46
|
+
rspec (>= 2.14, < 4.0)
|
47
|
+
json (1.8.1)
|
48
|
+
listen (2.7.1)
|
49
|
+
celluloid (>= 0.15.2)
|
50
|
+
celluloid-io (>= 0.15.0)
|
51
|
+
rb-fsevent (>= 0.9.3)
|
52
|
+
rb-inotify (>= 0.9)
|
53
|
+
lumberjack (1.0.5)
|
54
|
+
methadone (1.3.2)
|
55
|
+
bundler
|
56
|
+
method_source (0.8.2)
|
57
|
+
multi_json (1.9.2)
|
58
|
+
multi_test (0.1.1)
|
59
|
+
nio4r (1.0.0)
|
60
|
+
pry (0.9.12.6)
|
61
|
+
coderay (~> 1.0)
|
62
|
+
method_source (~> 0.8)
|
63
|
+
slop (~> 3.4)
|
64
|
+
rake (0.9.6)
|
65
|
+
rb-fsevent (0.9.4)
|
66
|
+
rb-inotify (0.9.3)
|
67
|
+
ffi (>= 0.5.0)
|
68
|
+
rdoc (4.1.1)
|
69
|
+
json (~> 1.4)
|
70
|
+
rspec (2.14.1)
|
71
|
+
rspec-core (~> 2.14.0)
|
72
|
+
rspec-expectations (~> 2.14.0)
|
73
|
+
rspec-mocks (~> 2.14.0)
|
74
|
+
rspec-core (2.14.8)
|
75
|
+
rspec-expectations (2.14.5)
|
76
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
77
|
+
rspec-mocks (2.14.6)
|
78
|
+
slop (3.5.0)
|
79
|
+
thor (0.19.1)
|
80
|
+
timers (1.1.0)
|
81
|
+
|
82
|
+
PLATFORMS
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
aruba
|
87
|
+
bundler (~> 1.5)
|
88
|
+
fasta_read!
|
89
|
+
guard-cucumber
|
90
|
+
guard-rspec
|
91
|
+
rdoc
|
92
|
+
rspec
|
data/Guardfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'cucumber', all_on_start: false, change_format: "pretty" do
|
5
|
+
|
6
|
+
watch(%r{^bin/.+$}) { 'features' }
|
7
|
+
watch(%r{^lib/.+$}) { 'features' }
|
8
|
+
watch(%r{^features/.+\.feature$})
|
9
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
10
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
11
|
+
end
|
12
|
+
|
13
|
+
guard :rspec do
|
14
|
+
watch(%r{^spec/.+_spec\.rb$})
|
15
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
16
|
+
watch('spec/spec_helper.rb') { "spec" }
|
17
|
+
|
18
|
+
# Rails example
|
19
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
20
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
21
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
22
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
23
|
+
watch('config/routes.rb') { "spec/routing" }
|
24
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
25
|
+
|
26
|
+
# Capybara features specs
|
27
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
28
|
+
|
29
|
+
# Turnip features and steps
|
30
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
31
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
32
|
+
end
|
33
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2014 YOUR NAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# FastaRead
|
2
|
+
|
3
|
+
A Ruby command-line program that will take coordinates and return either a unmasked sequence or a snp-masked sequence. The coordinates refer to the start and stop positions, and are "UCSC coordinates" i.e. 0 based and half open (see [UCSC_coordinate_transforms](http://genomewiki.ucsc.edu/index.php/Coordinate_Transforms))
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'fasta_read'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install fasta_read
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
fasta_read [options] assembly chromosome cstart cend
|
22
|
+
|
23
|
+
## Example
|
24
|
+
|
25
|
+
fasta_read hg19 chr12 112123514 112123790 --output=out.txt
|
26
|
+
|
27
|
+
Options:
|
28
|
+
-h, --help Show command line help
|
29
|
+
-o, --output OUTPUTFILE outputs sequence to a file
|
30
|
+
--snp return the sequence from the SNP-masked assembly
|
31
|
+
--version Show help/version info
|
32
|
+
--log-level LEVEL Set the logging level
|
33
|
+
(debug|info|warn|error|fatal)
|
34
|
+
(Default: info)
|
35
|
+
|
36
|
+
## Arguments
|
37
|
+
|
38
|
+
assembly
|
39
|
+
assembly name (hg19, mm10, etc.)
|
40
|
+
chromosome
|
41
|
+
id of chromosome (1-22 or X/Y)
|
42
|
+
cstart
|
43
|
+
start coordinate (inclusive) within the chromosome
|
44
|
+
cend
|
45
|
+
end coordinate within the chromosome
|
46
|
+
|
47
|
+
## Program output
|
48
|
+
|
49
|
+
stdout: Extracted sequence (only)
|
50
|
+
|
51
|
+
stderr: Any errors.
|
52
|
+
|
53
|
+
using --output option export the sequence to a file
|
54
|
+
|
55
|
+
## Supporting Requirements
|
56
|
+
|
57
|
+
The program depends on being run at the top of a directory tree containing .fa files. The .fa files should be of the form where each file maps to a single chomosome.
|
58
|
+
|
59
|
+
The directory tree will have separate branches for SNPs and unmasked files.
|
60
|
+
|
61
|
+
/fasta/hg19/unmasked/chr1.fa
|
62
|
+
/fasta/hg19/unmasked/chr2.fa
|
63
|
+
/fasta/hg19/unmasked/chr3.fa
|
64
|
+
........
|
65
|
+
/fasta/hg19/snp/chr1.subst.fa
|
66
|
+
/fasta/hg19/snp/chr2.subst.fa
|
67
|
+
/fasta/hg19/snp/chr3.subst.fa
|
68
|
+
.......
|
69
|
+
/fasta/mm10/unmasked/chr1.fa
|
70
|
+
/fasta/mm10/unmasked/chr2.fa
|
71
|
+
/fasta/mm10/unmasked/chr3.fa
|
72
|
+
........
|
73
|
+
/fasta/mm10/snp/chr1.subst.fa
|
74
|
+
/fasta/mm10/snp/chr2.subst.fa
|
75
|
+
/fasta/mm10/snp/chr3.subst.fa
|
76
|
+
.......
|
77
|
+
|
78
|
+
http://hgdownload.cse.ucsc.edu/goldenPath/hg19/chromosomes/
|
79
|
+
http://hgdownload.cse.ucsc.edu/goldenPath/hg19/snp138Mask/
|
80
|
+
|
81
|
+
## Contributing
|
82
|
+
|
83
|
+
1. Fork it ( http://github.com/sfcarroll/ruby-fasta-read/fork )
|
84
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
85
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
86
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
87
|
+
5. Create new Pull Request
|
data/README.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
= fasta_read - DESCRIBE YOUR GEM
|
2
|
+
|
3
|
+
Author:: YOUR NAME (YOUR EMAIL)
|
4
|
+
Copyright:: Copyright (c) 2014 YOUR NAME
|
5
|
+
|
6
|
+
|
7
|
+
License:: mit, see LICENSE.txt
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
DESCRIBE YOUR GEM HERE
|
12
|
+
|
13
|
+
== Links
|
14
|
+
|
15
|
+
* {Source on Github}[LINK TO GITHUB]
|
16
|
+
* RDoc[LINK TO RDOC.INFO]
|
17
|
+
|
18
|
+
== Install
|
19
|
+
|
20
|
+
== Examples
|
21
|
+
|
22
|
+
== Contributing
|
23
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
def dump_load_path
|
2
|
+
puts $LOAD_PATH.join("\n")
|
3
|
+
found = nil
|
4
|
+
$LOAD_PATH.each do |path|
|
5
|
+
if File.exists?(File.join(path,"rspec"))
|
6
|
+
puts "Found rspec in #{path}"
|
7
|
+
if File.exists?(File.join(path,"rspec","core"))
|
8
|
+
puts "Found core"
|
9
|
+
if File.exists?(File.join(path,"rspec","core","rake_task"))
|
10
|
+
puts "Found rake_task"
|
11
|
+
found = path
|
12
|
+
else
|
13
|
+
puts "!! no rake_task"
|
14
|
+
end
|
15
|
+
else
|
16
|
+
puts "!!! no core"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if found.nil?
|
21
|
+
puts "Didn't find rspec/core/rake_task anywhere"
|
22
|
+
else
|
23
|
+
puts "Found in #{path}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
require 'bundler'
|
27
|
+
require 'rake/clean'
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
rescue LoadError
|
32
|
+
dump_load_path
|
33
|
+
raise
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'cucumber/rake/task'
|
37
|
+
gem 'rdoc' # we need the installed RDoc gem, not the system one
|
38
|
+
require 'rdoc/task'
|
39
|
+
|
40
|
+
include Rake::DSL
|
41
|
+
|
42
|
+
Bundler::GemHelper.install_tasks
|
43
|
+
|
44
|
+
|
45
|
+
RSpec::Core::RakeTask.new do |t|
|
46
|
+
# Put spec opts in a file named .rspec in root
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
CUKE_RESULTS = 'results.html'
|
51
|
+
CLEAN << CUKE_RESULTS
|
52
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
53
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
|
54
|
+
t.fork = false
|
55
|
+
end
|
56
|
+
|
57
|
+
Rake::RDocTask.new do |rd|
|
58
|
+
|
59
|
+
rd.main = "README.rdoc"
|
60
|
+
|
61
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Run Cucumber features"
|
65
|
+
task :default => [:features]
|
66
|
+
|
data/bin/fasta_read
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'methadone'
|
5
|
+
require 'fasta_read.rb'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
class App
|
9
|
+
include Methadone::Main
|
10
|
+
include Methadone::CLILogging
|
11
|
+
|
12
|
+
main do |assembly, chromosome, cstart, cend|
|
13
|
+
snp = masked_unmasked(options)[0]
|
14
|
+
subst = masked_unmasked(options)[1]
|
15
|
+
path = "fasta/#{assembly}/#{snp}/chr#{chromosome + subst}.fa"
|
16
|
+
|
17
|
+
debug("About to read #{assembly} #{snp} chr#{chromosome}:#{cstart}-#{cend}")
|
18
|
+
if File.exist?(path)
|
19
|
+
if options[:output]
|
20
|
+
File.open(options[:output], "w") do |file|
|
21
|
+
file.puts IO.read(path, cend.to_i - cstart.to_i, cstart.to_i)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
puts IO.read(path, cend.to_i - cstart.to_i, cstart.to_i)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
exit_now_with!(assembly_or_chromosome(assembly, chromosome))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.masked_unmasked(options)
|
32
|
+
options[:snp] ? ["snp", ".subst"] : ["unmasked", ""]
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.assembly_or_chromosome(assembly, chromosome)
|
36
|
+
Dir.exist?("fasta/#{assembly}") ? [chromosome, "chromosome"] : [assembly, "assembly"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.exit_now_with!(value_and_argument)
|
40
|
+
exit_now!(1, "the '#{value_and_argument[0]}' #{value_and_argument[1]} doesn't exist in directory structure")
|
41
|
+
end
|
42
|
+
|
43
|
+
# supplemental methods here
|
44
|
+
|
45
|
+
# Declare command-line interface here
|
46
|
+
|
47
|
+
description "Extract DNA Fasta sequence from assembly files."
|
48
|
+
#
|
49
|
+
# Accept flags via:
|
50
|
+
# on("--flag VAL","Some flag")
|
51
|
+
# options[flag] will contain VAL
|
52
|
+
#
|
53
|
+
# Specify switches via:
|
54
|
+
on "-o OUTPUTFILE", "--output", "outputs sequence to a file"
|
55
|
+
on "--snp", "return the sequence from the SNP-masked assembly"
|
56
|
+
# on("--[no-]switch","Some switch")
|
57
|
+
#
|
58
|
+
# Or, just call OptionParser methods on opts
|
59
|
+
#
|
60
|
+
# Require an argument
|
61
|
+
arg :assembly, "assembly name (hg19, mm10, etc.)"
|
62
|
+
arg :chromosome, "id of chromosome (1-22 or X/Y)"
|
63
|
+
arg :cstart, "start coordinate (inclusive) within the chromosome"
|
64
|
+
arg :cend, "end coordinate within the chromosome"
|
65
|
+
#
|
66
|
+
# # Make an argument optional
|
67
|
+
# arg :optional_arg, :optional
|
68
|
+
|
69
|
+
version FastaRead::VERSION
|
70
|
+
|
71
|
+
use_log_level_option
|
72
|
+
|
73
|
+
go!
|
74
|
+
end
|
data/fasta_read.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fasta_read/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fasta_read"
|
8
|
+
spec.version = FastaRead::VERSION
|
9
|
+
spec.authors = ["Andrea D'Amico"]
|
10
|
+
spec.email = ["andrea.damico@gmail.com"]
|
11
|
+
spec.summary = %q{Fasta sequence extracter}
|
12
|
+
spec.description = %q{Extract DNA Fasta sequence from assembly files.}
|
13
|
+
spec.homepage = "https://github.com/adamico/ruby-fasta-read"
|
14
|
+
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'methadone', '>= 1.3.2'
|
23
|
+
spec.add_development_dependency 'rake', '>= 0.9.2'
|
24
|
+
spec.add_development_dependency 'aruba', '>= 0.5.4'
|
25
|
+
spec.add_development_dependency 'rspec', '>= 2.14.1'
|
26
|
+
spec.add_development_dependency "guard-cucumber", '>= 1.4.1'
|
27
|
+
spec.add_development_dependency "guard-rspec", '>= 4.2.8'
|
28
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
Feature: My bootstrapped app kinda works
|
2
|
+
In order to get going on coding my awesome app
|
3
|
+
I want to have aruba and cucumber setup
|
4
|
+
So I don't have to do it myself
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named "fasta/hg19/unmasked/chr12.fa" with:
|
8
|
+
"""
|
9
|
+
gatccacctgcctcagcctcccagagtgctgggattataggtgtgagccactgcacccggcc
|
10
|
+
"""
|
11
|
+
And a file named "fasta/hg19/snp/chr12.subst.fa" with:
|
12
|
+
"""
|
13
|
+
GAAAACtttttcttttttttgagataggttctcactctggttgttgcccaggctggagtgca
|
14
|
+
"""
|
15
|
+
|
16
|
+
@announce
|
17
|
+
Scenario: Basic UI
|
18
|
+
When I get help for "fasta_read"
|
19
|
+
Then the exit status should be 0
|
20
|
+
And the banner should be present
|
21
|
+
And there should be a one line summary of what the app does
|
22
|
+
And the banner should include the version
|
23
|
+
And the banner should document that this app takes options
|
24
|
+
And the following options should be documented:
|
25
|
+
|--version|
|
26
|
+
|--snp |
|
27
|
+
|--output |
|
28
|
+
|-o |
|
29
|
+
And the banner should document that this app's arguments are
|
30
|
+
|assembly |which is required|
|
31
|
+
|chromosome|which is required|
|
32
|
+
|cstart |which is required|
|
33
|
+
|cend |which is required|
|
34
|
+
|
35
|
+
@announce
|
36
|
+
Scenario Outline: Happy path
|
37
|
+
Given a file named "fasta/hg19/unmasked/chr12.fa" with:
|
38
|
+
"""
|
39
|
+
gatccacctgcctcagcctcccagagtgctgggattataggtgtgagccactgcacccggcc
|
40
|
+
"""
|
41
|
+
And a file named "fasta/hg19/snp/chr12.subst.fa" with:
|
42
|
+
"""
|
43
|
+
GAAAACtttttcttttttttgagataggttctcactctggttgttgcccaggctggagtgca
|
44
|
+
"""
|
45
|
+
When I successfully run `fasta_read <options>`
|
46
|
+
Then the output should contain "<output>"
|
47
|
+
Then the output should not contain "<noutput>"
|
48
|
+
|
49
|
+
Scenarios: unmasked
|
50
|
+
|options |output |noutput|
|
51
|
+
|hg19 12 0 3 --log-level=debug |gat |cca |
|
52
|
+
|hg19 12 10 20|cctcagcctc|ccaga |
|
53
|
+
Scenarios: snp
|
54
|
+
|options |output |noutput|
|
55
|
+
|hg19 12 10 20 --snp|tctttttttt|ccaga |
|
56
|
+
|
57
|
+
@announce
|
58
|
+
Scenario: Export to file
|
59
|
+
When I successfully run `fasta_read hg19 12 10 20 --output=out.txt`
|
60
|
+
Then the file "out.txt" should contain:
|
61
|
+
"""
|
62
|
+
cctcagcctc
|
63
|
+
"""
|
64
|
+
|
65
|
+
@announce
|
66
|
+
Scenario Outline: Painful path
|
67
|
+
When I run `fasta_read <options>`
|
68
|
+
Then the stderr should contain "<output>"
|
69
|
+
Scenarios: incorrect assembly/chromosome
|
70
|
+
|options |output |
|
71
|
+
|foo 12 0 3 --log-level=debug |the 'foo' assembly doesn't exist in directory structure |
|
72
|
+
|hg19 99 0 3 --log-level=debug|the '99' chromosome doesn't exist in directory structure|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Put your step definitions here
|
2
|
+
Then(/^the banner should document that this app's arguments are$/) do |table|
|
3
|
+
expected_arguments = table.raw.map { |row|
|
4
|
+
option = row[0]
|
5
|
+
option = "[#{option}]" if row[1] == 'optional' || row[1] == 'which is optional'
|
6
|
+
option
|
7
|
+
}.join(' ')
|
8
|
+
step %(the output should contain "#{expected_arguments}")
|
9
|
+
end
|
10
|
+
|
11
|
+
Given(/^an assembly file at "(.*?)"$/) do |assembly_path|
|
12
|
+
steps %(Given a file named "#{assembly_path}")
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
require 'methadone/cucumber'
|
3
|
+
|
4
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
5
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
6
|
+
|
7
|
+
Before do
|
8
|
+
# Using "announce" causes massive warnings on 1.9.2
|
9
|
+
@puts = true
|
10
|
+
@original_rubylib = ENV['RUBYLIB']
|
11
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
After do
|
15
|
+
ENV['RUBYLIB'] = @original_rubylib
|
16
|
+
end
|
data/lib/fasta_read.rb
ADDED
data/stories.txt
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Gene-crawler runs the program without arguments
|
2
|
+
The gene-crawler user runs the program without arguments
|
3
|
+
and is shown program usage and a brief help message
|
4
|
+
(required arguments, expected types for arguments values, assemblies directory structures, etc.)
|
5
|
+
|
6
|
+
Gene-crawler runs the program with correct arguments
|
7
|
+
The gene-crawler user runs the program with correct arguments
|
8
|
+
and is shown the extracted sequence from the non-masked assembly
|
9
|
+
|
10
|
+
Gene-crawler enters snp_masked argument
|
11
|
+
The gene-crawler user runs the program with a snp_masked equalling true argument
|
12
|
+
and is shown the extracted sequence from the SNP-masked assembly
|
13
|
+
|
14
|
+
Gene-crawler runs the program with incorrect arguments
|
15
|
+
The gene-crawler user runs the program with incorrect arguments
|
16
|
+
and errors are shown (with a status code?)
|
17
|
+
|
18
|
+
Gene-crawler cannot find the provided assembly file
|
19
|
+
The gene-crawler user runs the program with a given assembly argument
|
20
|
+
and an error is shown telling which assembly is not found
|
21
|
+
|
22
|
+
Gene-crawler cannot find the provided chromosome
|
23
|
+
The gene-crawler user runs the program with a given chromosome argument
|
24
|
+
and an error is shown telling which chromosome is not found
|
25
|
+
|
26
|
+
Gene-crawler enters out of bounds stop coordinate
|
27
|
+
The gene-crawler user runs the program with an out of bounds stop coordinate argument for a given chromosome
|
28
|
+
and an error is shown telling the stop coordinate is out of bounds for the given chromosome
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fasta_read
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrea D'Amico
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: methadone
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.9.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aruba
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.4
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.4
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.14.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-cucumber
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.4.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.4.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.2.8
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.2.8
|
97
|
+
description: Extract DNA Fasta sequence from assembly files.
|
98
|
+
email:
|
99
|
+
- andrea.damico@gmail.com
|
100
|
+
executables:
|
101
|
+
- fasta_read
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
108
|
+
- Guardfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- README.rdoc
|
112
|
+
- Rakefile
|
113
|
+
- bin/fasta_read
|
114
|
+
- fasta_read.gemspec
|
115
|
+
- features/fasta_read.feature
|
116
|
+
- features/step_definitions/fasta_read_steps.rb
|
117
|
+
- features/support/env.rb
|
118
|
+
- lib/fasta_read.rb
|
119
|
+
- lib/fasta_read/version.rb
|
120
|
+
- spec/something_spec.rb
|
121
|
+
- stories.txt
|
122
|
+
homepage: https://github.com/adamico/ruby-fasta-read
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.2.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Fasta sequence extracter
|
146
|
+
test_files:
|
147
|
+
- features/fasta_read.feature
|
148
|
+
- features/step_definitions/fasta_read_steps.rb
|
149
|
+
- features/support/env.rb
|
150
|
+
- spec/something_spec.rb
|
151
|
+
has_rdoc:
|