Skip to content

Commit fe3762e

Browse files
committed
updating to version 0.2.0; docs for some fxns and readme
1 parent 57021dc commit fe3762e

File tree

5 files changed

+50
-10
lines changed

5 files changed

+50
-10
lines changed

README.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Requirements:
2222
- Seaborn
2323
- C++ compiler (g++ >= v4.8)
2424

25-
HyDe is a software package that detects a signal for hybridization in phylogenomic
25+
HyDe is a software package that detects hybridization in phylogenomic
2626
data sets using phylogenetic invariants. The primary interface for HyDe is a Python
2727
module called ``phyde`` (**P**\ ythonic **Hy**\ bridization **De**\ tection).
2828
``phyde`` provides a suite of tools for performing hypothesis tests on triples of taxa
@@ -51,6 +51,14 @@ as `Miniconda <https://conda.io/miniconda.html>`__.
5151
# Test the installation
5252
make test
5353
54+
The ``phyde`` module is also hosted on the Python Package Index (PyPI), and can be installed directly using
55+
``pip``.
56+
57+
.. code:: py
58+
59+
# Install from PyPI with pip
60+
pip install phyde
61+
5462
Running HyDe from the Command Line
5563
----------------------------------
5664

@@ -70,7 +78,7 @@ Running HyDe in Python
7078
import phyde as hd
7179
7280
# Run a hyde analysis
73-
hd.run_hyde(...)
81+
res = hd.run_hyde("data.txt", "map.txt", "out", 16, 4, 50000, bootReps=100)
7482
7583
# import a data set for testing particular triples
7684
data = hd.HydeData("data.txt", "map.txt", "out", 16, 4, 50000)

phyde/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
__version__ = "0.1.1"
2+
__version__ = "0.2.0"
33
__author__ = "Paul Blischak and Laura Kubatko"
44

55
from phyde.analyze.main import run_hyde

phyde/core/bootstrap.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ class Bootstrap:
1111
containing parameter values.
1212
"""
1313
def __init__(self, bootfile):
14+
"""
15+
Constructor.
16+
"""
1417
self.bootfile = bootfile
1518
self.breps = {}
1619
self.triples = []
1720
self._read_bootstraps(bootfile)
1821

1922
def __call__(self, attr, p1, hyb, p2):
23+
"""
24+
A callable method to access attributes rom a bootstrapped
25+
HyDe analysis. Returned as a list.
26+
"""
2027
return [t[attr] for t in self.breps[(p1, hyb, p2)]]
2128

2229
def _read_bootstraps(self, bootfile):
@@ -64,7 +71,7 @@ def _boot_info(self, b):
6471

6572
def summarize(self):
6673
"""
67-
74+
Summarizes the results of a bootsrapped HyDe analysis.
6875
"""
6976
summaries = {}
7077
for t in self.triples:
@@ -75,15 +82,28 @@ def summarize(self):
7582
return summaries
7683

7784
def gamma(self, p1, hyb, p2):
85+
"""
86+
Return the values of gamma for the triple (p1, hyb, p2).
87+
"""
7888
return [t['Gamma'] for t in self.breps[(p1, hyb, p2)]]
7989

8090
def zscore(self, p1, hyb, p2):
91+
"""
92+
Return the values of the test statistic for the triple (p1, hyb, p2).
93+
"""
8194
return [t['Zscore'] for t in self.breps[(p1, hyb, p2)]]
8295

8396
def pvalue(self, p1, hyb, p2):
97+
"""
98+
Return the p-values for the triple (p1, hyb, p2).
99+
"""
84100
return [t['Pvalue'] for t in self.breps[(p1, hyb, p2)]]
85101

86102
def abba_baba(self, p1, hyb, p2):
103+
"""
104+
Calculate Patterson's D-Statistic for all bootstrap replicates
105+
for the triple (p1, hyb, p2). Uses vectorization with numpy arrays.
106+
"""
87107
return ((np.array([t['ABBA'] for t in self.breps[(p1, hyb, p2)]]) - np.array([t['ABAB'] for t in self.breps[(p1, hyb, p2)]])) /
88108
(np.array([t['ABBA'] for t in self.breps[(p1, hyb, p2)]]) + np.array([t['ABAB'] for t in self.breps[(p1, hyb, p2)]])))
89109

phyde/core/result.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@ class HydeResult:
1212
"""
1313
def __init__(self, infile):
1414
"""
15-
15+
Constructor.
1616
"""
1717
self.infile = infile
1818
self.res = {}
1919
self.triples = []
2020
self._read_hyde_results(infile)
2121

2222
def __call__(self, attr, p1, hyb, p2):
23+
"""
24+
Callable method for accessing information in a HydeResult object.
25+
"""
2326
return self.res[(p1, hyb, p2)][attr]
2427

2528
def _read_hyde_results(self, file):
2629
"""
27-
30+
Fxn for reading in results file from a hyde_cpp analysis.
2831
"""
2932
with open(file) as f:
3033
results = f.read().splitlines()[1:-1]
@@ -40,7 +43,7 @@ def _read_hyde_results(self, file):
4043

4144
def _hyde_info(self, b):
4245
"""
43-
46+
Store information for HyDe hypothesis test.
4447
"""
4548
if len(b) != 18:
4649
raise ValueError("** Warning: length of hyde entry is incorrect. **")
@@ -69,5 +72,8 @@ def _hyde_info(self, b):
6972
return hyde_info
7073

7174
def abba_baba(self, p1, hyb, p2):
75+
"""
76+
Calculate Patterson's D-Statistic for the triple (p1, hyb, p2).
77+
"""
7278
return ((np.array(self.res[(p1,hyb,p2)]['ABBA']) - np.array(self.res[(p1,hyb,p2)]['ABAB'])) /
7379
(np.array(self.res[(p1,hyb,p2)]['ABBA']) + np.array(self.res[(p1,hyb,p2)]['ABAB'])))

setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,23 @@
6666
print(" Please see the documentation at http://hybridization-detection.rtfd.io/.\n")
6767
sys.exit()
6868
else:
69-
setup(name="phyde",
70-
version="0.1.1",
69+
setup(
70+
name="phyde",
71+
version="0.2.0",
7172
description="Hybridization detection using phylogenetic invariants",
7273
long_description=open('README.rst').read(),
7374
url="https://github.com/pblischak/HyDe",
7475
author="Paul Blischak & Laura Kubatko",
7576
author_email="blischak.4@osu.edu",
76-
license="GPL",
7777
packages=find_packages(),
7878
ext_modules=cythonize("phyde/**/*.pyx", compiler_directives={'--cplus': True}),
7979
include_dirs=[numpy.get_include()],
8080
scripts=['scripts/run_hyde.py', 'src/hyde_cpp'],
81+
license="GPL",
82+
classifiers=[
83+
'Programming Language :: Python',
84+
'Programming Language :: Python :: 2',
85+
'Programming Language :: Python :: 2.7',
86+
],
8187
zip_safe=False
8288
)

0 commit comments

Comments
 (0)