Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/update_microbedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main():

fetcher = ncbi_fetcher()

fetcher.sync_version()
fetcher.sync_version(opts.test)

# We're done so set the current microbedb version to the new current one
Version.set_current(version)
Expand All @@ -49,6 +49,7 @@ def argParser():
parser = argparse.ArgumentParser(description='Update MicrobeDB from NCBI\'s ftp site')
parser.add_argument('-c','--config', dest='config', help='Config file', required=True)
parser.add_argument('-n','--noversion', action='store_true', default=False, dest='noversion', help='Don\'t create a new version, use the latest', required=False)
parser.add_argument('-t','--test', type=int, default=0, help='To test MicrobeDBv2, number of directories to try downloading from NCBI bacterial genome ftp (typically 5-10)')

return parser

Expand Down
6 changes: 5 additions & 1 deletion lib/microbedb/ncbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ def check_and_reconnect(self):
genomes, for each send it for processing all the
isolates within.
'''
def sync_version(self):
def sync_version(self, test):

# First we fetch all the files
files = self.ftp.nlst()

if test!=0:
self.logger.info("We are testing MicrobeDBv2, only considering the first %s directories" % test)
files = files[:test]

for file in files:
self.logger.info("Processing remote directory: {}".format(file))

Expand Down