Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
merve-kilic authored and merve-kilic committed Nov 7, 2020
1 parent 67ba00a commit ba82618
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions FastRoot.py
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ def main():
parser.add_argument("-v", "--version", action='version',
version=fastroot.PROGRAM_NAME + " " + fastroot.PROGRAM_VERSION,
help="Show FastRoot version and exit")
parser.add_argument("-x", "--maxIter", required=False, type=int, default=1000,
parser.add_argument("-x", "--maxIter", required=False, type=int, default=None,
help="Maximum number of iterations to run cvxopt")

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

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

# read and root each tree
for i,line in enumerate(args.input):
tree = read_tree(line, schema=args.schema.lower())
if method == 'OG':
a_tree = OGR_Tree(OGs, ddpTree=tree,logger_id=i+1,logger_stream=stream)
elif method == 'RTT':
a_tree = RTT_Tree(smplTimes, ddpTree=tree,logger_id=i+1,logger_stream=stream, maxIter=args.maxIter)
a_tree = RTT_Tree(smplTimes, ddpTree=tree,logger_id=i+1,logger_stream=stream, maxIter=maxIter)
else:
a_tree = METHOD2FUNC[method](ddpTree=tree,logger_id=i+1,logger_stream=stream)

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -37,12 +37,12 @@ python3 -m pip install FastRoot
python3 setup.py install --user
```

After installation, run:
##Testing

```bash
FastRoot.py -h
FastRoot_test.py
```
to see the commandline help of FastRoot.
- description.......

## Usage

0 comments on commit ba82618

Please sign in to comment.