Created
January 8, 2020 21:38
-
-
Save audy/519a8054ce661aabfc6c2762b4f3cc57 to your computer and use it in GitHub Desktop.
quickly fetch all of the annotations on refseq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "open-uri" | |
require "parallel" | |
open("https://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt") do |handle| | |
handle.gets # skip header | |
handle.gets | |
Parallel.each(handle, :in_processes => 6, :progress => 'downloading') do |line| | |
row = line.split("\t") | |
uri_base = row[-3] | |
filename = "#{uri_base.split('/')[-1]}_genomic.gbff.gz" | |
full_uri = "#{uri_base}/#{filename}" | |
cmd = "wget --quiet -O #{filename} #{full_uri}" | |
`#{cmd}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment