miga-base 0.2.0.9 → 0.2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/actions/add_result.rb +37 -0
  4. data/actions/add_taxonomy.rb +63 -0
  5. data/actions/create_dataset.rb +49 -0
  6. data/actions/create_project.rb +46 -0
  7. data/actions/daemon.rb +50 -0
  8. data/actions/date.rb +14 -0
  9. data/actions/{download_dataset → download_dataset.rb} +5 -28
  10. data/actions/find_datasets.rb +41 -0
  11. data/actions/import_datasets.rb +47 -0
  12. data/actions/index_taxonomy.rb +46 -0
  13. data/actions/list_datasets.rb +50 -0
  14. data/actions/list_files.rb +43 -0
  15. data/actions/project_info.rb +40 -0
  16. data/actions/unlink_dataset.rb +28 -0
  17. data/bin/miga +129 -33
  18. data/lib/miga/daemon.rb +48 -34
  19. data/lib/miga/dataset.rb +7 -123
  20. data/lib/miga/dataset_result.rb +177 -0
  21. data/lib/miga/project.rb +32 -12
  22. data/lib/miga/version.rb +2 -2
  23. data/scripts/_distances_functions.bash +82 -0
  24. data/scripts/_distances_noref_nomulti.bash +96 -67
  25. data/scripts/_distances_ref_nomulti.bash +54 -85
  26. data/scripts/assembly.bash +16 -3
  27. data/scripts/clade_finding.bash +20 -18
  28. data/scripts/distances.bash +2 -1
  29. data/scripts/init.bash +2 -6
  30. data/scripts/subclades.bash +4 -5
  31. data/test/common_test.rb +2 -2
  32. data/test/daemon_test.rb +73 -1
  33. data/test/project_test.rb +26 -2
  34. data/test/taxonomy_test.rb +10 -0
  35. data/test/test_helper.rb +1 -1
  36. data/utils/subclades-compile.rb +4 -2
  37. data/utils/subclades.R +140 -158
  38. metadata +48 -44
  39. data/actions/add_result +0 -58
  40. data/actions/add_taxonomy +0 -83
  41. data/actions/create_dataset +0 -61
  42. data/actions/create_project +0 -67
  43. data/actions/daemon +0 -66
  44. data/actions/find_datasets +0 -61
  45. data/actions/import_datasets +0 -83
  46. data/actions/index_taxonomy +0 -68
  47. data/actions/list_datasets +0 -81
  48. data/actions/list_files +0 -63
  49. data/actions/unlink_dataset +0 -49
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.9
4
+ version: 0.2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-13 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: daemons
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '11'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '11'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: test-unit
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3'
83
83
  description: Microbial Genomes Atlas
@@ -88,9 +88,30 @@ extensions: []
88
88
  extra_rdoc_files:
89
89
  - README.md
90
90
  files:
91
+ - Gemfile
92
+ - LICENSE
93
+ - README.md
94
+ - Rakefile
95
+ - actions/add_result.rb
96
+ - actions/add_taxonomy.rb
97
+ - actions/create_dataset.rb
98
+ - actions/create_project.rb
99
+ - actions/daemon.rb
100
+ - actions/date.rb
101
+ - actions/download_dataset.rb
102
+ - actions/find_datasets.rb
103
+ - actions/import_datasets.rb
104
+ - actions/index_taxonomy.rb
105
+ - actions/list_datasets.rb
106
+ - actions/list_files.rb
107
+ - actions/project_info.rb
108
+ - actions/unlink_dataset.rb
109
+ - bin/miga
110
+ - lib/miga.rb
91
111
  - lib/miga/common.rb
92
112
  - lib/miga/daemon.rb
93
113
  - lib/miga/dataset.rb
114
+ - lib/miga/dataset_result.rb
94
115
  - lib/miga/metadata.rb
95
116
  - lib/miga/project.rb
96
117
  - lib/miga/remote_dataset.rb
@@ -98,16 +119,7 @@ files:
98
119
  - lib/miga/tax_index.rb
99
120
  - lib/miga/taxonomy.rb
100
121
  - lib/miga/version.rb
101
- - lib/miga.rb
102
- - test/common_test.rb
103
- - test/daemon_test.rb
104
- - test/dataset_test.rb
105
- - test/metadata_test.rb
106
- - test/project_test.rb
107
- - test/remote_dataset_test.rb
108
- - test/tax_index_test.rb
109
- - test/taxonomy_test.rb
110
- - test/test_helper.rb
122
+ - scripts/_distances_functions.bash
111
123
  - scripts/_distances_noref_nomulti.bash
112
124
  - scripts/_distances_ref_nomulti.bash
113
125
  - scripts/aai_distances.bash
@@ -128,29 +140,21 @@ files:
128
140
  - scripts/subclades.bash
129
141
  - scripts/trimmed_fasta.bash
130
142
  - scripts/trimmed_reads.bash
143
+ - test/common_test.rb
144
+ - test/daemon_test.rb
145
+ - test/dataset_test.rb
146
+ - test/metadata_test.rb
147
+ - test/project_test.rb
148
+ - test/remote_dataset_test.rb
149
+ - test/tax_index_test.rb
150
+ - test/taxonomy_test.rb
151
+ - test/test_helper.rb
131
152
  - utils/adapters.fa
132
153
  - utils/mytaxa_scan.R
133
154
  - utils/mytaxa_scan.rb
134
155
  - utils/requirements.txt
135
156
  - utils/subclades-compile.rb
136
157
  - utils/subclades.R
137
- - bin/miga
138
- - actions/add_result
139
- - actions/add_taxonomy
140
- - actions/create_dataset
141
- - actions/create_project
142
- - actions/daemon
143
- - actions/download_dataset
144
- - actions/find_datasets
145
- - actions/import_datasets
146
- - actions/index_taxonomy
147
- - actions/list_datasets
148
- - actions/list_files
149
- - actions/unlink_dataset
150
- - Gemfile
151
- - Rakefile
152
- - README.md
153
- - LICENSE
154
158
  homepage: http://enve-omics.ce.gatech.edu/miga
155
159
  licenses:
156
160
  - Artistic-2.0
@@ -159,25 +163,25 @@ post_install_message:
159
163
  rdoc_options:
160
164
  - lib
161
165
  - README.md
162
- - --main
166
+ - "--main"
163
167
  - README.md
164
- - --title
168
+ - "--title"
165
169
  - MiGA
166
170
  require_paths:
167
171
  - lib
168
172
  required_ruby_version: !ruby/object:Gem::Requirement
169
173
  requirements:
170
- - - '>='
174
+ - - ">="
171
175
  - !ruby/object:Gem::Version
172
176
  version: '1.9'
173
177
  required_rubygems_version: !ruby/object:Gem::Requirement
174
178
  requirements:
175
- - - '>='
179
+ - - ">="
176
180
  - !ruby/object:Gem::Version
177
181
  version: '0'
178
182
  requirements: []
179
183
  rubyforge_project:
180
- rubygems_version: 2.0.14
184
+ rubygems_version: 2.5.1
181
185
  signing_key:
182
186
  specification_version: 4
183
187
  summary: MiGA
data/actions/add_result DELETED
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # @package MiGA
4
- # @license Artistic-2.0
5
-
6
- o = {q:true}
7
- opts = OptionParser.new do |opt|
8
- opt.banner = <<BAN
9
- Registers a result.
10
-
11
- Usage: #{$0} #{File.basename(__FILE__)} [options]
12
- BAN
13
- opt.separator ""
14
- opt.on("-P", "--project PATH",
15
- "(Mandatory) Path to the project to use."){ |v| o[:project]=v }
16
- opt.on("-D", "--dataset PATH",
17
- "(Mandatory if the result is dataset-specific) ID of the dataset to use."
18
- ){ |v| o[:dataset]=v }
19
- opt.on("-r", "--result STRING",
20
- "(Mandatory) Name of the result to add.",
21
- "Recognized names for dataset-specific results include:",
22
- *MiGA::Dataset.RESULT_DIRS.keys.map{|n| " ~ #{n}"},
23
- "Recognized names for project-wide results include:",
24
- *MiGA::Project.RESULT_DIRS.keys.map{|n| " ~ #{n}"}){ |v| o[:name]=v }
25
- opt.on("-v", "--verbose",
26
- "Print additional information to STDERR."){ o[:q]=false }
27
- opt.on("-d", "--debug INT", "Print debugging information to STDERR.") do |v|
28
- v.to_i>1 ? MiGA::MiGA.DEBUG_TRACE_ON : MiGA::MiGA.DEBUG_ON
29
- end
30
- opt.on("-h", "--help", "Display this screen.") do
31
- puts opt
32
- exit
33
- end
34
- opt.separator ""
35
- end.parse!
36
-
37
-
38
- ### MAIN
39
- opts.parse!
40
- raise "-P is mandatory." if o[:project].nil?
41
- raise "-r is mandatory." if o[:name].nil?
42
-
43
- $stderr.puts "Loading project." unless o[:q]
44
- p = MiGA::Project.load(o[:project])
45
- raise "Impossible to load project: #{o[:project]}" if p.nil?
46
-
47
- $stderr.puts "Registering result." unless o[:q]
48
- if o[:dataset].nil?
49
- r = p.add_result o[:name].to_sym
50
- else
51
- d = p.dataset(o[:dataset])
52
- r = d.add_result o[:name].to_sym
53
- end
54
-
55
- raise "Cannot add result, incomplete expected files." if r.nil?
56
-
57
- $stderr.puts "Done." unless o[:q]
58
-
data/actions/add_taxonomy DELETED
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # @package MiGA
4
- # @license Artistic-2.0
5
-
6
- o = {q:true}
7
- OptionParser.new do |opt|
8
- opt.banner = <<BAN
9
- Registers taxonomic information for datasets.
10
-
11
- Usage: #{$0} #{File.basename(__FILE__)} [options]
12
- BAN
13
- opt.separator ""
14
- opt.on("-P", "--project PATH",
15
- "(Mandatory) Path to the project to use."){ |v| o[:project]=v }
16
- opt.on("-D", "--dataset PATH",
17
- "(Mandatory unless -t is provided) ID of the dataset to use."
18
- ){ |v| o[:dataset]=v }
19
- opt.on("-s", "--tax-string STRING",
20
- "(Mandatory unless -t is provided) String corresponding to the taxonomy",
21
- "of the dataset. The MiGA format of string taxonomy is a space-delimited",
22
- "set of 'rank:name' pairs."){ |v| o[:taxstring]=v }
23
- opt.on("-t", "--tax-file PATH",
24
- "(Mandatory unless -D and -s are provided) Tab-delimited file containing",
25
- "datasets taxonomy. Each row corresponds to a datasets and each column",
26
- "corresponds to a rank. The first row must be a header with the rank ",
27
- "names, and the first column must contain dataset names."
28
- ){ |v| o[:taxfile]=v }
29
- opt.on("-v", "--verbose",
30
- "Print additional information to STDERR."){ o[:q]=false }
31
- opt.on("-d", "--debug INT", "Print debugging information to STDERR.") do |v|
32
- v.to_i>1 ? MiGA::MiGA.DEBUG_TRACE_ON : MiGA::MiGA.DEBUG_ON
33
- end
34
- opt.on("-h", "--help", "Display this screen.") do
35
- puts opt
36
- exit
37
- end
38
- opt.separator ""
39
- end.parse!
40
-
41
-
42
- ### MAIN
43
- raise "-P is mandatory." if o[:project].nil?
44
- raise "-D is mandatory unless -t is provided." if
45
- o[:dataset].nil? and o[:taxfile].nil?
46
- raise "-s is mandatory unless -t is provided." if
47
- o[:taxstring].nil? and o[:taxfile].nil?
48
-
49
- $stderr.puts "Loading project." unless o[:q]
50
- p = MiGA::Project.load(o[:project])
51
- raise "Impossible to load project: #{o[:project]}" if p.nil?
52
-
53
- if not o[:taxfile].nil?
54
- $stderr.puts "Reading tax-file and registering taxonomy." unless o[:q]
55
- tfh = File.open(o[:taxfile], "r")
56
- header = nil
57
- tfh.each_line do |ln|
58
- next if ln =~ /^\s*?$/
59
- r = ln.chomp.split(/\t/, -1)
60
- dn = r.shift
61
- if header.nil?
62
- header = r
63
- next
64
- end
65
- d = p.dataset dn
66
- if d.nil?
67
- warn "Impossible to find dataset at line #{$.}: #{dn}. Ignoring..."
68
- next
69
- end
70
- d.metadata[:tax] = MiGA::Taxonomy.new(r, header)
71
- d.save
72
- $stderr.puts " #{d.name} registered." unless o[:q]
73
- end
74
- tfh.close
75
- else
76
- $stderr.puts "Registering taxonomy." unless o[:q]
77
- d = p.dataset o[:dataset]
78
- d.metadata[:tax] = MiGA::Taxonomy.new(o[:taxstring])
79
- d.save
80
- end
81
-
82
- $stderr.puts "Done." unless o[:q]
83
-
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # @package MiGA
4
- # @license Artistic-2.0
5
-
6
- o = {q:true, ref:true}
7
- OptionParser.new do |opt|
8
- opt.banner = <<BAN
9
- Creates an empty dataset in a pre-existing MiGA project.
10
-
11
- Usage: #{$0} #{File.basename(__FILE__)} [options]
12
- BAN
13
- opt.separator ""
14
- opt.on("-P", "--project PATH",
15
- "(Mandatory) Path to the project to use."){ |v| o[:project]=v }
16
- opt.on("-D", "--dataset STRING",
17
- "(Mandatory) ID of the dataset to create."){ |v| o[:dataset]=v }
18
- opt.on("-t", "--type STRING",
19
- "Type of dataset. Recognized types include:",
20
- *MiGA::Dataset.KNOWN_TYPES.map{ |k,v| "~ #{k}: #{v[:description]}"}
21
- ){ |v| o[:type]=v.to_sym }
22
- opt.on("-q", "--query",
23
- "If set, the dataset is registered as a query, not a reference dataset."
24
- ){ |v| o[:ref]=!v }
25
- opt.on("-d", "--description STRING",
26
- "Description of the dataset."){ |v| o[:description]=v }
27
- opt.on("-u", "--user STRING",
28
- "Owner of the dataset."){ |v| o[:user]=v }
29
- opt.on("-c", "--comments STRING",
30
- "Comments on the dataset."){ |v| o[:comments]=v }
31
- opt.on("-v", "--verbose",
32
- "Print additional information to STDERR."){ o[:q]=false }
33
- opt.on("-d", "--debug INT", "Print debugging information to STDERR.") do |v|
34
- v.to_i>1 ? MiGA::MiGA.DEBUG_TRACE_ON : MiGA::MiGA.DEBUG_ON
35
- end
36
- opt.on("-h", "--help", "Display this screen.") do
37
- puts opt
38
- exit
39
- end
40
- opt.separator ""
41
- end.parse!
42
-
43
-
44
- ### MAIN
45
- raise "-P is mandatory." if o[:project].nil?
46
- raise "-D is mandatory." if o[:dataset].nil?
47
-
48
- $stderr.puts "Loading project." unless o[:q]
49
- p = MiGA::Project.load(o[:project])
50
- raise "Impossible to load project: #{o[:project]}" if p.nil?
51
-
52
- $stderr.puts "Creating dataset." unless o[:q]
53
- md = {}
54
- [:type, :description, :user, :comments].each{ |k| md[k]=o[k] unless o[k].nil? }
55
- MiGA::Dataset.new(p, o[:dataset], o[:ref], md)
56
- p.add_dataset(o[:dataset])
57
- res = d.first_preprocessing
58
- put "- #{res}" unless o[:q]
59
-
60
- $stderr.puts "Done." unless o[:q]
61
-
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # @package MiGA
4
- # @license Artistic-2.0
5
-
6
- o = {q:true, update:false}
7
- OptionParser.new do |opt|
8
- opt.banner = <<BAN
9
- Creates an empty MiGA project.
10
-
11
- Usage: #{$0} #{File.basename(__FILE__)} [options]
12
- BAN
13
- opt.separator ""
14
- opt.on("-P", "--project PATH",
15
- "(Mandatory) Path to the project to create."){ |v| o[:project]=v }
16
- opt.on("-t", "--type STRING",
17
- "Type of dataset. Recognized types include:",
18
- *MiGA::Project.KNOWN_TYPES.map{ |k,v| "~ #{k}: #{v[:description]}"}
19
- ){ |v| o[:type]=v.to_sym }
20
- opt.on("-n", "--name STRING",
21
- "Name of the project."){ |v| o[:name]=v }
22
- opt.on("-d", "--description STRING",
23
- "Description of the project."){ |v| o[:description]=v }
24
- opt.on("-u", "--user STRING", "Owner of the project."){ |v| o[:user]=v }
25
- opt.on("-c", "--comments STRING",
26
- "Comments on the project."){ |v| o[:comments]=v }
27
- opt.on("--update",
28
- "Updates the project if it already exists."){ o[:update]=true }
29
- opt.on("-v", "--verbose",
30
- "Print additional information to STDERR."){ o[:q]=false }
31
- opt.on("-d", "--debug INT", "Print debugging information to STDERR.") do |v|
32
- v.to_i>1 ? MiGA::MiGA.DEBUG_TRACE_ON : MiGA::MiGA.DEBUG_ON
33
- end
34
- opt.on("-h", "--help", "Display this screen.") do
35
- puts opt
36
- exit
37
- end
38
- opt.separator ""
39
- end.parse!
40
-
41
-
42
- ### MAIN
43
- raise "-P is mandatory." if o[:project].nil?
44
-
45
- unless File.exist? "#{ENV["HOME"]}/.miga_rc" and
46
- File.exist? "#{ENV["HOME"]}/.miga_daemon.json"
47
- puts "You must initialize MiGA before creating the first project.\n" +
48
- "Do you want to initialize MiGA now? (yes / no)"
49
- `'#{File.dirname(__FILE__)}/../scripts/init.bash'` if
50
- $stdin.gets.chomp == 'yes'
51
- end
52
-
53
- $stderr.puts "Creating project." unless o[:q]
54
- raise "Project already exists, aborting." unless
55
- o[:update] or not MiGA::Project.exist? o[:project]
56
- p = MiGA::Project.new(o[:project], o[:update])
57
- # The following check is redundant with MiGA::Project#create,
58
- # but allows upgrading projects from (very) early code versions
59
- o[:name] = File.basename(p.path) if
60
- o[:update] and o[:name].nil?
61
- [:name, :description, :user, :comments, :type].each do |k|
62
- p.metadata[k] = o[k] unless o[k].nil?
63
- end
64
- p.save
65
-
66
- $stderr.puts "Done." unless o[:q]
67
-