Skip to content

Commit aff00ac

Browse files
committed
Extend support of miga ncbi_get
Include genomes without reported FTP path in summary tables
1 parent 9d0f62b commit aff00ac

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ jobs:
6363
uses: actions-ecosystem/action-regex-match@v2
6464
with:
6565
text: ${{ steps.publish.outputs.gem_version }}
66-
regex: '^([0-9]*\.[0-9]*)\.'
66+
regex: '^[0-9]*\.[0-9]*'
6767
- name: Update major.minor tag
6868
if: ${{ steps.major-minor.outputs.match != '' }}
6969
uses: actions-ecosystem/action-push-tag@v1
7070
with:
71-
tag: v${{ steps.regex-match.outputs.group1 }}
71+
tag: v${{ steps.regex-match.outputs.match }}
7272

lib/miga/cli/action/download/ncbi.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,13 @@ def parse_csv_as_datasets(doc)
7171
CSV.parse(doc, headers: true).each do |r|
7272
asm = r['assembly']
7373
next if asm.nil? || asm.empty? || asm == '-'
74-
next unless r['ftp_path_genbank']
7574

7675
rep = remote_row_replicons(r)
7776
n = remote_row_name(r, rep, asm)
7877

7978
# Register for download
80-
fna_url = '%s/%s_genomic.fna.gz' %
81-
[r['ftp_path_genbank'], File.basename(r['ftp_path_genbank'])]
8279
ds[n] = {
83-
ids: [fna_url], db: :assembly_gz, universe: :web,
80+
ids: [asm], db: :assembly, universe: :ncbi,
8481
md: {
8582
type: :genome, ncbi_asm: asm, strain: r['strain']
8683
}
@@ -123,8 +120,7 @@ def remote_list_url
123120
'matching(tab==["Prokaryotes"] and q=="' \
124121
"#{cli[:taxon]&.tr('"', "'")}\"",
125122
fields: 'organism|organism,assembly|assembly,replicons|replicons,' \
126-
'level|level,ftp_path_genbank|ftp_path_genbank,' \
127-
'release_date|release_date,strain|strain',
123+
'level|level,release_date|release_date,strain|strain',
128124
nolimit: 'on'
129125
}
130126
if cli[:reference]

lib/miga/remote_dataset.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def ncbi_asm_json_doc
216216
end
217217
return nil unless metadata[:ncbi_asm]
218218

219-
ncbi_asm_id = self.class.ncbi_asm_acc2id metadata[:ncbi_asm]
219+
ncbi_asm_id = self.class.ncbi_asm_acc2id(metadata[:ncbi_asm])
220220
txt = nil
221221
3.times do
222222
txt = self.class.download(:ncbi_summary, :assembly, ncbi_asm_id, :json)
@@ -226,6 +226,12 @@ def ncbi_asm_json_doc
226226
return if doc.nil? || doc['result'].nil? || doc['result'].empty?
227227

228228
@_ncbi_asm_json_doc = doc['result'][ doc['result']['uids'].first ]
229+
url_dir = @_ncbi_asm_json_doc['ftppath_genbank']
230+
if url_dir
231+
metadata[:web_assembly_gz] ||=
232+
'%s/%s_genomic.fna.gz' % [url_dir, File.basename(url_dir)]
233+
end
234+
@_ncbi_asm_json_doc
229235
end
230236

231237
private

lib/miga/remote_dataset/download.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def ncbi_asm_rest(opts)
4949
)
5050
end
5151

52-
url = "#{url_dir}/#{File.basename url_dir}_genomic.fna.gz"
52+
url = '%s/%s_genomic.fna.gz' % [url_dir, File.basename(url_dir)]
5353
download(
5454
:web, :assembly_gz, url,
5555
opts[:format], opts[:file], opts[:extra], opts[:obj]
@@ -134,9 +134,8 @@ module MiGA::RemoteDataset::Download
134134
##
135135
# Download data into +file+
136136
def download(file)
137-
self.class.download(
138-
universe, db, ids, self.class.UNIVERSE[universe][:dbs][db][:format],
139-
file, [], self
140-
)
137+
format = self.class.UNIVERSE[universe][:dbs][db][:format]
138+
# MiGA::MiGA.DEBUG "download: #{universe}, #{db}, #{ids}, #{format}"
139+
self.class.download(universe, db, ids, format, file, [], self)
141140
end
142141
end

lib/miga/version.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ module MiGA
1212
# - String indicating release status:
1313
# - rc* release candidate, not released as gem
1414
# - [0-9]+ stable release, released as gem
15-
VERSION = [1.3, 1, 0].freeze
15+
VERSION = [1.3, 2, 0].freeze
1616

1717
##
1818
# Nickname for the current major.minor version.
19-
VERSION_NAME = 'prima'
19+
VERSION_NAME = 'mezzotint'
2020

2121
##
2222
# Date of the current gem relese.
23-
VERSION_DATE = Date.new(2023, 3, 21)
23+
VERSION_DATE = Date.new(2023, 3, 25)
2424

2525
##
2626
# References of MiGA

0 commit comments

Comments
 (0)