diff --git a/bin/update_microbedb.py b/bin/update_microbedb.py index f0faf99..df7f26b 100755 --- a/bin/update_microbedb.py +++ b/bin/update_microbedb.py @@ -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) @@ -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 diff --git a/lib/microbedb/ncbi.py b/lib/microbedb/ncbi.py index bf91310..d527065 100644 --- a/lib/microbedb/ncbi.py +++ b/lib/microbedb/ncbi.py @@ -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))