示例#1
0
def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    if not (opts.refseqs_path or opts.blast_db):
        option_parser.error('Either a blast db (via -b) or a collection of '
                'reference sequences (via -r) must be passed')
    if opts.refseqs_path and opts.blast_db:
        option_parser.error('You should provide only a blast db (via -b) '
                'or a collection of reference sequences (via -r), but not both')

    # create dict of command-line options
    params = eval(str(opts))

    parallel_runner = ParallelBlaster(
            cluster_jobs_fp=opts.cluster_jobs_fp,
            jobs_to_start=opts.jobs_to_start,
            retain_temp_files=opts.retain_temp_files,
            suppress_polling=opts.suppress_polling,
            seconds_to_sleep=opts.seconds_to_sleep)

    parallel_runner(opts.infile_path,
                    opts.output_dir,
                    params,
                    job_prefix=opts.job_prefix,
                    poll_directly=opts.poll_directly,
                    suppress_submit_jobs=False)
示例#2
0
    def test_parallel_blaster(self):
        """Test ParallelBlaster functions as expected."""
        params = {
            'refseqs_path': self.reference_seqs_file.name,
            'disable_low_complexity_filter': False,
            'e_value': 0.001,
            'num_hits': 1,
            'word_size': 30,
            'suppress_format_blastdb': False,
            'blastmat_dir': None
        }

        app = ParallelBlaster()
        r = app(self.tmp_seq_filepath,
                self.test_out,
                params,
                job_prefix='BLASTTEST',
                poll_directly=True,
                suppress_submit_jobs=False)

        # Basic sanity checks: we should get two blast hits (lines). We ignore
        # all of the comments in the file. Each line should have 12 fields
        # separated by tabs.
        results = [
            line for line in open(
                glob(join(self.test_out, '*_blast_out.txt'))[0], 'U')
            if not line.startswith('#')
        ]
        self.assertEqual(len(results), 2)
        self.assertEqual(len(results[0].split('\t')), 12)
        self.assertEqual(len(results[1].split('\t')), 12)
示例#3
0
def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)    

    if not ((exists(opts.refseqs_path) and isfile(opts.refseqs_path)) or \
            (opts.suppress_format_blastdb and
             len(glob('%s*nin' % opts.refseqs_path)) > 0)):
       option_parser.error('%s (-r) doesn\'t exist as a fasta file or '
                           'pre-formatted BLAST database. If passing a '
                           'reference database you must also pass -D.' %
                           opts.refseqs_path)

    # create dict of command-line options
    params = eval(str(opts))

    parallel_runner = ParallelBlaster(
            cluster_jobs_fp=opts.cluster_jobs_fp,
            jobs_to_start=opts.jobs_to_start,
            retain_temp_files=opts.retain_temp_files,
            suppress_polling=opts.suppress_polling,
            seconds_to_sleep=opts.seconds_to_sleep)

    parallel_runner(opts.infile_path,
                    opts.output_dir,
                    params,
                    job_prefix=opts.job_prefix,
                    poll_directly=opts.poll_directly,
                    suppress_submit_jobs=False)