miga-base 0.2.0.6 → 0.2.0.7
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/Gemfile +3 -0
- data/LICENSE +201 -0
- data/README.md +17 -335
- data/Rakefile +31 -0
- data/actions/add_result +2 -5
- data/actions/add_taxonomy +4 -7
- data/actions/create_dataset +5 -6
- data/actions/create_project +2 -5
- data/actions/daemon +2 -5
- data/actions/download_dataset +88 -58
- data/actions/find_datasets +36 -38
- data/actions/import_datasets +2 -5
- data/actions/index_taxonomy +2 -5
- data/actions/list_datasets +47 -49
- data/actions/list_files +7 -11
- data/actions/unlink_dataset +2 -5
- data/bin/miga +1 -1
- data/lib/miga/common.rb +132 -0
- data/lib/miga/daemon.rb +229 -168
- data/lib/miga/dataset.rb +354 -277
- data/lib/miga/gui.rb +346 -269
- data/lib/miga/metadata.rb +115 -71
- data/lib/miga/project.rb +361 -259
- data/lib/miga/remote_dataset.rb +200 -148
- data/lib/miga/result.rb +150 -99
- data/lib/miga/tax_index.rb +124 -67
- data/lib/miga/taxonomy.rb +129 -100
- data/lib/miga/version.rb +57 -0
- data/lib/miga.rb +2 -77
- data/scripts/_distances_noref_nomulti.bash +2 -0
- data/scripts/_distances_ref_nomulti.bash +2 -0
- data/scripts/aai_distances.bash +1 -0
- data/scripts/ani_distances.bash +1 -0
- data/scripts/assembly.bash +1 -0
- data/scripts/cds.bash +1 -0
- data/scripts/clade_finding.bash +17 -1
- data/scripts/distances.bash +1 -0
- data/scripts/essential_genes.bash +1 -0
- data/scripts/haai_distances.bash +1 -0
- data/scripts/init.bash +2 -0
- data/scripts/mytaxa.bash +1 -0
- data/scripts/mytaxa_scan.bash +1 -0
- data/scripts/ogs.bash +1 -0
- data/scripts/read_quality.bash +1 -0
- data/scripts/ssu.bash +1 -0
- data/scripts/subclades.bash +1 -0
- data/scripts/trimmed_fasta.bash +1 -0
- data/scripts/trimmed_reads.bash +1 -0
- data/test/common_test.rb +82 -0
- data/test/daemon_test.rb +53 -0
- data/test/dataset_test.rb +156 -0
- data/test/jruby_gui_test.rb +20 -0
- data/test/metadata_test.rb +48 -0
- data/test/project_test.rb +54 -0
- data/test/remote_dataset_test.rb +41 -0
- data/test/tax_index_test.rb +44 -0
- data/test/taxonomy_test.rb +36 -0
- data/test/test_helper.rb +32 -0
- metadata +53 -38
data/lib/miga/dataset.rb
CHANGED
@@ -1,286 +1,363 @@
|
|
1
|
-
#
|
2
1
|
# @package MiGA
|
3
|
-
# @
|
4
|
-
# @license artistic license 2.0
|
5
|
-
# @update Jan-18-2016
|
6
|
-
#
|
2
|
+
# @license Artistic-2.0
|
7
3
|
|
8
4
|
require "miga/metadata"
|
9
|
-
require "miga/project"
|
10
5
|
require "miga/result"
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
7
|
+
##
|
8
|
+
# Dataset representation in MiGA.
|
9
|
+
class MiGA::Dataset < MiGA::MiGA
|
10
|
+
|
11
|
+
# Class-level
|
12
|
+
|
13
|
+
##
|
14
|
+
# Directories containing the results from dataset-specific tasks.
|
15
|
+
def self.RESULT_DIRS ; @@RESULT_DIRS end
|
16
|
+
@@RESULT_DIRS = {
|
17
|
+
# Preprocessing
|
18
|
+
raw_reads: "01.raw_reads", trimmed_reads: "02.trimmed_reads",
|
19
|
+
read_quality: "03.read_quality", trimmed_fasta: "04.trimmed_fasta",
|
20
|
+
assembly: "05.assembly", cds: "06.cds",
|
21
|
+
# Annotation
|
22
|
+
essential_genes: "07.annotation/01.function/01.essential",
|
23
|
+
ssu: "07.annotation/01.function/02.ssu",
|
24
|
+
mytaxa: "07.annotation/02.taxonomy/01.mytaxa",
|
25
|
+
mytaxa_scan: "07.annotation/03.qa/02.mytaxa_scan",
|
26
|
+
# Mapping
|
27
|
+
mapping_on_contigs: "08.mapping/01.read-ctg",
|
28
|
+
mapping_on_genes: "08.mapping/02.read-gene",
|
29
|
+
# Distances (for single-species datasets)
|
30
|
+
distances: "09.distances"
|
31
|
+
}
|
32
|
+
|
33
|
+
##
|
34
|
+
# Supported dataset types.
|
35
|
+
def self.KNOWN_TYPES ; @@KNOWN_TYPES end
|
36
|
+
@@KNOWN_TYPES = {
|
37
|
+
genome: {description: "The genome from an isolate.", multi: false},
|
38
|
+
metagenome: {description: "A metagenome (excluding viromes).",
|
39
|
+
multi: true},
|
40
|
+
virome: {description: "A viral metagenome.", multi: true},
|
41
|
+
scgenome: {description: "A genome from a single cell.", multi: false},
|
42
|
+
popgenome: {description: "The genome of a population (including " +
|
43
|
+
"microdiversity).", :multi=>false}
|
44
|
+
}
|
45
|
+
|
46
|
+
##
|
47
|
+
# Returns an Array of tasks to be executed before project-wide tasks.
|
48
|
+
def self.PREPROCESSING_TASKS ; @@PREPROCESSING_TASKS ; end
|
49
|
+
@@PREPROCESSING_TASKS = [:raw_reads, :trimmed_reads, :read_quality,
|
50
|
+
:trimmed_fasta, :assembly, :cds, :essential_genes, :ssu, :mytaxa,
|
51
|
+
:mytaxa_scan, :distances]
|
52
|
+
|
53
|
+
##
|
54
|
+
# Tasks to be excluded from query datasets.
|
55
|
+
@@EXCLUDE_NOREF_TASKS = [:essential_genes, :mytaxa_scan]
|
56
|
+
|
57
|
+
##
|
58
|
+
# Tasks to be executed only in datasets that are not multi-organism. These
|
59
|
+
# tasks are ignored for multi-organism datasets or for unknown types.
|
60
|
+
@@ONLY_NONMULTI_TASKS = [:mytaxa_scan, :distances]
|
61
|
+
|
62
|
+
##
|
63
|
+
# Tasks to be executed only in datasets that are multi-organism. These
|
64
|
+
# tasks are ignored for single-organism datasets or for unknwon types.
|
65
|
+
@@ONLY_MULTI_TASKS = [:mytaxa]
|
66
|
+
|
67
|
+
##
|
68
|
+
# Does the +project+ already have a dataset with that +name+?
|
69
|
+
def self.exist?(project, name)
|
70
|
+
File.exist? project.path + "/metadata/" + name + ".json"
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Standard fields of metadata for datasets.
|
75
|
+
def self.INFO_FIELDS
|
76
|
+
%w(name created updated type ref user description comments)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Instance-level
|
80
|
+
|
81
|
+
##
|
82
|
+
# MiGA::Project that contains the dataset.
|
83
|
+
attr_reader :project
|
84
|
+
|
85
|
+
##
|
86
|
+
# Datasets are uniquely identified by +name+ in a project.
|
87
|
+
attr_reader :name
|
88
|
+
|
89
|
+
##
|
90
|
+
# MiGA::Metadata with information about the dataset.
|
91
|
+
attr_reader :metadata
|
92
|
+
|
93
|
+
##
|
94
|
+
# Create a MiGA::Dataset object in a +project+ MiGA::Project with a
|
95
|
+
# uniquely identifying +name+. +is_ref+ indicates if the dataset is to
|
96
|
+
# be treated as reference (true, default) or query (false). Pass any
|
97
|
+
# additional +metadata+ as a Hash.
|
98
|
+
def initialize(project, name, is_ref=true, metadata={})
|
99
|
+
raise "Invalid name '#{name}', please use only alphanumerics and " +
|
100
|
+
"underscores." unless name.miga_name?
|
101
|
+
@project = project
|
102
|
+
@name = name
|
103
|
+
metadata[:ref] = is_ref
|
104
|
+
@metadata = MiGA::Metadata.new(project.path + "/metadata/" + name + ".json",
|
105
|
+
metadata)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Save any changes you've made in the dataset.
|
110
|
+
def save
|
111
|
+
self.metadata[:type] = :metagenome if !metadata[:tax].nil? and
|
112
|
+
!metadata[:tax][:ns].nil? and metadata[:tax][:ns]=="COMMUNITY"
|
113
|
+
self.metadata.save
|
114
|
+
end
|
115
|
+
|
116
|
+
##
|
117
|
+
# Delete the dataset with all it's contents (including results) and returns
|
118
|
+
# nil.
|
119
|
+
def remove!
|
120
|
+
self.results.each{ |r| r.remove! }
|
121
|
+
self.metadata.remove!
|
122
|
+
end
|
123
|
+
|
124
|
+
##
|
125
|
+
# Get standard metadata values for the dataset as Array.
|
126
|
+
def info
|
127
|
+
MiGA::Dataset.INFO_FIELDS.map do |k|
|
128
|
+
(k=="name") ? self.name : self.metadata[k.to_sym]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
##
|
133
|
+
# Is this dataset a reference?
|
134
|
+
def is_ref? ; !!self.metadata[:ref] ; end
|
135
|
+
|
136
|
+
##
|
137
|
+
# Is this dataset known to be multi-organism?
|
138
|
+
def is_multi?
|
139
|
+
return false if self.metadata[:type].nil?
|
140
|
+
return @@KNOWN_TYPES[self.metadata[:type]][:multi]
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Is this dataset known to be single-organism?
|
145
|
+
def is_nonmulti?
|
146
|
+
return false if self.metadata[:type].nil?
|
147
|
+
return !@@KNOWN_TYPES[self.metadata[:type]][:multi]
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# Get the result MiGA::Result in this dataset identified by the symbol +k+.
|
152
|
+
def result(k)
|
153
|
+
return nil if @@RESULT_DIRS[k.to_sym].nil?
|
154
|
+
MiGA::Result.load(project.path + "/data/" + @@RESULT_DIRS[k.to_sym] +
|
155
|
+
"/" + name + ".json")
|
156
|
+
end
|
157
|
+
|
158
|
+
##
|
159
|
+
# Get all the results (Array of MiGA::Result) in this dataset.
|
160
|
+
def results ; @@RESULT_DIRS.keys.map{ |k| result k }.compact ; end
|
161
|
+
|
162
|
+
##
|
163
|
+
# For each result executes the 2-ary +blk+ block: key symbol and MiGA::Result.
|
164
|
+
def each_result(&blk)
|
165
|
+
@@RESULT_DIRS.keys.each do |k|
|
166
|
+
blk.call(k, result(k)) unless result(k).nil?
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
##
|
171
|
+
# Look for the result with symbol key +result_type+ and register it in the
|
172
|
+
# dataset. If +save+ is false, it doesn't register the result, but it still
|
173
|
+
# returns a result if the expected files are complete. Returns MiGA::Result
|
174
|
+
# or nil.
|
175
|
+
def add_result(result_type, save=true)
|
176
|
+
return nil if @@RESULT_DIRS[result_type].nil?
|
177
|
+
base = project.path + "/data/" + @@RESULT_DIRS[result_type] +
|
178
|
+
"/" + name
|
179
|
+
return MiGA::Result.load(base + ".json") unless save
|
180
|
+
return nil unless result_files_exist?(base, ".done")
|
181
|
+
r = self.send("add_result_#{result_type}", base)
|
182
|
+
r.save unless r.nil?
|
183
|
+
r
|
184
|
+
end
|
185
|
+
|
186
|
+
##
|
187
|
+
# Returns the key symbol of the first registered result (sorted by the
|
188
|
+
# execution order). This typically corresponds to the result used as the
|
189
|
+
# initial input. Passes +save+ to #add_result.
|
190
|
+
def first_preprocessing(save=false)
|
191
|
+
@@PREPROCESSING_TASKS.find{ |t| not add_result(t, save).nil? }
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# Returns the key symbol of the next task that needs to be executed. Passes
|
196
|
+
# +save+ to #add_result.
|
197
|
+
def next_preprocessing(save=false)
|
198
|
+
after_first = false
|
199
|
+
first = first_preprocessing(save)
|
200
|
+
return nil if first.nil?
|
201
|
+
@@PREPROCESSING_TASKS.each do |t|
|
202
|
+
next if ignore_task? t
|
203
|
+
return t if after_first and add_result(t, save).nil?
|
204
|
+
after_first = (after_first or (t==first))
|
205
|
+
end
|
206
|
+
nil
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Should I ignore +task+ for this dataset?
|
211
|
+
def ignore_task?(task)
|
212
|
+
( (@@EXCLUDE_NOREF_TASKS.include?(task) and not is_ref?) or
|
213
|
+
(@@ONLY_MULTI_TASKS.include?(task) and not is_multi?) or
|
214
|
+
(@@ONLY_NONMULTI_TASKS.include?(task) and not is_nonmulti?))
|
215
|
+
end
|
216
|
+
|
217
|
+
##
|
218
|
+
# Are all the dataset-specific tasks done? Passes +save+ to #add_result.
|
219
|
+
def done_preprocessing?(save=false)
|
220
|
+
!first_preprocessing(save).nil? and next_preprocessing(save).nil?
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Returns an array indicating the stage of each task (sorted by execution
|
225
|
+
# order). The values are integers:
|
226
|
+
# - 0 for an undefined result (a task before the initial input).
|
227
|
+
# - 1 for a registered result (a completed task).
|
228
|
+
# - 2 for a queued result (a task yet to be executed).
|
229
|
+
# It passes +save+ to #add_result
|
230
|
+
def profile_advance(save=false)
|
231
|
+
first_task = first_preprocessing(save)
|
232
|
+
return Array.new(@@PREPROCESSING_TASKS.size, 0) if first_task.nil?
|
233
|
+
adv = []
|
234
|
+
state = 0
|
235
|
+
next_task = next_preprocessing(save)
|
236
|
+
@@PREPROCESSING_TASKS.each do |task|
|
237
|
+
state = 1 if first_task==task
|
238
|
+
state = 2 if !next_task.nil? and next_task==task
|
239
|
+
adv << state
|
240
|
+
end
|
241
|
+
adv
|
242
|
+
end
|
243
|
+
|
244
|
+
private
|
245
|
+
|
246
|
+
def add_result_raw_reads(base)
|
247
|
+
return nil unless result_files_exist?(base, ".1.fastq")
|
248
|
+
r = MiGA::Result.new(base + ".json")
|
249
|
+
add_files_to_ds_result(r, name,
|
250
|
+
( result_files_exist?(base, ".2.fastq") ?
|
251
|
+
{:pair1=>".1.fastq", :pair2=>".2.fastq"} :
|
252
|
+
{:single=>".1.fastq"} ))
|
253
|
+
end
|
254
|
+
|
255
|
+
def add_result_trimmed_reads(base)
|
256
|
+
return nil unless result_files_exist?(base, ".1.clipped.fastq")
|
257
|
+
r = MiGA::Result.new base + ".json"
|
258
|
+
r = add_files_to_ds_result(r, name,
|
259
|
+
{:pair1=>".1.clipped.fastq", :pair2=>".2.clipped.fastq"}) if
|
260
|
+
result_files_exist?(base, ".2.clipped.fastq")
|
261
|
+
r.add_file(:single, name + ".1.clipped.single.fastq")
|
262
|
+
add_result(:raw_reads) #-> Post gunzip
|
263
|
+
r
|
264
|
+
end
|
265
|
+
|
266
|
+
def add_result_read_quality(base)
|
267
|
+
return nil unless result_files_exist?(base, %w[.solexaqa .fastqc])
|
268
|
+
r = MiGA::Result.new(base + ".json")
|
269
|
+
r = add_files_to_ds_result(r, name,
|
270
|
+
{:solexaqa=>".solexaqa", :fastqc=>".fastqc"})
|
271
|
+
add_result(:trimmed_reads) #-> Post cleaning
|
272
|
+
r
|
273
|
+
end
|
274
|
+
|
275
|
+
def add_result_trimmed_fasta(base)
|
276
|
+
return nil unless
|
277
|
+
result_files_exist?(base, ".CoupledReads.fa") or
|
278
|
+
result_files_exist?(base, ".SingleReads.fa")
|
279
|
+
r = MiGA::Result.new base + ".json"
|
280
|
+
r = add_files_to_ds_result(r, name, {:coupled=>".CoupledReads.fa",
|
281
|
+
:pair1=>".1.fa", :pair2=>".2.fa"}) if
|
282
|
+
result_files_exist?(base, ".CoupledReads.fa")
|
283
|
+
r.add_file(:single, name + ".SingleReads.fa")
|
284
|
+
add_result(:raw_reads) #-> Post gzip
|
285
|
+
r
|
286
|
+
end
|
287
|
+
|
288
|
+
def add_result_assembly(base)
|
289
|
+
return nil unless result_files_exist?(base, ".LargeContigs.fna")
|
290
|
+
r = MiGA::Result.new(base + ".json")
|
291
|
+
add_files_to_ds_result(r, name, {:largecontigs=>".LargeContigs.fna",
|
292
|
+
:allcontigs=>".AllContigs.fna"})
|
293
|
+
end
|
294
|
+
|
295
|
+
def add_result_cds(base)
|
296
|
+
return nil unless result_files_exist?(base, %w[.faa .fna])
|
297
|
+
r = MiGA::Result.new(base + ".json")
|
298
|
+
add_files_to_ds_result(r, name, {:proteins=>".faa", :genes=>".fna",
|
299
|
+
:gff2=>".gff2", :gff3=>".gff3", :tab=>".tab"})
|
300
|
+
end
|
301
|
+
|
302
|
+
def add_result_essential_genes(base)
|
303
|
+
return nil unless result_files_exist?(base, %w[.ess.faa .ess .ess/log])
|
304
|
+
r = MiGA::Result.new(base + ".json")
|
305
|
+
add_files_to_ds_result(r, name, {:ess_genes=>".ess.faa",
|
306
|
+
:collection=>".ess", :report=>".ess/log"})
|
307
|
+
end
|
308
|
+
|
309
|
+
def add_result_ssu(base)
|
310
|
+
return MiGA::Result.new(base + ".json") if result(:assembly).nil?
|
311
|
+
return nil unless result_files_exist?(base, ".ssu.fa")
|
312
|
+
r = MiGA::Result.new(base + ".json")
|
313
|
+
add_files_to_ds_result(r, name, {:longest_ssu_gene=>".ssu.fa",
|
314
|
+
:gff=>".ssu.gff", :all_ssu_genes=>".ssu.all.fa"})
|
315
|
+
end
|
316
|
+
|
317
|
+
def add_result_mytaxa(base)
|
318
|
+
if is_multi?
|
319
|
+
return nil unless result_files_exist?(base, ".mytaxa")
|
320
|
+
r = MiGA::Result.new(base + ".json")
|
321
|
+
add_files_to_ds_result(r, name, {:mytaxa=>".mytaxa", :blast=>".blast",
|
322
|
+
:mytaxain=>".mytaxain"})
|
323
|
+
else
|
324
|
+
MiGA::Result.new base + ".json"
|
264
325
|
end
|
265
|
-
|
266
|
-
|
326
|
+
end
|
327
|
+
|
328
|
+
def add_result_mytaxa_scan(base)
|
329
|
+
if is_nonmulti?
|
330
|
+
return nil unless
|
331
|
+
result_files_exist?(base, %w[.pdf .wintax .mytaxa .reg])
|
332
|
+
r = MiGA::Result.new(base + ".json")
|
333
|
+
add_files_to_ds_result(r, name, {:mytaxa=>".mytaxa", :wintax=>".wintax",
|
334
|
+
:blast=>".blast", :mytaxain=>".mytaxain", :report=>".pdf",
|
335
|
+
:regions=>".reg", :gene_ids=>".wintax.genes",
|
336
|
+
:region_ids=>".wintax.regions"})
|
337
|
+
else
|
338
|
+
MiGA::Result.new base + ".json"
|
267
339
|
end
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
end
|
281
|
-
end
|
282
|
-
adv
|
340
|
+
end
|
341
|
+
|
342
|
+
def add_result_distances(base)
|
343
|
+
if is_nonmulti?
|
344
|
+
pref = File.dirname(base)
|
345
|
+
return nil unless
|
346
|
+
File.exist?("#{pref}/#{is_ref? ? "01.haai" : "02.aai"}/#{name}.db")
|
347
|
+
r = MiGA::Result.new(base + ".json")
|
348
|
+
r.add_files({:haai_db=>"01.haai/#{name}.db",
|
349
|
+
:aai_db=>"02.aai/#{name}.db", :ani_db=>"03.ani/#{name}.db"})
|
350
|
+
else
|
351
|
+
r = MiGA::Result.new "#{base}.json"
|
283
352
|
end
|
284
|
-
|
285
|
-
end
|
353
|
+
r
|
354
|
+
end
|
355
|
+
|
356
|
+
def add_files_to_ds_result(r, name, rel_files)
|
357
|
+
files = {}
|
358
|
+
rel_files.each{ |k,v| files[k] = name + v }
|
359
|
+
r.add_files(files)
|
360
|
+
r
|
361
|
+
end
|
286
362
|
|
363
|
+
end # class MiGA::Dataset
|