rbbt-util 5.14.9 → 5.14.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2e935c66915d12e54d8a483af1f3ab9c0447c9c
4
- data.tar.gz: 014e991d3c4c8769e4ff480e0a9566a65f84a160
3
+ metadata.gz: cb5293895c8a68f418b08234e239bacadd00d4eb
4
+ data.tar.gz: 7e70f082d70d3ae7b878be2df3be9c36c50c33a2
5
5
  SHA512:
6
- metadata.gz: 19e5dfaf77d8755695c2bed2c0f379eb3421e7b021e93e2caaa551ccc304ad70f1c91c892d096f6d3abe689f84a6a6d43260c2d68c4b0b4c1a9ac8cb946bca81
7
- data.tar.gz: 402865585352cc0dfd319d84c40d125ee04eabab5105ea7039c05ea018ed709b27e1efb6d059da3260c8e1f78c47d1e439206cb59cfc79b5de09ce8b36eb2227
6
+ metadata.gz: 96960fe35a0668ece8cd3186d76c16ee0b8e05075d8b84be2d7b5bb32e4019d2b9040cb81fdd85934677394576cff10f62f7c4995a93d26e7f9ebebe2eeb90e5
7
+ data.tar.gz: 75814ae86c6824bd184e095c3322bd87c87e5cc67370a41d50cfce97755ad1b7895678c1d5ec38f6d0a3573dc2b6dffb253f689b35e35f90d8522dcd126f96e2
@@ -61,6 +61,16 @@ module AssociationItem
61
61
  }
62
62
  end
63
63
 
64
+ property :tsv => :array do
65
+ fields = self.info_fields
66
+ type = [self.source_type, self.target_type] * "~"
67
+ tsv = TSV.setup({}, :key_field => type, :fields => fields, :type => :list, :namespace => self.namespace)
68
+ self.each do |match|
69
+ tsv[match] = match.info.values_at *fields
70
+ end
71
+ tsv
72
+ end
73
+
64
74
  def self.incidence(pairs, key_field = nil)
65
75
  matrix = {}
66
76
  targets = []
@@ -17,6 +17,7 @@ Indicate the index file (TokyoCabinet BDB with source~target keys) as the <filen
17
17
  -h--help Print this help
18
18
  -s--source* Source entities
19
19
  -t--target* Target entities
20
+ -tsv--tsv* Output tsv
20
21
  EOF
21
22
  rbbt_usage and exit 0 if options[:help]
22
23
  filename = ARGV.shift
@@ -29,13 +30,19 @@ file.extend Association::Index
29
30
  source = options[:source] ? options[:source].split(/,\|/) : :all
30
31
  target = options[:target] ? options[:target].split(/,\|/) : :all
31
32
 
32
- file.subset(source, target).each do |item|
33
- puts Log.color(:magenta, item)
34
- info = file.fields.zip(file[item])
35
- source,_sep, target = item.partition "~"
36
- puts " " << Misc.format_definition_list_item("source", source)
37
- puts " " << Misc.format_definition_list_item("target", target)
38
- info.each do |key,value|
39
- puts " " << Misc.format_definition_list_item(key, value)
33
+ matches = file.subset(source, target)
34
+
35
+ if options[:tsv]
36
+ puts matches.tsv.to_s
37
+ else
38
+ matches.each do |item|
39
+ puts Log.color(:magenta, item)
40
+ info = file.fields.zip(file[item])
41
+ source,_sep, target = item.partition "~"
42
+ puts " " << Misc.format_definition_list_item("source", source)
43
+ puts " " << Misc.format_definition_list_item("target", target)
44
+ info.each do |key,value|
45
+ puts " " << Misc.format_definition_list_item(key, value)
46
+ end
40
47
  end
41
48
  end
@@ -20,6 +20,7 @@ Access workflow knowledge base
20
20
  -tf--target_format* Target format
21
21
  -d--details Print details on matches
22
22
  -i--identify Attempt to identify entities by identifier translation
23
+ -tsv--tsv Output TSV
23
24
  EOF
24
25
 
25
26
  workflow = ARGV.shift
@@ -60,16 +61,20 @@ when :subset
60
61
  entities = {source_format => source_entities, target_format => target_entities}
61
62
 
62
63
  matches = knowledge_base.subset(database, entities)
63
- matches.each do |item|
64
- puts Log.color :magenta, item
65
- if options[:details]
66
- source = item.source_entity
67
- target = item.target_entity
68
- source = source.name if source.respond_to? :name
69
- target = target.name if target.respond_to? :name
70
-
71
- info = item.info.merge(:source => source, :target => target)
72
- puts Misc.format_definition_list(info, 80, 20, :yellow, "\n")
64
+
65
+
66
+ if options[:tsv]
67
+ puts matches.tsv.to_s
68
+ else
69
+ matches.each do |item|
70
+ puts Log.color(:magenta, item)
71
+ info = file.fields.zip(file[item])
72
+ source,_sep, target = item.partition "~"
73
+ puts " " << Misc.format_definition_list_item("source", source)
74
+ puts " " << Misc.format_definition_list_item("target", target)
75
+ info.each do |key,value|
76
+ puts " " << Misc.format_definition_list_item(key, value)
77
+ end
73
78
  end
74
79
  end
75
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.14.9
4
+ version: 5.14.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez