""" import argparse import anvio import anvio.tables as t import anvio.dbops as dbops import anvio.terminal as terminal import anvio.filesnpaths as filesnpaths run = terminal.Run() progress = terminal.Progress() parser = argparse.ArgumentParser(description='A simple script to generate info from search tables') parser.add_argument(*anvio.A('profile-db'), **anvio.K('profile-db', {'required': False})) parser.add_argument(*anvio.A('contigs-db'), **anvio.K('contigs-db', {'required': False})) parser.add_argument(*anvio.A('output-file'), **anvio.K('output-file', {'default': "COLLECTIONS.txt"})) args = anvio.get_args(parser) filesnpaths.is_file_exists(args.output_file) contigs = set([]) contig_lengths = {} db = dbops.ContigsDatabase(args.contigs_db, quiet=False) contigs_info_table = db.db.get_table_as_dict(t.contigs_info_table_name) contig_lengths = dict([(c, contigs_info_table[c]['length']) for c in contigs_info_table]) db.disconnect()
# otherwise update config rule parameters new_config[param] = default_config[param] new_config[param].update(config.get(param,'')) else: # if it's not a dict then it's a general parameter # update the general parameter new_config[param] = config.get(param, default_config[param]) filesnpaths.is_output_file_writable(config_path) open(config_path, 'w').write(json.dumps(new_config, indent=4)) progress.end() run.info_single("The config file version is now %s. This upgrade brought back any default value that was " "previously removed from your config file. It will not change anything about the " "configuration of the resulting workflow and you can just carry on your work. " "" % (next_version), nl_after=1, nl_before=1, mc='green') if __name__ == '__main__': parser = argparse.ArgumentParser(description='A simple script to upgrade a workflow config from version %s to version %s' % (current_version, next_version)) parser.add_argument('config', metavar = 'CONFIG', help = 'Config at version %s' % current_version) parser.add_argument(*anvio.A("workflow"), **anvio.K("workflow")) args, unknown = parser.parse_known_args() try: migrate(args.config) except ConfigError as e: print(e) sys.exit(-1)
""" import argparse import anvio import anvio.tables as t import anvio.dbops as dbops import anvio.terminal as terminal import anvio.filesnpaths as filesnpaths run = terminal.Run() progress = terminal.Progress() parser = argparse.ArgumentParser( description='A simple script to generate info from search tables') parser.add_argument(*anvio.A('profile-db'), **anvio.K('profile-db', {'required': False})) parser.add_argument(*anvio.A('contigs-db'), **anvio.K('contigs-db', {'required': False})) parser.add_argument(*anvio.A('output-file'), **anvio.K('output-file', {'default': "COLLECTIONS.txt"})) args = parser.parse_args() filesnpaths.is_file_exists(args.output_file) contigs = set([]) contig_lengths = {} db = dbops.ContigsDatabase(args.contigs_db, quiet=False) contigs_info_table = db.db.get_table_as_dict(t.contigs_info_table_name)