Skip to content

Instantly share code, notes, and snippets.

@audy
Created October 5, 2017 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audy/3d978b807b45f8bf4526d08e52a723fb to your computer and use it in GitHub Desktop.
Save audy/3d978b807b45f8bf4526d08e52a723fb to your computer and use it in GitHub Desktop.
fetch genomes from NCBI in parallel
#!/usr/bin/env ruby
# download all genomes from ncbi using 8 processes
# ./ncbi-fetch.rb | xargs -I {} -n1 -p 8 wget {}
File.open('assembly_summary.txt').each do |line|
row = line.strip.split("\t")
base_url = row[19]
next if base_url.nil?
dir = base_url.split('/').last
full_url = "#{base_url}/#{dir}_genomic.gbff.gz".gsub(/ftp:\/\//, 'https://')
puts full_url
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment