taxonifi 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +24 -7
- data/README.rdoc +5 -6
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/assessor/row_assessor.rb +25 -18
- data/lib/export/format/base.rb +96 -1
- data/lib/export/format/obo_nomenclature.rb +71 -0
- data/lib/export/format/prolog.rb +59 -0
- data/lib/export/format/species_file.rb +303 -193
- data/lib/lumper/clump.rb +112 -0
- data/lib/lumper/lumper.rb +71 -45
- data/lib/lumper/lumps/parent_child_name_collection.rb +79 -15
- data/lib/models/author_year.rb +1 -2
- data/lib/models/base.rb +56 -51
- data/lib/models/collection.rb +16 -1
- data/lib/models/name.rb +56 -15
- data/lib/models/name_collection.rb +70 -19
- data/lib/models/ref.rb +17 -0
- data/lib/models/ref_collection.rb +2 -1
- data/lib/models/shared_class_methods.rb +29 -0
- data/lib/models/species_name.rb +14 -12
- data/lib/splitter/parser.rb +1 -2
- data/lib/splitter/tokens.rb +1 -1
- data/lib/taxonifi.rb +12 -0
- data/lib/utils/array.rb +17 -0
- data/lib/utils/hash.rb +17 -0
- data/taxonifi.gemspec +116 -0
- data/test/file_fixtures/Fossil.csv +11 -0
- data/test/file_fixtures/Lygaeoidea.csv +1 -1
- data/test/file_fixtures/names.csv +1 -0
- data/test/helper.rb +14 -0
- data/test/test_export_prolog.rb +14 -0
- data/test/test_exporter.rb +23 -0
- data/test/test_lumper_clump.rb +75 -0
- data/test/test_lumper_names.rb +67 -9
- data/test/test_lumper_parent_child_name_collection.rb +47 -3
- data/test/test_lumper_refs.rb +22 -7
- data/test/test_obo_nomenclature.rb +14 -0
- data/test/test_parser.rb +4 -2
- data/test/test_splitter_tokens.rb +9 -0
- data/test/test_taxonifi_accessor.rb +21 -15
- data/test/test_taxonifi_base.rb +25 -0
- data/test/test_taxonifi_name.rb +41 -4
- data/test/test_taxonifi_name_collection.rb +54 -17
- data/test/test_taxonifi_species_name.rb +1 -1
- metadata +34 -5
@@ -1,8 +1,13 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/models/name_collection'))
|
3
2
|
|
4
3
|
class TestTaxonifiNameCollection < Test::Unit::TestCase
|
5
4
|
|
5
|
+
def test_that_name_collections_have_collections
|
6
|
+
c = Taxonifi::Model::NameCollection.new
|
7
|
+
assert c.respond_to?(:collection)
|
8
|
+
assert_equal([], c.collection)
|
9
|
+
end
|
10
|
+
|
6
11
|
def test_that_add_objects_adds_to_collection
|
7
12
|
c = Taxonifi::Model::NameCollection.new
|
8
13
|
n = Taxonifi::Model::Name.new
|
@@ -10,12 +15,6 @@ class TestTaxonifiNameCollection < Test::Unit::TestCase
|
|
10
15
|
assert_equal(1, c.collection.size)
|
11
16
|
end
|
12
17
|
|
13
|
-
def test_that_name_collections_have_collections
|
14
|
-
c = Taxonifi::Model::NameCollection.new
|
15
|
-
assert c.respond_to?(:collection)
|
16
|
-
assert_equal([], c.collection)
|
17
|
-
end
|
18
|
-
|
19
18
|
def test_that_name_collection_returns_encompassing_rank
|
20
19
|
c = Taxonifi::Model::NameCollection.new
|
21
20
|
n = Taxonifi::Model::Name.new
|
@@ -108,21 +107,58 @@ class TestTaxonifiNameCollection < Test::Unit::TestCase
|
|
108
107
|
assert_equal "Fooidae", c.by_name_index['family'].keys.first
|
109
108
|
end
|
110
109
|
|
110
|
+
|
111
111
|
def test_name_exists?
|
112
112
|
c = Taxonifi::Model::NameCollection.new
|
113
|
-
n1 = Taxonifi::Model::Name.new(:
|
114
|
-
n2 = Taxonifi::Model::Name.new(:
|
115
|
-
n3 = Taxonifi::Model::Name.new(:
|
116
|
-
n4 = Taxonifi::Model::Name.new(:
|
117
|
-
n5 = Taxonifi::Model::Name.new(:
|
118
|
-
n6 = Taxonifi::Model::Name.new(:
|
113
|
+
n1 = Taxonifi::Model::Name.new(name: "Fooidae", rank: "family", author: nil , year: nil)
|
114
|
+
n2 = Taxonifi::Model::Name.new(name: "Bar", rank: "genus", author: nil , year: nil, :parent => n1)
|
115
|
+
n3 = Taxonifi::Model::Name.new(name: "Bar", rank: "genus", author: nil , year: nil, :parent => n1)
|
116
|
+
n4 = Taxonifi::Model::Name.new(name: "Bar", rank: "subgenus", author: nil , year: nil, :parent => n2)
|
117
|
+
n5 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: 'Smith', year: 1920, :parent => n2)
|
118
|
+
n6 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: 'Smith', year: 1920, :parent => n2)
|
119
|
+
n7 = Taxonifi::Model::Name.new(name: "Blorf", rank: "genus", author: 'Smith', year: 1920, :parent => n1)
|
120
|
+
n8 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: 'Smith', year: 1920, :parent => n7)
|
121
|
+
n9 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: 'Jones', year: nil, :parent => n7)
|
122
|
+
n10 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: 'Jones', year: nil, :parent => n7)
|
123
|
+
n11 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: nil , year: 1920, :parent => n7)
|
124
|
+
n12 = Taxonifi::Model::Name.new(name: "foo", rank: "species", author: nil , year: 1920, :parent => n7)
|
125
|
+
n13 = Taxonifi::Model::Name.new(name: "foo", rank: "subspecies", author: nil , year: 1920, :parent => n11)
|
126
|
+
|
127
|
+
# Given this set test that the following are identical (and that all others are not):
|
128
|
+
# n2 = n3 # parent/name/rank
|
129
|
+
# n5 = n6 # parent/name/rank/author/year
|
130
|
+
# n9 = n10 # parent/name/rank/author
|
131
|
+
# n11 = n12 # parent/name/year
|
132
|
+
# n13 = n11 # parent/nominotypic name
|
133
|
+
|
119
134
|
c.add_object(n1)
|
135
|
+
|
120
136
|
c.add_object(n2)
|
137
|
+
assert c.name_exists?(n3), "Name exists, but not caught."
|
138
|
+
|
139
|
+
assert c.name_exists?(n4), "Nominotypical subgenus exists."
|
140
|
+
|
121
141
|
c.add_object(n5)
|
122
|
-
assert c.name_exists?(
|
123
|
-
|
124
|
-
assert !c.name_exists?(
|
125
|
-
|
142
|
+
assert c.name_exists?(n6), "Name exists, but not caught."
|
143
|
+
|
144
|
+
assert !c.name_exists?(n7), "Name doesn't exist, but asserted to."
|
145
|
+
c.add_object(n7)
|
146
|
+
|
147
|
+
assert !c.name_exists?(n8), "Name doesn't exist, but asserted to."
|
148
|
+
c.add_object(n8)
|
149
|
+
assert !c.name_exists?(n9), "Name doesn't exist, but asserted to."
|
150
|
+
c.add_object(n9)
|
151
|
+
assert c.name_exists?(n10), "Name exists and wasn't caught."
|
152
|
+
|
153
|
+
assert !c.name_exists?(n11)
|
154
|
+
c.add_object(n11)
|
155
|
+
assert c.name_exists?(n12)
|
156
|
+
|
157
|
+
assert c.name_exists?(n13)
|
158
|
+
|
159
|
+
assert_equal n2.id, c.name_exists?(n3)
|
160
|
+
assert_equal n9.id, c.name_exists?(n10)
|
161
|
+
assert_equal n11.id, c.name_exists?(n12)
|
126
162
|
end
|
127
163
|
|
128
164
|
def test_that_name_collection_generate_ref_collection
|
@@ -154,5 +190,6 @@ class TestTaxonifiNameCollection < Test::Unit::TestCase
|
|
154
190
|
foo = 1
|
155
191
|
end
|
156
192
|
|
193
|
+
|
157
194
|
end
|
158
195
|
|
@@ -88,7 +88,7 @@ class TestTaxonifiSpeciesName < Test::Unit::TestCase
|
|
88
88
|
sn3 = Taxonifi::Model::SpeciesName.new(:genus => g, :subgenus => sg, :species => s, :subspecies => ss)
|
89
89
|
assert_equal "Foo (Bar) stuff things Jones, 2012", sn3.display_name
|
90
90
|
|
91
|
-
ss.parens =
|
91
|
+
ss.parens = true
|
92
92
|
assert_equal "Foo (Bar) stuff things (Jones, 2012)", sn3.display_name
|
93
93
|
end
|
94
94
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taxonifi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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:
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.8.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: activerecord
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.2.8
|
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: 3.2.8
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
79
|
name: debugger
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +112,10 @@ files:
|
|
96
112
|
- lib/assessor/row_assessor.rb
|
97
113
|
- lib/export/export.rb
|
98
114
|
- lib/export/format/base.rb
|
115
|
+
- lib/export/format/obo_nomenclature.rb
|
116
|
+
- lib/export/format/prolog.rb
|
99
117
|
- lib/export/format/species_file.rb
|
118
|
+
- lib/lumper/clump.rb
|
100
119
|
- lib/lumper/lumper.rb
|
101
120
|
- lib/lumper/lumps/parent_child_name_collection.rb
|
102
121
|
- lib/models/author_year.rb
|
@@ -110,6 +129,7 @@ files:
|
|
110
129
|
- lib/models/person.rb
|
111
130
|
- lib/models/ref.rb
|
112
131
|
- lib/models/ref_collection.rb
|
132
|
+
- lib/models/shared_class_methods.rb
|
113
133
|
- lib/models/species_name.rb
|
114
134
|
- lib/splitter/builder.rb
|
115
135
|
- lib/splitter/lexer.rb
|
@@ -117,26 +137,35 @@ files:
|
|
117
137
|
- lib/splitter/splitter.rb
|
118
138
|
- lib/splitter/tokens.rb
|
119
139
|
- lib/taxonifi.rb
|
140
|
+
- lib/utils/array.rb
|
141
|
+
- lib/utils/hash.rb
|
142
|
+
- taxonifi.gemspec
|
143
|
+
- test/file_fixtures/Fossil.csv
|
120
144
|
- test/file_fixtures/Lygaeoidea.csv
|
145
|
+
- test/file_fixtures/names.csv
|
121
146
|
- test/helper.rb
|
147
|
+
- test/test_export_prolog.rb
|
122
148
|
- test/test_exporter.rb
|
149
|
+
- test/test_lumper_clump.rb
|
123
150
|
- test/test_lumper_geogs.rb
|
124
151
|
- test/test_lumper_hierarchical_collection.rb
|
125
152
|
- test/test_lumper_names.rb
|
126
153
|
- test/test_lumper_parent_child_name_collection.rb
|
127
154
|
- test/test_lumper_refs.rb
|
155
|
+
- test/test_obo_nomenclature.rb
|
128
156
|
- test/test_parser.rb
|
129
157
|
- test/test_splitter.rb
|
130
158
|
- test/test_splitter_tokens.rb
|
131
159
|
- test/test_taxonifi.rb
|
132
160
|
- test/test_taxonifi_accessor.rb
|
161
|
+
- test/test_taxonifi_base.rb
|
133
162
|
- test/test_taxonifi_geog.rb
|
134
163
|
- test/test_taxonifi_name.rb
|
135
164
|
- test/test_taxonifi_name_collection.rb
|
136
165
|
- test/test_taxonifi_ref.rb
|
137
166
|
- test/test_taxonifi_ref_collection.rb
|
138
167
|
- test/test_taxonifi_species_name.rb
|
139
|
-
homepage: http://github.com/
|
168
|
+
homepage: http://github.com/SpeciesFile/taxonifi
|
140
169
|
licenses:
|
141
170
|
- MIT
|
142
171
|
post_install_message:
|
@@ -151,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
180
|
version: '0'
|
152
181
|
segments:
|
153
182
|
- 0
|
154
|
-
hash:
|
183
|
+
hash: -2473283969605789743
|
155
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
185
|
none: false
|
157
186
|
requirements:
|
@@ -160,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
189
|
version: '0'
|
161
190
|
requirements: []
|
162
191
|
rubyforge_project:
|
163
|
-
rubygems_version: 1.8.
|
192
|
+
rubygems_version: 1.8.25
|
164
193
|
signing_key:
|
165
194
|
specification_version: 3
|
166
195
|
summary: A general purpose framework for scripted handling of taxonomic names
|