gn_crossmap 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Rakefile +1 -1
- data/gn_crossmap.gemspec +1 -0
- data/lib/gn_crossmap/collector.rb +4 -3
- data/lib/gn_crossmap/column_collector.rb +3 -3
- data/lib/gn_crossmap/reader.rb +11 -1
- data/lib/gn_crossmap/version.rb +1 -1
- data/lib/gn_crossmap/writer.rb +2 -2
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 622626c52d655a7b098dc7d6f6e36bb861f2efa3
|
4
|
+
data.tar.gz: f28718b24dada45b2caeafd6f9a86b2807910e48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 302d0ece173f9d542aeaeabdff469656528a682696ab7cfac5de13d40a55a81f4de691cc6a1948989f40418e6a566751f5c7a8efecbe8fe92cb00ae2bd1dcaad
|
7
|
+
data.tar.gz: a91e936f6e8e003b99fb24a9036f7d64e789780ca57cb7a3bf22ef69274e23dc802c3698dac6255782f4fe82723a9e25ec50aef4b53f4dd18fcddb2228d3e7ae
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
data/gn_crossmap.gemspec
CHANGED
@@ -41,6 +41,7 @@ Gem::Specification.new do |gem|
|
|
41
41
|
gem.add_development_dependency "rspec", "~> 3.2"
|
42
42
|
gem.add_development_dependency "rubocop", "~> 0.31"
|
43
43
|
gem.add_development_dependency "coveralls", "~> 0.8"
|
44
|
+
gem.add_development_dependency "byebug", "~> 9.0"
|
44
45
|
end
|
45
46
|
|
46
47
|
# rubocop:enable Metrics/BlockLength:
|
@@ -30,15 +30,16 @@ module GnCrossmap
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def collect_data
|
33
|
-
@row = @fields.zip(@row)
|
34
|
-
|
33
|
+
@row = @fields.zip(@row)
|
34
|
+
@row_hash = @row.to_h
|
35
|
+
data = @collector.id_name_rank(@row_hash)
|
35
36
|
return unless data
|
36
37
|
data[:original] = prepare_original
|
37
38
|
@data << data
|
38
39
|
end
|
39
40
|
|
40
41
|
def prepare_original
|
41
|
-
@skip_original ? [@
|
42
|
+
@skip_original ? [@row_hash[:taxonid]] : @row.map(&:last)
|
42
43
|
end
|
43
44
|
|
44
45
|
def collector_factory
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module GnCrossmap
|
2
2
|
# Assemble data from CSV reader by checking column fields
|
3
3
|
class ColumnCollector
|
4
|
-
RANKS = %i
|
4
|
+
RANKS = %i[kingdom subkingdom phylum subphylum superclass class
|
5
5
|
subclass cohort superorder order suborder infraorder superfamily
|
6
6
|
family subfamily tribe subtribe genus subgenus section species
|
7
|
-
subspecies variety form
|
8
|
-
SPECIES_RANKS = %i
|
7
|
+
subspecies variety form].freeze
|
8
|
+
SPECIES_RANKS = %i[genus species subspecies variety form].freeze
|
9
9
|
|
10
10
|
def initialize(fields)
|
11
11
|
@fields = fields
|
data/lib/gn_crossmap/reader.rb
CHANGED
@@ -70,10 +70,20 @@ module GnCrossmap
|
|
70
70
|
|
71
71
|
def process_headers(row)
|
72
72
|
@original_fields = headers(row)
|
73
|
-
row = @alt_headers
|
73
|
+
row = produce_alt_headers(row) if @alt_headers && !@alt_headers.empty?
|
74
74
|
row
|
75
75
|
end
|
76
76
|
|
77
|
+
def produce_alt_headers(row)
|
78
|
+
tail_size = row.size - @alt_headers.size
|
79
|
+
if tail_size <= 0
|
80
|
+
@alt_headers = @alt_headers[0..row.size - 1]
|
81
|
+
else
|
82
|
+
tail_size.times { @alt_headers << "" }
|
83
|
+
end
|
84
|
+
@alt_headers = @alt_headers.map { |h| h.nil? ? "" : h }
|
85
|
+
end
|
86
|
+
|
77
87
|
def log_progress(count)
|
78
88
|
return false unless (count % 1_000).zero?
|
79
89
|
GnCrossmap.log("Ingesting csv row #{count + 1}")
|
data/lib/gn_crossmap/version.rb
CHANGED
data/lib/gn_crossmap/writer.rb
CHANGED
@@ -22,10 +22,10 @@ module GnCrossmap
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def output_fields(original_fields)
|
25
|
-
original_fields + %i
|
25
|
+
original_fields + %i[matchedType inputName matchedName
|
26
26
|
matchedCanonicalForm inputRank matchedRank
|
27
27
|
synonymStatus acceptedName matchedEditDistance
|
28
|
-
matchedScore matchTaxonID
|
28
|
+
matchedScore matchTaxonID]
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gn_crossmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Mozzherin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.8'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: byebug
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '9.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '9.0'
|
153
167
|
description: Gem uses a checklist in a comma-separated format as an input, and returns
|
154
168
|
back a new comma-separated list crossmapping the scientific names to one of the
|
155
169
|
data sources from http://resolver.globalnames.org
|
@@ -204,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
218
|
version: '0'
|
205
219
|
requirements: []
|
206
220
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
221
|
+
rubygems_version: 2.6.11
|
208
222
|
signing_key:
|
209
223
|
specification_version: 4
|
210
224
|
summary: Crossmaps a list of scientific names to names from a data source in GN Index
|