示例#1
0
    def test_default_database_dir_noenv(self):
        saved_env = os.environ.get('DAMMIT_DB_DIR', None)
        try:
            del os.environ['DAMMIT_DB_DIR']
        except KeyError:
            pass

        result = databases.default_database_dir(self.logger)
        expected = path.expanduser('~/.dammit/databases')
        assert result == expected

        if saved_env is not None:
            os.environ['DAMMIT_DB_DIR'] = saved_env
示例#2
0
    def setup_method(self):
        self.logger = logging.getLogger('tests.test_databases.TestDatabases')
        class Args(object):
            pass
        self.args = Args()
        self.args.database_dir = databases.default_database_dir(self.logger)
        self.args.verbosity = 2
        self.args.full = False
        self.args.n_threads = 1
        self.args.busco_group = 'metazoa'

        self.config, self.databases = get_config()
        self.config.update(vars(self.args))
        self.handler = databases.get_handler(self.config)
        databases.build_default_pipeline(self.handler,
                                         self.config,
                                         self.databases,
                                         with_uniref=False)
示例#3
0
文件: app.py 项目: pythseq/dammit
        def add_common_args(parser):
            ''' Add shared options to a parser.

            Shared options are added this way instead of to the main parser
            because I'd rather they come after the subcommand name.

            Args:
                parser (object): The parser to which arguments will be added.
            '''
            parser.add_argument('--database-dir',
                                default=databases.default_database_dir(self.logger),
                                help='Directory to store databases. Existing'\
                                     ' databases will not be overwritten.'\
                                     ' By default, the database directory is'\
                                     ' $HOME/.dammit/databases.'
                                )

            parser.add_argument('--busco-group',
                                default='metazoa',
                                metavar='[metazoa, eukaryota, vertebrata, ...]',
                                choices=list(self.databases_d['BUSCO'].keys()),
                                help='Which BUSCO group to use. Should be chosen'\
                                     ' based on the organism being annotated.'\
                                     ' Full list of options is below.'
                                )

            parser.add_argument('--n_threads',
                                type=int,
                                default=1,
                                help='For annotate, number of threads to pass to '\
                                     'programs  supporting multithreading. For '\
                                     'databases, number of simultaneous tasks '\
                                     'to execute.'
                                )

            parser.add_argument('--config-file',
                                help='A JSON file providing values to override'\
                                     ' built-in config. Advanced use only!'
                                )

            parser.add_argument('--busco-config-file',
                                help='Path to an alternative BUSCO config'\
                                     ' file; otherwise, BUSCO will attempt'\
                                     ' to use its default installation'\
                                     ' which will likely only work on'\
                                     ' bioconda. Advanced use only!')

            parser.add_argument('--verbosity',
                                default=0,
                                type=int,
                                choices=[0, 1, 2],
                                help='Verbosity level for doit tasks.')

            parser.add_argument('--profile',
                                default=False,
                                action='store_true',
                                help='Profile task execution.')

            parser.add_argument('--force',
                                default=False,
                                action='store_true',
                                help='Ignore missing database tasks.')

            parser.add_argument('--no_rename',
                                default=False,
                                action='store_true',
                                help='Keep original transcript names.'\
                                     ' Note: make sure your transcript names'\
                                     ' do not contain unusual characters.')

            pgroup = parser.add_mutually_exclusive_group()
            pgroup.add_argument('--full',
                                action='store_true',
                                default=False,
                                help='Run a "complete" annotation; includes'\
                                     ' uniref90, which is left out of the'\
                                     ' default pipeline because it is huge'\
                                     ' and homology searches take a long'\
                                     ' time.'
                                )

            pgroup.add_argument('--nr',
                                action='store_true',
                                default=False,
                                help='Also include annotation to NR database, which'\
                                     ' is left out of the default and "full"'\
                                     ' pipelines because it is huge and'\
                                     ' homology searches take a long time.'
                                )


            pgroup.add_argument('--quick',
                                default=False,
                                action='store_true',
                                help='Run a "quick" annotation; excludes'\
                                     ' the Infernal Rfam tasks, the HMMER'\
                                     ' Pfam tasks, and the LAST OrthoDB'\
                                     ' and uniref90 tasks. Best for users'\
                                     ' just looking to get basic stats'\
                                     ' and conditional reciprocal best'\
                                     ' LAST from a protein database.')