bio-mummer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ require 'simplecov'
2
+ require 'bio'
3
+
4
+ module SimpleCov::Configuration
5
+ def clean_filters
6
+ @filters = []
7
+ end
8
+ end
9
+
10
+ SimpleCov.configure do
11
+ clean_filters
12
+ load_profile 'test_frameworks'
13
+ end
14
+
15
+ ENV["COVERAGE"] && SimpleCov.start do
16
+ add_filter "/.rvm/"
17
+ end
18
+ require 'rubygems'
19
+ require 'bundler'
20
+ begin
21
+ Bundler.setup(:default, :development)
22
+ rescue Bundler::BundlerError => e
23
+ $stderr.puts e.message
24
+ $stderr.puts "Run `bundle install` to install missing gems"
25
+ exit e.status_code
26
+ end
27
+ require 'minitest/autorun'
28
+ require 'shoulda'
29
+
30
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
31
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
32
+ require 'bio-mummer'
33
+
34
+ class MiniTest::Test
35
+ end
36
+
37
+ MiniTest.autorun
38
+
@@ -0,0 +1,57 @@
1
+ require 'helper'
2
+
3
+ class TestBioMummer < MiniTest::Test
4
+
5
+ def setup
6
+ @report = BioMummer::DeltaFile.open("test/data/out.delta")
7
+ end
8
+
9
+ should "open and close a delta file" do
10
+ assert_kind_of BioMummer::DeltaFile, @report
11
+ end
12
+
13
+ should "have enumerable alignments" do
14
+ assert_equal "reference", @report.alignments.first.refname
15
+ assert_kind_of Fixnum, @report.alignments.first.refstart
16
+ assert_equal 1, @report.alignments.first.refstart
17
+ assert_equal 2435, @report.alignments.first.refstop
18
+ assert_equal 1, @report.alignments.first.querystart
19
+ assert_equal 2435, @report.alignments.first.querystop
20
+ end
21
+
22
+ should "do basic coordinate transforms on the positive strand" do
23
+ a = BioMummer::Alignment.new('ref', 'query', 101, 150, 201, 248, true, [5,-2,3,1,1,-4])
24
+ assert_equal 201, a.ref_to_query(101)
25
+ assert_equal 202, a.ref_to_query(102)
26
+ assert_equal 203, a.ref_to_query(103)
27
+ assert_equal 204, a.ref_to_query(104)
28
+ assert_equal nil, a.ref_to_query(105)
29
+ assert_equal 205, a.ref_to_query(106)
30
+ assert_equal 207, a.ref_to_query(107)
31
+ assert_equal 208, a.ref_to_query(108)
32
+ assert_equal nil, a.ref_to_query(109)
33
+ assert_equal nil, a.ref_to_query(110)
34
+ assert_equal nil, a.ref_to_query(111)
35
+ assert_equal 209, a.ref_to_query(112)
36
+ assert_equal 217, a.ref_to_query(119)
37
+ assert_equal 248, a.ref_to_query(150)
38
+ end
39
+
40
+ should "do basic coordinate transforms on the negative strand" do
41
+ a = BioMummer::Alignment.new('ref', 'query', 101, 118, 201, 216, false, [5,-2,3,1,1,-4])
42
+ assert_equal 216, a.ref_to_query(101)
43
+ assert_equal 201, a.ref_to_query(118)
44
+ end
45
+
46
+ should "transpose a given region if it maps cleanly onto a nucmer alignment" do
47
+ query_seqs = Hash[Bio::FlatFile.open("test/data/query.fasta").map{ |e| [e.entry_id, e.naseq] }]
48
+ ref_cds_start = 26255
49
+ ref_cds_stop = 26285
50
+ ref_cds_source = 'reference'
51
+
52
+ query_name, query_start, query_stop, query_strand = @report.transpose_region(ref_cds_source, ref_cds_start, ref_cds_stop)
53
+ query = query_seqs[query_name].subseq(query_start, query_stop)
54
+ assert_equal Bio::Sequence::AA.new("MAEPSGYSVQ"), query.complement.translate
55
+ end
56
+ end
57
+
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-mummer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - robsyme
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shoulda
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jeweler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.21
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.21
69
+ - !ruby/object:Gem::Dependency
70
+ name: bio
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.4.2
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.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: rdoc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '3.12'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '3.12'
97
+ description: Help for working with the output of the .delta files produced by nucmer
98
+ and promer
99
+ email: rob.syme@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files:
103
+ - LICENSE.txt
104
+ - README.md
105
+ - README.rdoc
106
+ files:
107
+ - .document
108
+ - .travis.yml
109
+ - Gemfile
110
+ - LICENSE.txt
111
+ - README.md
112
+ - README.rdoc
113
+ - Rakefile
114
+ - VERSION
115
+ - lib/bio-mummer.rb
116
+ - lib/bio-mummer/mummer.rb
117
+ - test/data/out.delta
118
+ - test/data/query.fasta
119
+ - test/data/reference.fasta
120
+ - test/data/reference.gff
121
+ - test/helper.rb
122
+ - test/test_bio-mummer.rb
123
+ homepage: http://github.com/robsyme/bioruby-mummer
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.0.14
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Helper methods for reading .delta files
147
+ test_files: []