4 PUB_RELEASE_DIR = '/pub/release-65/fasta'
7 ftp = Net::FTP.new('ftp.ensembl.org', 'anonymous', EMAIL)
8 ftp.passive = true # To avoid "No route to host" error.
9 ftp.chdir( PUB_RELEASE_DIR )
10 files = ftp.list('*_*') # To only look at files with an underscore.
12 files.each do | file |
13 species = file.split().last
15 ftp.chdir(species + PEP_DIR)
17 pepfiles.each do | pepfile |
18 pepfile = pepfile.split().last
19 if pepfile =~ /all.fa.gz/ # Only want the "all.fa.gz" files (and not the
21 ftp.getbinaryfile(pepfile)
22 puts 'downloaded "' + pepfile + '"'
27 puts 'ignoring "' + species + '"'
29 ftp.chdir(PUB_RELEASE_DIR) # To go back to the starting directory.
32 puts 'done (downloaded ' + count.to_s + ' files)'