The main method.
First to be executed when the program is run.
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'
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'
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.'
35 arg_parser.add_argument(
'-i'
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'
44 , help=
"Remove all gapped postions from the alignment before tree building.")
45 arg_parser.add_argument(
'-p'
49 , help=
"Gap penalty. Default value is 0.5.")
50 arg_parser.add_argument(
'-c'
53 , help=
"Do not clean badly conserved regions from the alignment before tree building.")
54 arg_parser.add_argument(
'-u'
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'
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'
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.'
74 arg_parser.add_argument(
'-d'
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.'
86 arg_parser.add_argument(
'-f'
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.'
98 arg_parser.add_argument(
'-t'
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.'
109 arguments = arg_parser.parse_args()
110 results = ptreegen.Computation(vars(arguments))
111 results.showResults()