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