Module: GnCrossmap

Defined in:
lib/gn_crossmap.rb,
lib/gn_crossmap/stats.rb,
lib/gn_crossmap/reader.rb,
lib/gn_crossmap/writer.rb,
lib/gn_crossmap/version.rb,
lib/gn_crossmap/resolver.rb,
lib/gn_crossmap/collector.rb,
lib/gn_crossmap/column_collector.rb,
lib/gn_crossmap/result_processor.rb,
lib/gn_crossmap/sci_name_collector.rb

Overview

Namespace module for crossmapping checklists to GN sources

Defined Under Namespace

Classes: Collector, ColumnCollector, Reader, Resolver, ResultProcessor, SciNameCollector, Stats, Writer

Constant Summary collapse

INPUT_MODE =
"r:utf-8"
OUTPUT_MODE =
"w:utf-8"
MATCH_TYPES =
{
  0 => "No match",
  1 => "Exact string match",
  2 => "Canonical form exact match",
  3 => "Canonical form fuzzy match",
  4 => "Partial canonical form match",
  5 => "Partial canonical form fuzzy match",
  6 => "Genus part match",
  7 => "Error in matching"
}.freeze
VERSION =
"3.1.3"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

rubocop:enable all



55
56
57
# File 'lib/gn_crossmap.rb', line 55

def logger
  @logger ||= Logger.new(STDERR)
end

Class Method Details

.find_id(row, name) ⇒ Object



63
64
65
# File 'lib/gn_crossmap.rb', line 63

def find_id(row, name)
  row.key?(:taxonid) ? row[:taxonid].strip : GnUUID.uuid(name)
end

.log(message) ⇒ Object



59
60
61
# File 'lib/gn_crossmap.rb', line 59

def log(message)
  logger.info(message)
end

.run(opts) ⇒ Object

rubocop:disable Metrics/AbcSize



42
43
44
45
46
47
48
49
50
51
# File 'lib/gn_crossmap.rb', line 42

def run(opts)
  opts = opts_struct(opts)
  input_io, output_io = io(opts.input, opts.output)
  reader = create_reader(input_io, opts)
  data = block_given? ? reader.read(&Proc.new) : reader.read
  writer = create_writer(reader, output_io, opts)
  resolver = create_resolver(writer, opts)
  block_given? ? resolver.resolve(data, &Proc.new) : resolver.resolve(data)
  resolver.stats
end

.versionObject



7
8
9
# File 'lib/gn_crossmap/version.rb', line 7

def self.version
  VERSION
end