PTreeGenerator  1.0
Simple phylogenetic tree generation from multiple sequence alignment.
 All Classes Namespaces Files Functions Variables
Functions
main Namespace Reference

The main module with the main method. More...

Functions

def main
 The main method.

Detailed Description

The main module with the main method.

Handles the comand line options and delegates actions to other modules.

Function Documentation

def main.main ( )

The main method.

First to be executed when the program is run.

Definition at line 13 of file main.py.

13 
14 def main():
15  description="This is a simple tool for generating phylogenetic trees from multiple sequence alignments. " \
16  "It implements two tree building approaches (Neigbor-Joining and Maximum Parsimony)." \
17  "It can also do some simple visualizations and export the tree in the Newick format."
18  epilog = "For more info see the GitHub page (https://github.com/martin-sicho/PTreeGenerator) " \
19  "or contact 'sichom@vscht.cz'."
20  arg_parser = ArgumentParser(prog="ptreegen", description=description, epilog=epilog)
21  arg_parser.add_argument('--version'
22  , action='version'
23  , version='1.0-alpha')
24  arg_parser.add_argument('alignment_file'
25  , help='Multiple sequence alignment in FASTA format.')
26  arg_parser.add_argument('-m'
27  ,'--method'
28  , action='store'
29  , default=ptreegen.TreeBuildAlgorithms.NJ
30  , help='Method used to build the tree. One of the following: "'
31  + ptreegen.TreeBuildAlgorithms.NJ + '" for neigbor joining and "'
32  + ptreegen.TreeBuildAlgorithms.PARSIMONY + '" for a parsimony method. '
33  + 'Neigbor joining is the default method.'
34  )
35  arg_parser.add_argument('-i'
36  , '--pars-tree-count'
37  , action='store'
38  , default=1000
39  , help="Number of trees used to build a consensus tree from when using "
40  + "the parsimony method. Default value is 1000.")
41  arg_parser.add_argument('-g'
42  , '--no-gaps'
43  , action='store_true'
44  , help="Remove all gapped postions from the alignment before tree building.")
45  arg_parser.add_argument('-p'
46  , '--gap-penalty'
47  , action='store'
48  , default=0.5
49  , help="Gap penalty. Default value is 0.5.")
50  arg_parser.add_argument('-c'
51  , '--no-cleaning'
52  , action='store_true'
53  , help="Do not clean badly conserved regions from the alignment before tree building.")
54  arg_parser.add_argument('-u'
55  , '--gap-cutoff'
56  , action='store'
57  , default=0.8
58  , help="When cleaning the alignment, keep only columns with "
59  + "non-gap frequency above this threshold. Default value is 0.8.")
60  arg_parser.add_argument('-r'
61  , '--pair-cutoff'
62  , action='store'
63  , default=0.3
64  , help="When cleaning the alignment, keep only columns where the frequency of identical pairs is above this threshold. Default value is 0.3.")
65  arg_parser.add_argument('-s'
66  , '--sequence-type'
67  , action='store'
68  , default=ptreegen.SeqTypes.AA
69  , help='Type of the sequences in the alignment (proteins by default): "'
70  + ptreegen.SeqTypes.AA + '" for proteins, "'
71  + ptreegen.SeqTypes.DNA + '" for DNA and "'
72  + ptreegen.SeqTypes.RNA + '" for RNA.'
73  )
74  arg_parser.add_argument('-d'
75  , '--dist-measure'
76  , action='store'
77  , default=ptreegen.DistMeasures.JUKES_CANTOR
78  , help='Distance function to be used to compute distance '
79  + 'between sequences (Jukes-Cantor by default): "'
80  + ptreegen.DistMeasures.P_DISTANCE + '" for p-distance, "'
81  + ptreegen.DistMeasures.POISSON_CORRECTED + '" for Poisson correction and "'
82  + ptreegen.DistMeasures.JUKES_CANTOR + '" for Jukes-Cantor.'
83  )
84 
85  # visualization arguments
86  arg_parser.add_argument('-f'
87  , '--out-form'
88  , action='store'
89  , default=ptreegen.OutputForm.PRINT + "," + ptreegen.OutputForm.NEWICK
90  , help='The output formats for the resulting tree as a comma separated list. '
91  + 'Possible options: "'
92  + ptreegen.OutputForm.PRINT + '" prints the tree to command line, "'
93  + ptreegen.OutputForm.NEWICK + '" saves the tree in newick format to a file in the input directory, "'
94  + ptreegen.OutputForm.IMAGE_PNG + '" saves the tree as a PNG image in the input directory, "'
95  + ptreegen.OutputForm.IMAGE_SVG + '" saves the tree as a PNG image in the input directory, "'
96  + ptreegen.OutputForm.GUI + '" shows the tree in a graphical viewer.'
97  )
98  arg_parser.add_argument('-t'
99  , '--tree-type'
100  , action='store'
101  , default=ptreegen.TreeType.CIRC
102  , help='The type of the tree to be rendered. '
103  + 'The default is circular. Can be one of: "'
104  + ptreegen.TreeType.CIRC + '" for circular or "'
105  + ptreegen.TreeType.RECT + '" for rectangular.'
106  )
107 
108 
109  arguments = arg_parser.parse_args()
110  results = ptreegen.Computation(vars(arguments))
111  results.showResults()
112 
113  return 0