Skip to content

Commit ba82618

Browse files
merve-kilicmerve-kilic
authored andcommitted
edit
1 parent 67ba00a commit ba82618

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

FastRoot.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main():
3333
parser.add_argument("-v", "--version", action='version',
3434
version=fastroot.PROGRAM_NAME + " " + fastroot.PROGRAM_VERSION,
3535
help="Show FastRoot version and exit")
36-
parser.add_argument("-x", "--maxIter", required=False, type=int, default=1000,
36+
parser.add_argument("-x", "--maxIter", required=False, type=int, default=None,
3737
help="Maximum number of iterations to run cvxopt")
3838

3939
# print help message if no argument is given
@@ -88,19 +88,21 @@ def main():
8888
assert method in METHOD2FUNC, "Invalid method! Valid options: MP for midpoint, MV for minVAR, OG for outgroups, RTT for root-to-tip"
8989
logger.info("Rooting Method: " + METHOD2DESC[method] + " Rooting")
9090

91-
if args.maxIter != 1000:
92-
if method != 'RTT':
93-
logger.warning("The maximum number of iterations (-x) is only used with the root-to-tip rooting (RTT)")
94-
else:
95-
logger.info("Maximum iterations: " + str(args.maxIter))
91+
if method == 'RTT':
92+
if args.maxIter and args.maxIter < 1000:
93+
logger.warning("Invalid number of maximum iterations (-x). Must be at least 1000. Set back to 1000 by default.")
94+
maxIter = max(1000, args.maxIter) if args.maxIter else 1000
95+
logger.info("Maximum iterations: " + str(maxIter))
96+
elif args.maxIter is not None:
97+
logger.warning("The maximum number of iterations (-x) is only used with root-to-tip rooting (RTT)")
9698

9799
# read and root each tree
98100
for i,line in enumerate(args.input):
99101
tree = read_tree(line, schema=args.schema.lower())
100102
if method == 'OG':
101103
a_tree = OGR_Tree(OGs, ddpTree=tree,logger_id=i+1,logger_stream=stream)
102104
elif method == 'RTT':
103-
a_tree = RTT_Tree(smplTimes, ddpTree=tree,logger_id=i+1,logger_stream=stream, maxIter=args.maxIter)
105+
a_tree = RTT_Tree(smplTimes, ddpTree=tree,logger_id=i+1,logger_stream=stream, maxIter=maxIter)
104106
else:
105107
a_tree = METHOD2FUNC[method](ddpTree=tree,logger_id=i+1,logger_stream=stream)
106108

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ python3 -m pip install FastRoot
3737
python3 setup.py install --user
3838
```
3939

40-
After installation, run:
40+
##Testing
4141

4242
```bash
43-
FastRoot.py -h
43+
FastRoot_test.py
4444
```
45-
to see the commandline help of FastRoot.
45+
- description.......
4646

4747
## Usage
4848

0 commit comments

Comments
 (0)