rbbt-util 5.26.12 → 5.26.13

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
  SHA256:
3
- metadata.gz: 5a26934f329b7164d590e5e56b3c652395aed839642f30143c6f73cb42b4de12
4
- data.tar.gz: ec812f3cd06f25081bfdcd0bff71a8382a8813d69ecb91ecf84a7df5c4d01899
3
+ metadata.gz: '078d0e5f58ba3c4bffecee8dc71be5040d628548988dce67027cbfe232709f5a'
4
+ data.tar.gz: 4003e46456bb1b9d295b7d5af5c11c60cc64026a204a8f8eec48f258f2043999
5
5
  SHA512:
6
- metadata.gz: 1da22127c3b3674fd0c96d43d86355b1c79d9dcb75a7f6b82ed22f147530f6cef618b425cc556dcbe7ddd810e5c1ef05d44bef86c978f51ff29613ad8a0f33cd
7
- data.tar.gz: c79ba4273b3c50625976d6a07cb9545bdd7a5e42380cab89cbe12f0ab28cd452238e61c937e16e558889f78e6f35f77b083413a389d7a44cd02e56b212880e35
6
+ metadata.gz: 4084802c7d8e72c953b917bb2dad8ee55918ea26285da8ab89bd22b6675c32d7e70b11eab4df072d45dbbaed460f7f375814b2e1dc679501e34fd42232407ee7
7
+ data.tar.gz: bfe0152f5d9cde983ae27f722ab0e695a5e38b72a6d0f27430eaf837962dab66e91f2f0157bde3dbaf06bc224bae072a7577a6abc0d273970b537c20578d604e
@@ -113,7 +113,6 @@ module Association
113
113
  def self.open_stream(stream, options = {})
114
114
  fields, persist, data = Misc.process_options options, :fields, :persist, :data
115
115
 
116
-
117
116
  parser = TSV::Parser.new stream, options.merge(:fields => nil, :key_field => nil)
118
117
  options = options.merge(parser.options)
119
118
  options = Misc.add_defaults options, :type => :double, :merge => true
@@ -124,6 +123,8 @@ module Association
124
123
 
125
124
  parser.key_field = source_pos
126
125
  parser.fields = field_pos
126
+ parser.field_positions = field_pos
127
+ parser.key_position = source_pos
127
128
 
128
129
  #case parser.type
129
130
  #when :single
@@ -160,9 +161,10 @@ module Association
160
161
  data ||= {}
161
162
  tsv = nil
162
163
  TmpFile.with_file do |tmpfile|
163
- tmp_data = Persist.open_database(tmpfile, true, :double, "HDB")
164
+ tmp_data = Persist.open_database(tmpfile, true, open_options[:type], "HDB")
164
165
 
165
166
  tsv = TSV.parse parser.stream, tmp_data, open_options
167
+ tsv = tsv.to_double
166
168
  tsv.key_field = source_header
167
169
  tsv.fields = field_headers
168
170
 
@@ -152,7 +152,8 @@ module Association
152
152
  target_format = process_formats(specs[:target][1] || specs[:target][0], format) || target_format unless target_format
153
153
  end
154
154
 
155
- Log.low "Headers -- #{[source_pos, field_pos, source_header, field_headers, source_format, target_format]}"
156
- [source_pos, field_pos, source_header, field_headers, source_format, target_format]
155
+ res = [source_pos, field_pos, source_header, field_headers, source_format, target_format]
156
+ Log.low "Headers -- #{res}"
157
+ res
157
158
  end
158
159
  end
@@ -356,7 +356,6 @@ module TSV
356
356
  key_field = Misc.process_options options, :key_field
357
357
  fields = Misc.process_options options, :fields
358
358
 
359
-
360
359
  if (key_field.nil? or key_field == 0 or key_field == :key) and
361
360
  (fields.nil? or fields == @fields or (not @fields.nil? and fields == (1..@fields.length).to_a))
362
361
 
@@ -18,7 +18,7 @@ module Workflow
18
18
  :description => "",
19
19
  :result_type => nil,
20
20
  :result_description => "",
21
- :extension => '')
21
+ :extension => nil)
22
22
 
23
23
 
24
24
  def helper(name, &block)
@@ -108,7 +108,20 @@ module Workflow
108
108
  :extension => consume_extension,
109
109
  :input_options => consume_input_options
110
110
  }
111
-
111
+
112
+ task_info[:extension] = case task_info[:result_type].to_s
113
+ when "tsv"
114
+ "tsv"
115
+ when "yaml"
116
+ "yaml"
117
+ when "marshal"
118
+ "marshal"
119
+ when "json"
120
+ "json"
121
+ else
122
+ nil
123
+ end if task_info[:extension].nil?
124
+
112
125
  task = Task.setup(task_info, &block)
113
126
 
114
127
  last_task = task
data/share/Rlib/util.R CHANGED
@@ -757,7 +757,7 @@ rbbt.install.bioc <-function(pkg){
757
757
  rbbt.install.biocManager <-function(pkg, ...){
758
758
  cat("Try BiocManager install:", pkg, "\n")
759
759
  res = FALSE
760
- tryCatch({ BiocManager::install(pkg, ...) }, error = function(e){ warning(paste("Could not install BiocManager ", pkg, "\n")); res = FALSE })
760
+ tryCatch({ BiocManager::install(pkg, ...); res = TRUE }, error = function(e){ warning(paste("Could not install BiocManager ", pkg, "\n")); res = FALSE })
761
761
  return(res)
762
762
  }
763
763
 
@@ -782,8 +782,8 @@ rbbt.require <- function(pkg, ...){
782
782
  for (pkg in new.packages){
783
783
  if (!rbbt.install.github(pkg, ...)){
784
784
  if (!rbbt.install.CRAN(pkg, ...)){
785
+ if (!rbbt.install.biocManager(pkg, ...)){
785
786
  if (!rbbt.install.bioc(pkg, ...)){
786
- if (!rbbt.install.biocManager(pkg, ...)){
787
787
  stop("Error!", pkg)
788
788
  }
789
789
  }
@@ -59,7 +59,8 @@ TP53 NFKB1|GLI1 activation|activation true|true
59
59
  end
60
60
 
61
61
  def test_gene_ages
62
- assert Association.database('/home/mvazquezg/git/workflows/genomics/share/gene_ages', :source => "FamilyAge", :merge => true, :target => "Ensembl Gene ID", :persist => false).values.first.length > 1
62
+ file = datafile_test('gene_ages')
63
+ assert Association.database(file, :source => "FamilyAge", :merge => true, :target => "Ensembl Gene ID", :persist => false).values.first.length > 1
63
64
  end
64
65
 
65
66
  def __test_reorder_multiple_mismatch
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.26.12
4
+ version: 5.26.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-28 00:00:00.000000000 Z
11
+ date: 2019-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake