Skip to content

Commit

Permalink
Merge branch '0.0.X' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-pv committed Jan 23, 2022
2 parents 7ef2395 + 78f11b1 commit de1670e
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 178 deletions.
4 changes: 3 additions & 1 deletion conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
python:
- 3.9
- 3.9
- 3.8
- 3.7
6 changes: 3 additions & 3 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ requirements:
- flake8
run:
- python
- ete3>=3.*
- ete3>=3.1.2
- biopython>=1.78
- tqdm>=4.62.3
- numpy>=1.19
- pandas>=1.3.5
- pandas>=1.1.0
- pillow>=8.4.0
- seaborn>=0.11.2
- matplotlib>=3.5.0
- pyqt>=5.*
- pyqt>=5.9.2
- jupyter>=1.0.0

test:
Expand Down
4 changes: 2 additions & 2 deletions pyiwe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
See README.md for complete documentation.
"""

__version__ = '0.0.6'
__version__ = '0.0.7'

import sys
import traceback
Expand All @@ -18,7 +18,7 @@
from .utils import visualize
from .config import pyiw_config
except ModuleNotFoundError:
print('ModuleNotFoundError happened. Check your dependencies.')
print('ModuleNotFoundError happened. Check your dependencies. Ignore during packaging.')
traceback.print_exc(file=sys.stdout)

TNTSetup().setup()
Expand Down
12 changes: 8 additions & 4 deletions pyiwe/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os
import sys

Expand All @@ -12,10 +13,13 @@ def __init__(self):
self.correct_platfrom = self.platform in self.available_platforms

def get_tnt_path(self) -> str:
tnt_path = {
'linux': os.environ.get('TNT_PATH'),
}
return tnt_path.get(self.platform)
split_symb = {'linux': ":", 'win32': ";"}
found_path = None
for p in os.environ["PATH"].split(split_symb.get(self.platform)):
if "TNT" in p:
found_path = p
break
return found_path


pyiw_config = PyIWConfig()
1 change: 1 addition & 0 deletions pyiwe/iwe.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import glob
import itertools
import os
Expand Down
1 change: 1 addition & 0 deletions pyiwe/utils/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import datetime as dt


Expand Down
7 changes: 4 additions & 3 deletions pyiwe/utils/processing.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import io
import re

Expand Down Expand Up @@ -32,7 +33,7 @@ def check_tree_formats_selection(tree_format: str):
Returns:
"""
_tree_formats = list(supported_formats.keys())
_tree_formats = tuple(supported_formats.keys())
if tree_format not in _tree_formats:
raise AssertionError(f'Tree format is not recognized: {tree_format}\n Available: {_tree_formats}')

Expand Down Expand Up @@ -121,15 +122,15 @@ def buffer_convert(trees, out_format: str, **kwargs) -> io.StringIO:


def get_tnt_trees(tree_path: str, output_format: str = 'newick',
verbose: bool = True) -> tuple[list[ph.BaseTree.Tree], str]:
verbose: bool = True) -> list[list[ph.BaseTree.Tree], str]:
"""
Read TNT tree and return it in format `output_format`.
Args:
tree_path: str, the path to a tree
output_format: str, possible formats: 'newick', 'nexus', 'nexml', 'phyloxml', newick is default
verbose: bool, verbosity for trees reading
Returns: tuple[list[ph.BaseTree.Tree], str]
Returns: list[list[ph.BaseTree.Tree], str]
"""
check_tree_formats_selection(output_format)
Expand Down
1 change: 1 addition & 0 deletions pyiwe/utils/visualize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import annotations
import os

import matplotlib.pyplot as plt
Expand Down
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ete3>=3.1.2
biopython>=1.78
tqdm>=4.62.3
numpy>=1.19
pandas>=1.1.0
pillow>=8.4.0
seaborn>=0.11.2
matplotlib>=3.5.0
PyQt5>=5.15.6
jupyter>=1.0.0
159 changes: 0 additions & 159 deletions requirements.yml

This file was deleted.

11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os

from setuptools import setup, find_packages
from setuptools.command.install import install

Expand Down Expand Up @@ -32,15 +31,15 @@ def run(self):
description="Python wrapper for TNT (Tree analysis using New Technology) implied weighting with clades support",
long_description=long_description,
install_requires=[
'ete3>=3.*',
'ete3>=3.1.2',
'biopython>=1.78',
'tqdm>=4.62.3',
'numpy>=1.19',
'pandas>=1.3.5',
'pandas>=1.1.0',
'pillow>=8.4.0',
'seaborn>=0.11.2',
'matplotlib>=3.5.0',
'PyQt5>=5.*',
'PyQt5>=5.15.6',
'jupyter>=1.0.0',
],
package_data={'pyiwe': ['tests/testdata/bryocorini/*',
Expand All @@ -50,7 +49,7 @@ def run(self):
]},
setup_requires=['flake8'],
tests_require=['pytest'],
python_requires='>=3.9',
python_requires='>=3.7',
cmdclass={
'install': _TNTSetup,
},
Expand All @@ -61,6 +60,8 @@ def run(self):
"Operating System :: Unix",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
url="https://github.com/alexander-pv/pyiwe",
Expand Down
7 changes: 6 additions & 1 deletion tutorial/pyiwe_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ def runner(args: argparse.Namespace):
with open(os.path.join(args.output_folder, 'final_tree_newick.txt'), 'w') as f:
f.write(majority_tree.format(format='newick'))
open_ete_browser(tree=ETree(majority_tree.format(format='newick')))
df_tree_flat = df.explode(column=['k_vals'])

if int(pd.__version__.split('.')[1]) < 3:
df_tree_flat = df.explode('k_vals')
else:
df_tree_flat = df.explode(column=['k_vals'])

tree_vis.make_k_stripplot(df=df_tree_flat, x='clade_id', y='k_vals', save=False)


Expand Down

0 comments on commit de1670e

Please sign in to comment.