9 Author: [http://www.cmzmasek.net/ Christian M Zmasek], Sanford-Burnham Medical Research Institute
12 Copyright (C) 2011 Christian M Zmasek. All rights reserved.
15 = Using net/ftp to download all Proteomes from the Ensembl Database =
21 PUB_RELEASE_DIR = '/pub/release-64/fasta'
24 ftp = Net::FTP.new('ftp.ensembl.org', 'anonymous', EMAIL)
25 ftp.passive = true # To avoid "No route to host" error.
26 ftp.chdir( PUB_RELEASE_DIR )
27 files = ftp.list('*_*') # To only look at files with an underscore.
29 files.each do | file |
30 species = file.split().last
32 ftp.chdir(species + PEP_DIR)
34 pepfiles.each do | pepfile |
35 pepfile = pepfile.split().last
36 if pepfile =~ /all.fa./
37 ftp.getbinaryfile(pepfile)
38 puts 'downloaded "' + pepfile + '"'
43 puts 'ignoring "' + species + '"'
45 ftp.chdir(PUB_RELEASE_DIR) # To go back to the starting directory.
48 puts 'done (downloaded ' + count.to_s + ' files)'