File: run_gubbins.py

package info (click to toggle)
gubbins 2.4.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,124 kB
  • sloc: ansic: 4,376; python: 1,599; sh: 185; makefile: 129; cpp: 27
file content (62 lines) | stat: -rwxr-xr-x 4,031 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
# encoding: utf-8
#
# Wellcome Trust Sanger Institute
# Copyright (C) 2012  Wellcome Trust Sanger Institute
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

import argparse
import pkg_resources
import gubbins.common


def main():

    parser = argparse.ArgumentParser(
        description='Croucher N. J., Page A. J., Connor T. R., Delaney A. J., Keane J. A., Bentley S. D., Parkhill J., '
                    'Harris S.R. "Rapid phylogenetic analysis of large samples of recombinant bacterial whole genome '
                    'sequences using Gubbins". Nucleic Acids Res. 2015 Feb 18;43(3):e15. doi: 10.1093/nar/gku1196.',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('alignment_filename',        help='Multifasta alignment file')
    parser.add_argument('--outgroup',          '-o', help='Outgroup name for rerooting. A list of comma separated '
                                                          'names can be used if they form a clade')
    parser.add_argument('--starting_tree',     '-s', help='Starting tree')
    parser.add_argument('--use_time_stamp',    '-u', help='Use a time stamp in file names', action='store_true')
    parser.add_argument('--verbose',           '-v', help='Turn on debugging', action='store_true')
    parser.add_argument('--no_cleanup',        '-n', help='Dont cleanup intermediate files', action='store_true')
    parser.add_argument('--tree_builder',      '-t', help='Application to use for tree building', default="raxml",
                        choices=['raxml', 'fasttree', 'hybrid'])
    parser.add_argument('--iterations',        '-i', help='Maximum No. of iterations', type=int, default=5)
    parser.add_argument('--min_snps',          '-m', help='Min SNPs to identify a recombination block', type=int,
                        default=3)
    parser.add_argument('--filter_percentage', '-f', help='Filter out taxa with more than this percentage of gaps',
                        type=int, default=25)
    parser.add_argument('--prefix',            '-p', help='Add a prefix to the final output filenames')
    parser.add_argument('--threads',           '-c', help='Number of threads to run with RAXML, but only if a PTHREADS '
                                                         'version is available', type=int,  default=1)
    parser.add_argument('--converge_method',   '-z', help='Criteria to use to know when to halt iterations',
                        default='weighted_robinson_foulds', choices=['weighted_robinson_foulds', 'robinson_foulds',
                                                                     'recombination'])
    parser.add_argument('--version',                 action='version',
                        version=str(pkg_resources.get_distribution("gubbins").version))
    parser.add_argument('--min_window_size',   '-a', help='Minimum window size', type=int, default=100)
    parser.add_argument('--max_window_size',   '-b', help='Maximum window size', type=int, default=10000)
    parser.add_argument('--raxml_model',       '-r', help='RAxML model', default='GTRCAT',
                        choices=['GTRGAMMA', 'GTRCAT'])
    parser.add_argument('--remove_identical_sequences', '-d', help='Remove identical sequences', action='store_true')

    gubbins.common.parse_and_run(parser.parse_args(), parser.description)