gn_crossmap 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +11 -4
- data/exe/crossmap +1 -2
- data/lib/gn_crossmap.rb +9 -8
- data/lib/gn_crossmap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26928a347c511599c6e9a967195df956db3c1b87
|
4
|
+
data.tar.gz: 9a5208575690e25eee143712db621da7170c2240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00253061383725e4825ab528614b20df2fdfa83932ac725d7dc00a05dd4b3130627d130135a4c1ecacf3fe29c8a40e349cce8730ac6dd8a940cab2fdd27dab1f
|
7
|
+
data.tar.gz: 04a4ab00328ed2bb90e31b306a7c73631cf1b3ae70bb8f23ce94b6792f79b696cd5d1e0870ef2079e58d4ddb7dab8b887801cc72ddd2522ae9458042bad8d252
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -68,7 +68,10 @@ Compares an input list to a data source from [GN Resolver][resolver] and
|
|
68
68
|
writes result into an output file.
|
69
69
|
|
70
70
|
```ruby
|
71
|
-
|
71
|
+
|
72
|
+
opts = { input: input, output: output, data_source_id: 1 ,
|
73
|
+
skip_original: true, alt_headers: [] }
|
74
|
+
GnCrossmap.run(opts)
|
72
75
|
```
|
73
76
|
|
74
77
|
``input``
|
@@ -102,19 +105,23 @@ require "gn_crossmap"
|
|
102
105
|
|
103
106
|
GnCrossmap.logger = MyCustomLogger.new
|
104
107
|
|
108
|
+
opts = { input: "path/to/input.csv", output: "path/to/output.csv,
|
109
|
+
data_source_id: 5 , skip_original: true }
|
105
110
|
GnCrossmap.run("path/to/input.csv", "path/to/output.csv", 5, true)
|
106
111
|
|
107
112
|
# if you want to use alternative headers instead of ones supplied in a file
|
108
113
|
|
109
|
-
|
110
|
-
|
114
|
+
opts = { input: "path/to/input.csv", output: "path/to/output.csv,
|
115
|
+
data_source_id: 5 , skip_original: true,
|
116
|
+
alt_headers: %w(taxonId, scientificName, rank) }
|
117
|
+
GnCrossmap.run(opts)
|
111
118
|
```
|
112
119
|
|
113
120
|
If you want to get intermediate statistics for each resolution cycle use a
|
114
121
|
block:
|
115
122
|
|
116
123
|
```ruby
|
117
|
-
GnCrossmap.run(
|
124
|
+
GnCrossmap.run(opts) do |stats|
|
118
125
|
puts stats
|
119
126
|
puts "Matches:"
|
120
127
|
stats[:matches].each do |key, value|
|
data/exe/crossmap
CHANGED
@@ -26,8 +26,7 @@ unless File.exist?(opts[:input]) || opts[:input] == "-"
|
|
26
26
|
end
|
27
27
|
|
28
28
|
begin
|
29
|
-
GnCrossmap.run(opts
|
30
|
-
opts[:skip_original])
|
29
|
+
GnCrossmap.run(opts)
|
31
30
|
rescue GnCrossmapError => e
|
32
31
|
GnCrossmap.logger.error(e.message)
|
33
32
|
end
|
data/lib/gn_crossmap.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "csv"
|
2
|
+
require "ostruct"
|
2
3
|
require "rest_client"
|
3
4
|
require "tempfile"
|
4
5
|
require "logger"
|
@@ -35,17 +36,17 @@ module GnCrossmap
|
|
35
36
|
|
36
37
|
# rubocop:disable Metrics/AbcSize
|
37
38
|
|
38
|
-
def run(
|
39
|
-
|
40
|
-
input_io, output_io = io(input, output)
|
41
|
-
reader = Reader.new(input_io, input_name(input),
|
42
|
-
skip_original, alt_headers, stats)
|
39
|
+
def run(opts)
|
40
|
+
opts = OpenStruct.new({ stats: Stats.new, alt_headers: [] }.merge(opts))
|
41
|
+
input_io, output_io = io(opts.input, opts.output)
|
42
|
+
reader = Reader.new(input_io, input_name(opts.input),
|
43
|
+
opts.skip_original, opts.alt_headers, opts.stats)
|
43
44
|
data = block_given? ? reader.read(&Proc.new) : reader.read
|
44
45
|
writer = Writer.new(output_io, reader.original_fields,
|
45
|
-
output_name(output))
|
46
|
-
resolver = Resolver.new(writer, data_source_id, stats)
|
46
|
+
output_name(opts.output))
|
47
|
+
resolver = Resolver.new(writer, opts.data_source_id, opts.stats)
|
47
48
|
block_given? ? resolver.resolve(data, &Proc.new) : resolver.resolve(data)
|
48
|
-
output
|
49
|
+
opts.output
|
49
50
|
end
|
50
51
|
|
51
52
|
# rubocop:enable all
|
data/lib/gn_crossmap/version.rb
CHANGED
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:
|
4
|
+
version: 2.0.0
|
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-01-
|
11
|
+
date: 2017-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|