-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up evolutionary rate analysis
- Loading branch information
1 parent
1bbe34f
commit a3ebe2a
Showing
3 changed files
with
7 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
from typing import Dict | ||
|
||
from .base import Tree | ||
|
||
|
||
class EvolutionaryRate(Tree): | ||
def __init__(self, args) -> None: | ||
super().__init__(**self.process_args(args)) | ||
|
||
def run(self): | ||
def run(self) -> None: | ||
tree = self.read_tree_file() | ||
total_tree_length = self.calculate_total_tree_length(tree) | ||
total_tree_length = tree.total_branch_length() | ||
num_terminals = tree.count_terminals() | ||
print(round(total_tree_length / num_terminals, 4)) | ||
|
||
def process_args(self, args): | ||
def process_args(self, args) -> Dict[str, str]: | ||
return dict(tree_file_path=args.tree) | ||
|
||
def calculate_total_tree_length(self, tree): | ||
total_len = float(0.0) | ||
total_len = tree.total_branch_length() | ||
|
||
if isinstance(total_len, (int, float)): | ||
return total_len |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters