miga-base 1.3.9.1 → 1.3.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/miga/cli/action/download/ncbi.rb +21 -2
- data/lib/miga/result/stats.rb +28 -41
- data/lib/miga/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2603688836b87b4be16c9c88bacbb206a93bd6b71b19a5a7febc219638f4e912
|
4
|
+
data.tar.gz: 1df2051e7d1d88facce4e0738828274ca9743807cdf90da959697addde25e424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28d606569bdd37e5d4d33710564573639b103747c9622fae0a3a2d254f6293bf8462decb09bdf67d7656f84bca84fc7094e217c66ff081e75c5f5622bd9711c
|
7
|
+
data.tar.gz: 7e18ecf2487c31b5d99d3fb53b8716ce0dea2f2a8b2bab5015a871be9b703dd63c4384fb050380dad4dd28f5de3d1de5c9bcb1cb8544726870c7314fab626ca9
|
@@ -26,6 +26,9 @@ module MiGA::Cli::Action::Download::Ncbi
|
|
26
26
|
cli[:scaffold] = true
|
27
27
|
cli[:contig] = true
|
28
28
|
end
|
29
|
+
opt.on('--ncbi-list-json STRING', '::HIDE::') do |v|
|
30
|
+
cli[:ncbi_list_json] = v
|
31
|
+
end
|
29
32
|
end
|
30
33
|
|
31
34
|
def cli_name_modifiers(opt)
|
@@ -35,7 +38,9 @@ module MiGA::Cli::Action::Download::Ncbi
|
|
35
38
|
'Only affects --complete and --chromosome'
|
36
39
|
) { |v| cli[:add_version] = v }
|
37
40
|
# For backwards compatibility
|
38
|
-
|
41
|
+
opt.on('--legacy-name', '::HIDE::') do
|
42
|
+
warn 'Deprecated flag --legacy-name ignored'
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
def sanitize_cli
|
@@ -49,6 +54,11 @@ module MiGA::Cli::Action::Download::Ncbi
|
|
49
54
|
end
|
50
55
|
|
51
56
|
def remote_list
|
57
|
+
if cli[:ncbi_list_json] && File.size?(cli[:ncbi_list_json])
|
58
|
+
cli.say "Reusing remote list: #{cli[:ncbi_list_json]}"
|
59
|
+
return MiGA::Json.parse(cli[:ncbi_list_json])
|
60
|
+
end
|
61
|
+
|
52
62
|
list = {}
|
53
63
|
query = remote_list_query
|
54
64
|
loop do
|
@@ -66,6 +76,14 @@ module MiGA::Cli::Action::Download::Ncbi
|
|
66
76
|
break unless page[:next_page_token]
|
67
77
|
query[:page_token] = page[:next_page_token]
|
68
78
|
end
|
79
|
+
|
80
|
+
if cli[:ncbi_list_json]
|
81
|
+
cli.say "Saving remote list: #{cli[:ncbi_list_json]}"
|
82
|
+
File.open(cli[:ncbi_list_json], 'w') do |fh|
|
83
|
+
fh.puts MiGA::Json.generate_plain(list)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
69
87
|
list
|
70
88
|
end
|
71
89
|
|
@@ -80,7 +98,8 @@ module MiGA::Cli::Action::Download::Ncbi
|
|
80
98
|
ds[n] = {
|
81
99
|
ids: [asm], db: :assembly, universe: :ncbi,
|
82
100
|
md: {
|
83
|
-
type: :genome, ncbi_asm: asm,
|
101
|
+
type: :genome, ncbi_asm: asm,
|
102
|
+
strain: r.dig(:organism, :infraspecific_names, :strain)
|
84
103
|
}
|
85
104
|
}
|
86
105
|
date = r.dig(:assembly_info, :release_date)
|
data/lib/miga/result/stats.rb
CHANGED
@@ -29,33 +29,15 @@ module MiGA::Result::Stats
|
|
29
29
|
seq_opts = { gc: true, x: true, skew: true }
|
30
30
|
if self[:files][:pair1].nil?
|
31
31
|
s = MiGA::MiGA.seqs_length(file_path(:single), :fastq, seq_opts)
|
32
|
-
stats =
|
33
|
-
reads: s[:n],
|
34
|
-
length_average: [s[:avg], 'bp'],
|
35
|
-
length_standard_deviation: [s[:sd], 'bp'],
|
36
|
-
g_c_content: [s[:gc], '%'],
|
37
|
-
x_content: [s[:x], '%'],
|
38
|
-
g_c_skew: [s[:gc_skew], '%'],
|
39
|
-
a_t_skew: [s[:at_skew], '%']
|
40
|
-
}
|
32
|
+
stats = seqs_length_as_stats_hash(s)
|
41
33
|
else
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
forward_x_content: [s1[:x], '%'],
|
50
|
-
forward_g_c_skew: [s1[:gc_skew], '%'],
|
51
|
-
forward_a_t_skew: [s1[:at_skew], '%'],
|
52
|
-
reverse_length_average: [s2[:avg], 'bp'],
|
53
|
-
reverse_length_standard_deviation: [s2[:sd], 'bp'],
|
54
|
-
reverse_g_c_content: [s2[:gc], '%'],
|
55
|
-
reverse_x_content: [s2[:x], '%'],
|
56
|
-
reverse_g_c_skew: [s2[:gc_skew], '%'],
|
57
|
-
reverse_a_t_skew: [s2[:at_skew], '%']
|
58
|
-
}
|
34
|
+
stats = { read_pairs: nil }
|
35
|
+
{ pair1: :forward, pair2: :reverse }.each do |pair, direction|
|
36
|
+
s = MiGA::MiGA.seqs_length(file_path(pair), :fastq, seq_opts)
|
37
|
+
seqs_length_as_stats_hash(s).each do |k, v|
|
38
|
+
stats[k == :reads ? :read_pairs : :"#{direction}_#{k}"] ||= v
|
39
|
+
end
|
40
|
+
end
|
59
41
|
end
|
60
42
|
stats
|
61
43
|
end
|
@@ -63,15 +45,7 @@ module MiGA::Result::Stats
|
|
63
45
|
def compute_stats_trimmed_fasta
|
64
46
|
f = self[:files][:coupled].nil? ? file_path(:single) : file_path(:coupled)
|
65
47
|
s = MiGA::MiGA.seqs_length(f, :fasta, gc: true, x: true, skew: true)
|
66
|
-
|
67
|
-
reads: s[:n],
|
68
|
-
length_average: [s[:avg], 'bp'],
|
69
|
-
length_standard_deviation: [s[:sd], 'bp'],
|
70
|
-
g_c_content: [s[:gc], '%'],
|
71
|
-
x_content: [s[:x], '%'],
|
72
|
-
g_c_skew: [s[:gc_skew], '%'],
|
73
|
-
a_t_skew: [s[:at_skew], '%']
|
74
|
-
}
|
48
|
+
seqs_length_as_stats_hash(s)
|
75
49
|
end
|
76
50
|
|
77
51
|
def compute_stats_assembly
|
@@ -79,16 +53,17 @@ module MiGA::Result::Stats
|
|
79
53
|
file_path(:largecontigs), :fasta,
|
80
54
|
n50: true, gc: true, x: true, skew: true
|
81
55
|
)
|
56
|
+
h = seqs_length_as_stats_hash(s)
|
82
57
|
{
|
83
58
|
contigs: s[:n],
|
84
59
|
n50: [s[:n50], 'bp'],
|
85
60
|
total_length: [s[:tot], 'bp'],
|
86
|
-
longest_sequence: [s[:max], 'bp']
|
87
|
-
|
88
|
-
x_content
|
89
|
-
|
90
|
-
|
91
|
-
|
61
|
+
longest_sequence: [s[:max], 'bp']
|
62
|
+
}.tap do |stats|
|
63
|
+
%i[g_c_content x_content g_c_skew a_t_skew].each do |i|
|
64
|
+
stats[i] = h[i]
|
65
|
+
end
|
66
|
+
end
|
92
67
|
end
|
93
68
|
|
94
69
|
def compute_stats_cds
|
@@ -253,4 +228,16 @@ module MiGA::Result::Stats
|
|
253
228
|
add_file(:raw_report, "#{source.name}.ess/log")
|
254
229
|
add_file(:report, "#{source.name}.ess/log.domain")
|
255
230
|
end
|
231
|
+
|
232
|
+
def seqs_length_as_stats_hash(s)
|
233
|
+
{
|
234
|
+
reads: s[:n],
|
235
|
+
length_average: [s[:avg], 'bp'],
|
236
|
+
length_standard_deviation: [s[:sd], 'bp'],
|
237
|
+
g_c_content: [s[:gc], '%'],
|
238
|
+
x_content: [s[:x], '%'],
|
239
|
+
g_c_skew: [s[:gc_skew], '%'],
|
240
|
+
a_t_skew: [s[:at_skew], '%']
|
241
|
+
}
|
242
|
+
end
|
256
243
|
end
|
data/lib/miga/version.rb
CHANGED
@@ -12,7 +12,7 @@ module MiGA
|
|
12
12
|
# - String indicating release status:
|
13
13
|
# - rc* release candidate, not released as gem
|
14
14
|
# - [0-9]+ stable release, released as gem
|
15
|
-
VERSION = [1.3, 9,
|
15
|
+
VERSION = [1.3, 9, 2].freeze
|
16
16
|
|
17
17
|
##
|
18
18
|
# Nickname for the current major.minor version.
|