def parse_arguments(): parser = argparse.ArgumentParser( prog='CAT bin', description='Run Bin Annotation Tool (BAT) on a single bin.', usage='CAT bin -b -d -t [options] [-h / --help]', add_help=False) required = parser.add_argument_group('Required arguments') shared.add_argument(required, 'bin_fasta', True) shared.add_argument(required, 'database_folder', True) shared.add_argument(required, 'taxonomy_folder', True) optional = parser.add_argument_group('Optional arguments') shared.add_argument(optional, 'r', False, default=decimal.Decimal(5)) shared.add_argument(optional, 'f', False, default=decimal.Decimal(0.3)) shared.add_argument(optional, 'out_prefix', False, default='./out.BAT') shared.add_argument(optional, 'proteins_fasta', False) shared.add_argument(optional, 'alignment_file', False) shared.add_argument(optional, 'path_to_prodigal', False, default='prodigal') shared.add_argument(optional, 'path_to_diamond', False, default='diamond') shared.add_argument(optional, 'no_stars', False) shared.add_argument(optional, 'force', False) shared.add_argument(optional, 'quiet', False) shared.add_argument(optional, 'verbose', False) shared.add_argument(optional, 'no_log', False) shared.add_argument(optional, 'help', False) shared.add_argument(optional, 'IkwId', False) specific = parser.add_argument_group('DIAMOND specific optional arguments') shared.add_all_diamond_arguments(specific) (args, extra_args) = parser.parse_known_args() extra_args = [ arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'bin') ] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Check experimental features. if not args.IkwId: if args.top < 50: sys.exit('error: --top can only be set lower than 50 in ' 'combination with the --I_know_what_Im_doing flag. See ' 'README.md as to why this is the case.') # Add extra arguments. shared.expand_arguments(args) return args
def parse_arguments(): parser = argparse.ArgumentParser( prog='CAT add_names', description='Add taxonomic names to CAT or BAT output files.', usage='CAT add_names -i -o -t [options] [-h / --help]', add_help=False) required = parser.add_argument_group('Required arguments') shared.add_argument( required, 'input_file', True, help_=('Path to input file. Can be classification or ORF2LCA ' 'output file from CAT or BAT.')) shared.add_argument(required, 'output_file', True) shared.add_argument(required, 'taxonomy_folder', True) optional = parser.add_argument_group('Optional arguments') shared.add_argument(optional, 'only_official', False) shared.add_argument(optional, 'exclude_scores', False) shared.add_argument(optional, 'force', False) shared.add_argument(optional, 'quiet', False) shared.add_argument(optional, 'help', False) (args, extra_args) = parser.parse_known_args() extra_args = [ arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'add_names') ] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Add extra arguments. shared.expand_arguments(args) return args
def parse_arguments(): parser = argparse.ArgumentParser( prog='CAT summarise', description='Summarise a named CAT or BAT classification file.', usage='CAT summarise -i -o (-c) [options] [-h / --help]', add_help=False) required = parser.add_argument_group('Required arguments') required.add_argument( '-i', '--input_file', dest='input_file', metavar='', required=True, type=str, action=shared.PathAction, help=('Path to named CAT contig classification file or BAT bin ' 'classification file. Currently only official ranks are ' 'supported, and only classification files containing a single ' 'classification per contig / bin.')) required.add_argument('-o', '--output_file', dest='output_file', metavar='', required=True, type=str, action=shared.PathAction, help='Path to output file.') optional = parser.add_argument_group('Optional arguments') optional.add_argument( '-c', '--contigs_fasta', dest='contigs_fasta', metavar='', required=False, type=str, action=shared.PathAction, help=('Path to contigs fasta file. This is required if you want ' 'to summarise a contig classification file.')) optional.add_argument('--force', dest='force', required=False, action='store_true', help='Force overwrite existing files.') optional.add_argument('-q', '--quiet', dest='quiet', required=False, action='store_true', help='Suppress verbosity.') optional.add_argument('-h', '--help', action='help', help='Show this help message and exit.') (args, extra_args) = parser.parse_known_args() extra_args = [ arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'summarise') ] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Add extra arguments. shared.expand_arguments(args) return args
def parse_arguments(): parser = argparse.ArgumentParser( prog='CAT add_names', description='Add taxonomic names to CAT or BAT output files.', usage='CAT add_names -i -o -t [options] [-h / --help]', add_help=False) required = parser.add_argument_group('Required arguments') required.add_argument( '-i', '--input_file', dest='input_file', metavar='', required=True, type=str, action=shared.PathAction, help=('Path to input file. Can be either classification output ' 'file or ORF2LCA output file.')) required.add_argument('-o', '--output_file', dest='output_file', metavar='', required=True, type=str, action=shared.PathAction, help='Path to output file.') required.add_argument('-t', '--taxonomy_folder', dest='taxonomy_folder', metavar='', required=True, type=str, action=shared.PathAction, help='Path to folder that contains taxonomy files.') optional = parser.add_argument_group('Optional arguments') optional.add_argument( '--only_official', dest='only_official', required=False, action='store_true', help=('Only output official rank names (i.e., superkingdom, ' 'phylum, class, order, family, genus, species).')) optional.add_argument( '--exclude_scores', dest='exclude_scores', required=False, action='store_true', help=('Do not include bit-score support scores in the lineage of ' 'a classification output file.')) optional.add_argument('--force', dest='force', required=False, action='store_true', help='Force overwrite existing files.') optional.add_argument('-q', '--quiet', dest='quiet', required=False, action='store_true', help='Suppress verbosity.') optional.add_argument('-h', '--help', action='help', help='Show this help message and exit.') (args, extra_args) = parser.parse_known_args() extra_args = [ arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'add_names') ] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Add extra arguments. shared.expand_arguments(args) return args
def parse_arguments(): parser = argparse.ArgumentParser( prog='CAT bins', description='Run Bin Annotation Tool (BAT) on a set of bins.', usage='CAT bins -b -d -t [options] [-h / --help]', add_help=False) required = parser.add_argument_group('Required arguments') shared.add_argument(required, 'bin_folder', True) shared.add_argument(required, 'database_folder', True) shared.add_argument(required, 'taxonomy_folder', True) optional = parser.add_argument_group('Optional arguments') shared.add_argument(optional, 'bin_suffix', False, default='.fna') shared.add_argument(optional, 'r', False, default=decimal.Decimal(5)) shared.add_argument(optional, 'f', False, default=decimal.Decimal(0.3)) shared.add_argument(optional, 'out_prefix', False, default='./out.BAT') shared.add_argument(optional, 'proteins_fasta', False, help_=( 'Path to concatenated predicted proteins fasta file ' 'generated during an earlier run of BAT on the same bins. If ' 'supplied, BAT will skip the protein prediction step.')) shared.add_argument(optional, 'alignment_file', False, help_=( 'Path to alignment table generated during an earlier run of ' 'BAT on the same bins. If supplied, BAT will skip the ' 'alignment step and directly classify the bins. A ' 'concatenated predicted proteins fasta file should also be ' 'supplied with argument [-p / --proteins].')) shared.add_argument(optional, 'path_to_prodigal', False, default='prodigal') shared.add_argument(optional, 'path_to_diamond', False, default='diamond') shared.add_argument(optional, 'no_stars', False) shared.add_argument(optional, 'force', False) shared.add_argument(optional, 'quiet', False) shared.add_argument(optional, 'verbose', False) shared.add_argument(optional, 'no_log', False) shared.add_argument(optional, 'help', False) shared.add_argument(optional, 'IkwId', False) specific = parser.add_argument_group('DIAMOND specific optional arguments') shared.add_all_diamond_arguments(specific) (args, extra_args) = parser.parse_known_args() extra_args = [arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'bins')] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Check experimental features. if not args.IkwId: if args.top < 50: sys.exit('error: --top can only be set lower than 50 in ' 'combination with the --I_know_what_Im_doing flag. See ' 'README.md as to why this is the case.') # Add extra arguments. shared.expand_arguments(args) return args
def parse_arguments(): date = datetime.datetime.now().strftime('%Y-%m-%d') parser = argparse.ArgumentParser( prog='CAT prepare', description='Download and construct CAT/BAT database files.', usage=('CAT prepare (--fresh | --existing) ' '[options] [-h / --help]'), add_help=False) required_choice = parser.add_argument_group('Required choice') group = required_choice.add_mutually_exclusive_group(required=True) group.add_argument('--fresh', dest='fresh', action='store_true', help='Start with a fresh database.') group.add_argument( '--existing', dest='fresh', action='store_false', help=('Start with an existing database. CAT will search the ' 'supplied database and taxonomy folders and only construct ' 'files that do not exist yet.')) optional = parser.add_argument_group('Optional arguments') shared.add_argument( optional, 'database_folder', False, default='./CAT_database.{0}'.format(date), help_=('Name of folder to which database files will be written ' '(default: CAT_database.{date})')) shared.add_argument( optional, 'taxonomy_folder', False, default='./CAT_taxonomy.{0}'.format(date), help_=('Name of folder to which taxonomy files will be downloaded ' '(default: CAT_taxonomy.{date})')) shared.add_argument(optional, 'path_to_diamond', False, default='diamond') shared.add_argument(optional, 'quiet', False) shared.add_argument(optional, 'verbose', False) shared.add_argument(optional, 'no_log', False) shared.add_argument(optional, 'help', False) specific = parser.add_argument_group('DIAMOND specific optional arguments') shared.add_argument(specific, 'nproc', False, default=multiprocessing.cpu_count()) (args, extra_args) = parser.parse_known_args() extra_args = [ arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'prepare') ] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Add extra arguments. setattr(args, 'date', date) setattr(args, 'min_mem', 200) shared.expand_arguments(args) return (args)
def parse_arguments(): date = datetime.datetime.now().strftime('%Y-%m-%d') parser = argparse.ArgumentParser( prog='CAT prepare', description='Download and construct CAT/BAT database files.', usage=('CAT prepare (--fresh | --existing) ' '[options] [-h / --help]'), add_help=False) required_choice = parser.add_argument_group('Required choice') group = required_choice.add_mutually_exclusive_group(required=True) group.add_argument('--fresh', dest='fresh', action='store_true', help='Start with a fresh database.') group.add_argument( '--existing', dest='fresh', action='store_false', help=('Start with an existing database. CAT will search the ' 'supplied database and taxonomy folders and only construct ' 'files that do not exist yet.')) optional = parser.add_argument_group('Optional arguments') optional.add_argument( '-d', '--database_folder', dest='database_folder', metavar='', required=False, type=str, action=shared.PathAction, default='./{0}_CAT_database'.format(date), help=('Name of folder to which database files will be written ' '(default: {date}_CAT_database).')) optional.add_argument( '-t', '--taxonomy_folder', dest='taxonomy_folder', metavar='', required=False, type=str, action=shared.PathAction, default='./{0}_taxonomy'.format(date), help=('Name of folder to which taxonomy files will be downloaded ' '(default: {date}_taxonomy).')) optional.add_argument( '--path_to_diamond', dest='path_to_diamond', metavar='', required=False, type=str, action=shared.PathAction, default='diamond', help=('Path to DIAMOND binaries. Supply if CAT prepare can not ' 'find DIAMOND.')) optional.add_argument('-q', '--quiet', dest='quiet', required=False, action='store_true', help='Suppress verbosity.') optional.add_argument('--verbose', dest='verbose', required=False, action='store_true', help='Increase verbostity.') optional.add_argument('--no_log', dest='no_log', required=False, action='store_true', help='Suppress log file.') optional.add_argument('-h', '--help', action='help', help='Show this help message and exit.') specific = parser.add_argument_group('DIAMOND specific optional arguments') specific.add_argument('-n', '--nproc', dest='nproc', metavar='', required=False, type=int, default=multiprocessing.cpu_count(), help=('Number of cores to deploy by DIAMOND makedb ' '(default: maximum).')) (args, extra_args) = parser.parse_known_args() extra_args = [ arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'prepare') ] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Add extra arguments. setattr(args, 'date', date) setattr(args, 'min_mem', 200) shared.expand_arguments(args) return (args)
def parse_arguments(): parser = argparse.ArgumentParser( prog='CAT bins', description='Run Bin Annotation Tool (BAT) on a set of bins.', usage='CAT bins -b -d -t [options] [-h / --help]', add_help=False) required = parser.add_argument_group('Required arguments') required.add_argument( '-b', '--bin_folder', dest='bin_folder', metavar='', required=True, type=str, action=shared.PathAction, help='Path to directory containing bins.') required.add_argument( '-d', '--database_folder', metavar='', required=True, type=str, action=shared.PathAction, help='Path to folder that contains database files.') required.add_argument( '-t', '--taxonomy_folder', dest='taxonomy_folder', metavar='', required=True, type=str, action=shared.PathAction, help='Path to folder that contains taxonomy files.') optional = parser.add_argument_group('Optional arguments') optional.add_argument( '-s', '--bin_suffix', dest='bin_suffix', metavar='', required=False, type=str, default='.fna', help='Suffix of bins in bin folder (default: .fna).') optional.add_argument( '-r', '--range', dest='r', metavar='', required=False, type=float, choices = [i for i in range(50)], action=shared.DecimalAction, default=decimal.Decimal(5), help='r parameter [0-49] (default: 5).') optional.add_argument( '-f', '--fraction', dest='f', metavar='', required=False, type=float, choices = [i / 100 for i in range(0, 100)], action=shared.DecimalAction, default=decimal.Decimal(0.3), help='f parameter [0-0.99] (default: 0.3).') optional.add_argument( '-o', '--out_prefix', dest='out_prefix', metavar='', required=False, type=str, action=shared.PathAction, default='./out.BAT', help='Prefix for output files (default: out.BAT).') optional.add_argument( '-p', '--proteins_fasta', dest='proteins_fasta', metavar='', required=False, type=str, action=shared.PathAction, help=('Path to concatenated predicted proteins fasta file ' 'generated during an earlier run of BAT. If supplied, BAT ' 'will skip the protein prediction step.')) optional.add_argument( '-a', '--diamond_alignment', dest='alignment_file', metavar='', required=False, type=str, action=shared.PathAction, help=('Path to alignment table generated during an earlier run of ' 'BAT. If supplied, BAT will skip the alignment step and ' 'directly classify the bins. A concatenated predicted ' 'proteins fasta file should also be supplied with argument ' '[-p / --proteins].')) optional.add_argument( '--path_to_prodigal', dest='path_to_prodigal', metavar='', required=False, type=str, action=shared.PathAction, default='prodigal', help=('Path to Prodigal binaries. Supply if BAT can not find ' 'Prodigal.')) optional.add_argument( '--path_to_diamond', dest='path_to_diamond', metavar='', required=False, type=str, action=shared.PathAction, default='diamond', help=('Path to DIAMOND binaries. Supply if BAT can not find ' 'DIAMOND.')) optional.add_argument( '--no_stars', dest='no_stars', required=False, action='store_true', help='Suppress marking of suggestive taxonomic assignments.') optional.add_argument( '--force', dest='force', required=False, action='store_true', help='Force overwrite existing files.') optional.add_argument( '-q', '--quiet', dest='quiet', required=False, action='store_true', help='Suppress verbosity.') optional.add_argument( '--verbose', dest='verbose', required=False, action='store_true', help='Increase verbosity.') optional.add_argument( '--no_log', dest='no_log', required=False, action='store_true', help='Suppress log file.') optional.add_argument( '-h', '--help', action='help', help='Show this help message and exit.') optional.add_argument( '--I_know_what_Im_doing', dest='IkwId', required=False, action='store_true', help='Flag for experimental features.') specific = parser.add_argument_group('DIAMOND specific optional arguments') specific.add_argument( '-n', '--nproc', dest='nproc', metavar='', required=False, type=int, default=multiprocessing.cpu_count(), help='Number of cores to deploy by DIAMOND (default: maximum).') specific.add_argument( '--sensitive', dest='sensitive', required=False, action='store_true', help='Run DIAMOND in sensitive mode (default: not enabled).') specific.add_argument( '--block_size', dest='block_size', metavar='', required=False, type=float, default=2.0, help=('DIAMOND block-size parameter (default: 2.0). Lower numbers ' 'will decrease memory and temporary disk space usage.')) specific.add_argument( '--index_chunks', dest='index_chunks', metavar='', required=False, type=int, default=4, help=('DIAMOND index-chunks parameter (default: 4). Set to 1 on ' 'high memory machines. The parameter has no effect on ' 'temporary disk space usage.')) specific.add_argument( '--tmpdir', dest='tmpdir', metavar='', required=False, type=str, action=shared.PathAction, help=('Directory for temporary DIAMOND files (default: directory ' 'to which output files are written).')) specific.add_argument( '--compress', dest='compress', required=False, action='store_true', help='Compress DIAMOND alignment file.') specific.add_argument( '--top', dest='top', metavar='', required=False, type=float, choices = [i for i in range(51)], default=50, help=('DIAMOND top parameter [0-50] (default: 50). Governs hits ' 'within range of best hit that are written to the alignment ' 'file. This is not the [-r / --range] parameter! Can only be ' 'set with the [--I_know_what_Im_doing] flag, see README.md.')) (args, extra_args) = parser.parse_known_args() extra_args = [arg for (i, arg) in enumerate(extra_args) if (i, arg) != (0, 'bins')] if len(extra_args) > 0: sys.exit('error: too much arguments supplied:\n{0}'.format( '\n'.join(extra_args))) # Check experimental features. if not args.IkwId: if args.top < 50: sys.exit('error: --top can only be set lower than 50 in ' 'combination with the --I_know_what_Im_doing flag. See ' 'README.md as to why this is the case.') # Add extra arguments. shared.expand_arguments(args) return args