-
Notifications
You must be signed in to change notification settings - Fork 27
/
graphlan_annotate.py
executable file
·61 lines (51 loc) · 2.24 KB
/
graphlan_annotate.py
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
#!/usr/bin/env python3
#------------------------------------------------------------------------------
# NAME: graphlan_annotate.py
# DESCRIPTION: TBA
#
# Author: Nicola Segata
# email: [email protected]
#
#
#------------------------------------------------------------------------------
__author__ = 'Nicola Segata ([email protected])'
__version__ = '1.1.4'
__date__ = '16 July 2020'
import sys
from sys import argv
from argparse import ArgumentParser
from src.graphlan_lib import CircTree as CTree
def read_params(args):
parser = ArgumentParser(
description="GraPhlAn annotate module "+__version__+" ("+__date__+") "
"AUTHORS: "+__author__)
arg = parser.add_argument
arg('intree', type=str, metavar='input_tree',
help = "the input tree in Newick, Nexus, PhyloXML or "
"plain text format" )
arg('outtree', type=str, metavar='output_tree', nargs='?',
default = None,
help = "the output tree in PhyloXML format containing the newly "
"added annotations. If not specified, the input tree file "
"will be overwritten")
arg('--annot', default=None, metavar="annotation_file", type=str,
help = "specify the annotation file" )
#arg('-c', type=str, metavar='clade_name', default=None,
# help = "For command line annotation specifies the clade to be "
# "annotated (\* means global setting)")
#arg('-p', type=str, metavar='property_name', default=None,
# help = "For command line annotation specifies the property to be "
# "annotated")
#arg('-v', type=str, metavar='property_name', default=None,
# help = "For command line annotation specifies the value to be "
# "annotated")
arg( '-v','--version', action='version', version="GraPhlAn version "+__version__+" ("+__date__+")",
help="Prints the current GraPhlAn version and exit" )
return vars(parser.parse_args())
def main():
args = read_params( argv )
ctree = CTree( args['intree'] )
ctree.annotate( args['annot'], args['outtree'] if args['outtree'] else args['intree'] ) # ,
# c = args['c'], p = args['p'], v = args['v'])
if __name__ == "__main__":
main()