ncbi-blast-dbs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4548901d7963958b9ee98e4a45b558d1654f6151
4
+ data.tar.gz: 79d2503e82646c94aa04ff30f0b25e99646e0f55
5
+ SHA512:
6
+ metadata.gz: 5ecb01abb31c1b41e6301a4dcda923a27c44b4175ce06f00293795dd801a2247eb3ba6d760e3ee0457f9b41b207251b8b251b216db9789b6ebba8c24f107cbfe
7
+ data.tar.gz: 33d2aee65c3baf1fce7adf020e1efd40ed927fa7898cff14bc4de104c080091f7520149d614ece5ff6976f3704e9dc920eec59b9d8c50fb93072747d636540c6
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2016 Anurag Priyam
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ ## Fast download BLAST databases from NCBI
2
+
3
+ Database files (volumes) are downloaded in parallel: number of threads to use
4
+ is determined automatically. MD5 checksum is verified and the database files
5
+ extracted upon download. Database volumes are not downloaded in a particular
6
+ order. Downloads are incremental, that is it will only download new data,
7
+ provided the `.tar.gz` files have not been deleted.
8
+
9
+ It is faster than NCBI's `update_blastdb.pl`. But unlike `update_blastdb.pl`,
10
+ which is a pure Perl script, it delegates download and checksum verification
11
+ to `wget` and `md5sum` and is thus not as universal.
12
+
13
+ ### Installation
14
+
15
+ gem install ncbi-blast-dbs
16
+
17
+ ### Usage
18
+
19
+ #### List available BLAST databases
20
+
21
+ ncbi-blast-dbs
22
+
23
+ #### Download all volumes of a BLAST database
24
+
25
+ ncbi-blast-dbs nr
26
+
27
+ NCBI expects users to submit their email address when downloading data from
28
+ their FTP server. To comply with that, download as:
29
+
30
+ email="my email address here" ncbi-blast-dbs nr
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rake'
4
+ import "#{__dir__}/../lib/ncbi-blast-dbs.rake"
5
+ app = Rake.application; app.init; app.load_imports; app.top_level
@@ -0,0 +1,28 @@
1
+ require 'net/ftp'
2
+
3
+ def download(url)
4
+ file = File.basename(url)
5
+ sh "wget -Nc #{url} && wget -Nc #{url}.md5 &&"\
6
+ " md5sum -c #{file}.md5 && tar xvf #{file}"
7
+ end
8
+
9
+ def databases
10
+ host, dir = 'ftp.ncbi.nlm.nih.gov', 'blast/db'
11
+ usr, pswd = 'anonymous', ENV['email']
12
+
13
+ Net::FTP.open(host, usr, pswd) do |con|
14
+ con.passive = true
15
+ con.nlst(dir).
16
+ map { |file| File.join(host, file) }.
17
+ select { |file| file.match(/\.tar\.gz$/) }.
18
+ group_by { |file| File.basename(file).split('.')[0] }
19
+ end
20
+ end
21
+
22
+ databases.each do |name, files|
23
+ multitask(name => files.map { |file| task(file) { download(file) } })
24
+ end
25
+
26
+ task :default do
27
+ puts databases.keys.join(', ')
28
+ end
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.authors = ['Anurag Priyam']
3
+ s.email = ['anurag08priyam@gmail.com']
4
+ s.name = 'ncbi-blast-dbs'
5
+ s.version = '0.0.1'
6
+ s.summary = 'Fast download BLAST databases from NCBI.'
7
+ s.description = <<DESC
8
+ Downloads BLAST databases from NCBI. Database files (volumes) are downloaded in
9
+ parallel; number of threads to use is determined automatically. Database files
10
+ are verified and extracted upon download.
11
+ DESC
12
+ s.license = 'MIT'
13
+ s.homepage = 'http://github.com/yeban/ncbi-blast-dbs'
14
+
15
+ s.files = `git ls-files`.split
16
+ s.require_paths = ['lib']
17
+ s.add_dependency('rake', '~> 10.3', '>= 10.3.2')
18
+ s.executables = ['ncbi-blast-dbs']
19
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ncbi-blast-dbs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Anurag Priyam
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 10.3.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '10.3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 10.3.2
33
+ description: |
34
+ Downloads BLAST databases from NCBI. Database files (volumes) are downloaded in
35
+ parallel; number of threads to use is determined automatically. Database files
36
+ are verified and extracted upon download.
37
+ email:
38
+ - anurag08priyam@gmail.com
39
+ executables:
40
+ - ncbi-blast-dbs
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - Gemfile
45
+ - LICENSE.txt
46
+ - README.md
47
+ - bin/ncbi-blast-dbs
48
+ - lib/ncbi-blast-dbs.rake
49
+ - ncbi-blast-dbs.gemspec
50
+ homepage: http://github.com/yeban/ncbi-blast-dbs
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.2.5
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: Fast download BLAST databases from NCBI.
74
+ test_files: []
75
+ has_rdoc: