pyham 1.2.0__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. pyham-2.0.0/.github/dependabot.yml +7 -0
  2. pyham-2.0.0/.github/workflows/python-package.yml +69 -0
  3. pyham-2.0.0/.github/workflows/python-publish.yml +33 -0
  4. pyham-2.0.0/.gitignore +10 -0
  5. pyham-2.0.0/.readthedocs.yaml +22 -0
  6. {pyham-1.2.0/pyham.egg-info → pyham-2.0.0}/PKG-INFO +86 -31
  7. {pyham-1.2.0 → pyham-2.0.0}/README.rst +69 -10
  8. pyham-2.0.0/ReleaseNotes.txt +201 -0
  9. {pyham-1.2.0 → pyham-2.0.0}/docs/api.rst +1 -0
  10. pyham-2.0.0/docs/conf.py +195 -0
  11. {pyham-1.2.0 → pyham-2.0.0}/docs/filter.rst +1 -1
  12. {pyham-1.2.0 → pyham-2.0.0}/docs/index.rst +0 -1
  13. pyham-2.0.0/docs/make.bat +36 -0
  14. {pyham-1.2.0 → pyham-2.0.0}/docs/mapper.rst +1 -1
  15. pyham-2.0.0/docs/validation.rst +13 -0
  16. pyham-2.0.0/example/TreeProfileHOG:0355161.html +79 -0
  17. pyham-2.0.0/example/TreeProfileHOG:0359282.html +79 -0
  18. pyham-2.0.0/example/run_hog_queries.py +50 -0
  19. pyham-2.0.0/example/run_iHam.py +19 -0
  20. pyham-2.0.0/example/run_pyham_using_oma_server.py +22 -0
  21. pyham-2.0.0/example/run_treeProfile.py +19 -0
  22. pyham-2.0.0/example/simpleEx.orthoxml +549 -0
  23. pyham-2.0.0/example/simpleEx.phyloxml +1 -0
  24. pyham-2.0.0/help.pdf +0 -0
  25. {pyham-1.2.0 → pyham-2.0.0}/pyham/TreeProfile.py +41 -60
  26. pyham-2.0.0/pyham/__init__.py +20 -0
  27. pyham-2.0.0/pyham/_version.py +24 -0
  28. {pyham-1.2.0 → pyham-2.0.0}/pyham/abstractgene.py +181 -26
  29. {pyham-1.2.0 → pyham-2.0.0}/pyham/genome.py +14 -22
  30. {pyham-1.2.0 → pyham-2.0.0}/pyham/ham.py +154 -133
  31. pyham-2.0.0/pyham/id_formats.py +137 -0
  32. {pyham-1.2.0 → pyham-2.0.0}/pyham/iham.py +0 -6
  33. {pyham-1.2.0 → pyham-2.0.0}/pyham/mapper.py +2 -13
  34. pyham-2.0.0/pyham/parsers.py +959 -0
  35. pyham-2.0.0/pyham/taxonomy.py +349 -0
  36. pyham-2.0.0/pyham/utils.py +31 -0
  37. pyham-2.0.0/pyham/validation.py +914 -0
  38. {pyham-1.2.0 → pyham-2.0.0/pyham.egg-info}/PKG-INFO +86 -31
  39. pyham-2.0.0/pyham.egg-info/SOURCES.txt +121 -0
  40. pyham-2.0.0/pyham.egg-info/entry_points.txt +2 -0
  41. {pyham-1.2.0 → pyham-2.0.0}/pyham.egg-info/requires.txt +6 -7
  42. pyham-2.0.0/pyham.egg-info/scm_file_list.json +116 -0
  43. pyham-2.0.0/pyham.egg-info/scm_version.json +8 -0
  44. pyham-2.0.0/pyproject.toml +53 -0
  45. pyham-2.0.0/setup.cfg +4 -0
  46. pyham-2.0.0/tests/data/Conflict1/hog.orthoxml +33 -0
  47. pyham-2.0.0/tests/data/Conflict1/note.txt +1 -0
  48. pyham-2.0.0/tests/data/Conflict1/tree.nwk +1 -0
  49. pyham-2.0.0/tests/data/augmented-test-v05.nwk +1 -0
  50. pyham-2.0.0/tests/data/augmented-test-v05.orthoxml +266578 -0
  51. pyham-2.0.0/tests/data/cases.nwk +1 -0
  52. pyham-2.0.0/tests/data/cases.orthoxml +74 -0
  53. pyham-2.0.0/tests/data/euk-HOG0001687.nwk +1 -0
  54. pyham-2.0.0/tests/data/euk-HOG0001687.orthoxml +11805 -0
  55. pyham-2.0.0/tests/data/fam_402997.augmented.orthoxml +251 -0
  56. pyham-2.0.0/tests/data/fam_402997.nwk +1 -0
  57. pyham-2.0.0/tests/data/fam_800112.augmented.orthoxml +648 -0
  58. pyham-2.0.0/tests/data/hog_0027790.nhx +1 -0
  59. pyham-2.0.0/tests/data/hog_1074943.augmented.orthoxml +28736 -0
  60. pyham-2.0.0/tests/data/hog_1074943.nwk +1 -0
  61. pyham-2.0.0/tests/data/inverted_level.nwk +1 -0
  62. pyham-2.0.0/tests/data/inverted_level.orthoxml +35 -0
  63. pyham-2.0.0/tests/data/issue19/eglps.orthoxml +1138 -0
  64. pyham-2.0.0/tests/data/issue19/insecta.nwk +1 -0
  65. pyham-2.0.0/tests/data/issue25/hog.orthoxml +134 -0
  66. pyham-2.0.0/tests/data/issue25/hog2.orthoxml +142 -0
  67. pyham-2.0.0/tests/data/issue25/species_tree.nwk_scientific.nwk +1 -0
  68. pyham-2.0.0/tests/data/issue25/speciestree.nwk +1 -0
  69. pyham-2.0.0/tests/data/loft_taxid_gap.orthoxml +50 -0
  70. pyham-2.0.0/tests/data/nested_duplication_without_ids.orthoxml +2837 -0
  71. pyham-2.0.0/tests/data/paralog_group_some_child_no_id.orthoxml +1069 -0
  72. pyham-2.0.0/tests/data/parser/Info.txt +1 -0
  73. pyham-2.0.0/tests/data/parser/conflict_duplication_children.orthoxml +71 -0
  74. pyham-2.0.0/tests/data/parser/tree.newick +1 -0
  75. pyham-2.0.0/tests/data/shared_missing_level.nwk +1 -0
  76. pyham-2.0.0/tests/data/shared_missing_level.orthoxml +56 -0
  77. pyham-2.0.0/tests/data/tom.orthoxml +7369 -0
  78. pyham-2.0.0/tests/data/tomato.nwk +1 -0
  79. {pyham-1.2.0 → pyham-2.0.0}/tests/test_abstractgene.py +19 -0
  80. pyham-2.0.0/tests/test_ancestral_genome_content.py +450 -0
  81. pyham-2.0.0/tests/test_augmented-v05.py +55 -0
  82. {pyham-1.2.0 → pyham-2.0.0}/tests/test_genome.py +10 -10
  83. {pyham-1.2.0 → pyham-2.0.0}/tests/test_ham.py +7 -7
  84. pyham-2.0.0/tests/test_id_formats.py +118 -0
  85. {pyham-1.2.0 → pyham-2.0.0}/tests/test_orthoxmlparser.py +4 -2
  86. {pyham-1.2.0 → pyham-2.0.0}/tests/test_taxonomy.py +13 -13
  87. {pyham-1.2.0 → pyham-2.0.0}/tests/test_treeprofile.py +10 -5
  88. pyham-2.0.0/tests/test_validation.py +217 -0
  89. pyham-1.2.0/MANIFEST.in +0 -6
  90. pyham-1.2.0/pyham/__init__.py +0 -17
  91. pyham-1.2.0/pyham/parsers.py +0 -382
  92. pyham-1.2.0/pyham/taxonomy.py +0 -318
  93. pyham-1.2.0/pyham/utils.py +0 -53
  94. pyham-1.2.0/pyham.egg-info/SOURCES.txt +0 -62
  95. pyham-1.2.0/setup.cfg +0 -14
  96. pyham-1.2.0/setup.py +0 -67
  97. {pyham-1.2.0 → pyham-2.0.0}/LICENSE.txt +0 -0
  98. {pyham-1.2.0 → pyham-2.0.0}/docs/Makefile +0 -0
  99. {pyham-1.2.0 → pyham-2.0.0}/docs/gene.rst +0 -0
  100. {pyham-1.2.0 → pyham-2.0.0}/docs/genome.rst +0 -0
  101. {pyham-1.2.0 → pyham-2.0.0}/docs/ham.rst +0 -0
  102. {pyham-1.2.0 → pyham-2.0.0}/docs/iHam.rst +0 -0
  103. {pyham-1.2.0 → pyham-2.0.0}/docs/taxonomy.rst +0 -0
  104. {pyham-1.2.0 → pyham-2.0.0}/docs/treeprofile.rst +0 -0
  105. {pyham-1.2.0 → pyham-2.0.0}/docs/utils.rst +0 -0
  106. {pyham-1.2.0 → pyham-2.0.0}/pyham.egg-info/dependency_links.txt +0 -0
  107. {pyham-1.2.0 → pyham-2.0.0}/pyham.egg-info/top_level.txt +0 -0
  108. {pyham-1.2.0 → pyham-2.0.0}/tests/data/SimpleEx_complexParalogGetHOGS3format.xml +0 -0
  109. {pyham-1.2.0 → pyham-2.0.0}/tests/data/birds.nwk +0 -0
  110. {pyham-1.2.0 → pyham-2.0.0}/tests/data/birds.orthoxml +0 -0
  111. {pyham-1.2.0 → pyham-2.0.0}/tests/data/hogvisEx.orthoxml +0 -0
  112. {pyham-1.2.0 → pyham-2.0.0}/tests/data/multiple_duplication_example.xml +0 -0
  113. {pyham-1.2.0 → pyham-2.0.0}/tests/data/p53_augmented.orthoxml +0 -0
  114. {pyham-1.2.0 → pyham-2.0.0}/tests/data/p53_augmented_speciestree.phyloxml +0 -0
  115. {pyham-1.2.0 → pyham-2.0.0}/tests/data/paralogs_only_inside_og.nwk +0 -0
  116. {pyham-1.2.0 → pyham-2.0.0}/tests/data/paralogs_only_inside_og.orthoxml +0 -0
  117. {pyham-1.2.0 → pyham-2.0.0}/tests/data/paralogs_only_toplevel_og.nwk +0 -0
  118. {pyham-1.2.0 → pyham-2.0.0}/tests/data/paralogs_only_toplevel_og.orthoxml +0 -0
  119. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleEx.nwk +0 -0
  120. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleEx.orthoxml +0 -0
  121. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleEx.phyloxml +0 -0
  122. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleExNoCladeName.phyloxml +0 -0
  123. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleExNoName.nwk +0 -0
  124. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleExNoName.phyloxml +0 -0
  125. {pyham-1.2.0 → pyham-2.0.0}/tests/data/simpleEx_complexParalogs.orthoxml +0 -0
  126. {pyham-1.2.0 → pyham-2.0.0}/tests/functional_test.py +0 -0
  127. {pyham-1.2.0 → pyham-2.0.0}/tests/test_annotated_bird_orthoxml_problem.py +0 -0
  128. {pyham-1.2.0 → pyham-2.0.0}/tests/test_conflict.py +0 -0
  129. {pyham-1.2.0 → pyham-2.0.0}/tests/test_iham.py +0 -0
  130. {pyham-1.2.0 → pyham-2.0.0}/tests/test_mapper.py +0 -0
  131. {pyham-1.2.0 → pyham-2.0.0}/tests/test_utils.py +0 -0
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
@@ -0,0 +1,69 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
+
4
+ name: Build Python package and run tests
5
+
6
+ on:
7
+ push:
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+
13
+ runs-on: ubuntu-latest
14
+ continue-on-error: ${{ matrix.experimental || false }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
19
+ experimental: [false]
20
+ include:
21
+ - python-version: "3.15-dev"
22
+ experimental: true
23
+
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ uses: actions/setup-python@v7
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+ allow-prereleases: true
31
+ - name: Install libxml2/libxslt headers (no lxml wheel yet for this Python build)
32
+ if: matrix.experimental
33
+ run: |
34
+ sudo apt-get update
35
+ sudo apt-get install -y libxml2-dev libxslt-dev
36
+ - name: Install dependencies
37
+ run: |
38
+ python -m pip install --upgrade pip
39
+ python -m pip install flake8 pytest
40
+ python -m pip install .
41
+ - name: Lint with flake8
42
+ run: |
43
+ # stop the build if there are Python syntax errors or undefined names
44
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
45
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
46
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
47
+ - name: Test with pytest
48
+ run: |
49
+ pytest -v
50
+
51
+ docs:
52
+
53
+ runs-on: ubuntu-latest
54
+
55
+ steps:
56
+ - uses: actions/checkout@v7
57
+ with:
58
+ fetch-depth: 0 # setuptools_scm needs the tags to determine the version
59
+ - name: Set up Python
60
+ uses: actions/setup-python@v7
61
+ with:
62
+ python-version: "3.12"
63
+ - name: Install dependencies
64
+ run: |
65
+ python -m pip install --upgrade pip
66
+ python -m pip install ".[docs]"
67
+ - name: Build documentation (warnings are errors, as on Read the Docs)
68
+ run: |
69
+ sphinx-build -W --keep-going -b html docs docs/_build/html
@@ -0,0 +1,33 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
+
4
+ name: Upload Python Package
5
+
6
+ on:
7
+ release:
8
+ types: [created]
9
+
10
+ jobs:
11
+ deploy:
12
+
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ id-token: write # IMPORTANT: mandatory for trusted publishing
16
+
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ with:
20
+ fetch-depth: 0
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v7
23
+ with:
24
+ python-version: '3.x'
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install build
29
+ - name: Build package
30
+ run: python -m build
31
+ - name: Publish package
32
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33
33
+
pyham-2.0.0/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ build
2
+ dist
3
+ */__pycache__
4
+ *.egg-info
5
+ *.pyc
6
+ .ropeproject
7
+ .idea
8
+ .ipynb_checkpoints
9
+ pyham/_version.py
10
+ docs/_build
@@ -0,0 +1,22 @@
1
+ # Read the Docs configuration, see https://docs.readthedocs.io/en/stable/config-file/v2.html
2
+ version: 2
3
+
4
+ build:
5
+ os: ubuntu-24.04
6
+ tools:
7
+ python: "3.12"
8
+ jobs:
9
+ post_checkout:
10
+ # setuptools_scm derives the version from git tags, which a shallow clone lacks
11
+ - git fetch --unshallow --tags || true
12
+
13
+ sphinx:
14
+ configuration: docs/conf.py
15
+ fail_on_warning: true
16
+
17
+ python:
18
+ install:
19
+ - method: pip
20
+ path: .
21
+ extra_requirements:
22
+ - docs
@@ -1,45 +1,41 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pyham
3
- Version: 1.2.0
3
+ Version: 2.0.0
4
4
  Summary: A tool to analyse Hierarchical Orthologous Groups (HOGs)
5
- Home-page: http://lab.dessimoz.org/ham
6
- Author: Dessimoz Lab - Laboratory of Computational Evolutionary Biology and Genomics
7
- Author-email: adrian.altenhoff@inf.ethz.ch
8
- License: MIT
9
- Keywords: orthology, HOGs, orthoxml
5
+ Author-email: Dessimoz Lab - Laboratory of Computational Evolutionary Biology and Genomics <adrian.altenhoff@inf.ethz.ch>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, http://lab.dessimoz.org/ham
8
+ Keywords: orthology,HOGs,orthoxml
10
9
  Classifier: Development Status :: 5 - Production/Stable
11
10
  Classifier: Environment :: Console
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: Intended Audience :: Science/Research
14
13
  Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Programming Language :: Python :: 2
17
- Classifier: Programming Language :: Python :: 2.7
18
14
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.5
20
- Classifier: Programming Language :: Python :: 3.6
21
- Classifier: Programming Language :: Python :: 3.7
22
- Classifier: Programming Language :: Python :: 3.8
23
15
  Classifier: Programming Language :: Python :: 3.9
24
16
  Classifier: Programming Language :: Python :: 3.10
25
17
  Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/x-rst
26
23
  License-File: LICENSE.txt
27
- Requires-Dist: ete3>=3.1
28
- Requires-Dist: six
24
+ Requires-Dist: ete4>=4.3
29
25
  Requires-Dist: lxml
30
- Requires-Dist: future
31
26
  Requires-Dist: requests
32
27
  Requires-Dist: tqdm
33
28
  Requires-Dist: scipy
34
29
  Provides-Extra: test
35
- Requires-Dist: nose; extra == "test"
30
+ Requires-Dist: pytest; extra == "test"
31
+ Provides-Extra: docs
32
+ Requires-Dist: sphinx>=7; extra == "docs"
36
33
  Provides-Extra: dev
37
- Requires-Dist: nose; extra == "dev"
34
+ Requires-Dist: pytest; extra == "dev"
38
35
  Requires-Dist: sphinx; extra == "dev"
39
36
  Requires-Dist: wheel; extra == "dev"
40
37
  Requires-Dist: twine; extra == "dev"
41
- Requires-Dist: fabric; extra == "dev"
42
- Requires-Dist: fabric3; extra == "dev"
38
+ Dynamic: license-file
43
39
 
44
40
  pyHam: A Tool to Analyze Hierarchical Orthologous Groups (HOGs)
45
41
  ===============================================================
@@ -65,23 +61,50 @@ If you use pyHam in your work, please consider citing:
65
61
 
66
62
  Installation
67
63
  ------------
68
- Ham is written in python3 (also compatible with python2), with little external dependencies, i.e.
69
- currently ete3, lml, six. The setup script should resolve these
70
- dependencies automatically.
71
- Consider using pip to install the package directly from a checked out git repo
64
+ pyHam requires Python 3.9 or newer. Its dependencies (ete4, lxml, requests, tqdm and scipy)
65
+ are installed automatically by pip:
72
66
 
73
67
  .. code-block:: sh
74
68
 
75
69
  python -m pip install --upgrade pip
76
70
  pip install pyham
77
71
 
72
+ To work on pyHam itself, install it in editable mode from a checkout of the git repository:
73
+
74
+ .. code-block:: sh
75
+
76
+ python -m pip install -e ".[dev]"
77
+ pytest
78
+
79
+ Quick start
80
+ -----------
81
+
82
+ .. code-block:: python
83
+
84
+ import pyham
85
+
86
+ ham = pyham.Ham("simpleEx.phyloxml", "simpleEx.orthoxml",
87
+ tree_format="phyloxml", use_internal_name=True)
88
+
89
+ # look up a gene family (HOG) and export it as a gene tree
90
+ hog = ham.get_hog_by_id("HOG:0355161")
91
+ print(hog.to_ete_tree().write())
92
+
93
+ # compare a species with one of its ancestors
94
+ human = ham.get_extant_genome_by_name("Homo sapiens")
95
+ primates = ham.get_ancestral_genome_by_name("Primates")
96
+ vmap = ham.compare_genomes_vertically(human, primates)
97
+ print(len(vmap.get_retained()), len(vmap.get_duplicated()),
98
+ len(vmap.get_lost()), len(vmap.get_gained()))
99
+
78
100
  Example
79
101
  -------
80
- We prepare a ready-to-use example (see example folder) with few python scripts to use main pyHam features.
81
- You just have to run the following command in bash:
102
+ The ``example`` folder contains a few ready-to-use scripts that show the main pyHam features.
103
+ Run them from inside that folder:
82
104
 
83
105
  .. code-block:: sh
84
106
 
107
+ cd example
85
108
  python run_hog_queries.py
86
109
  python run_treeProfile.py
87
110
  python run_iHam.py
@@ -104,13 +127,16 @@ Support for pyHam by various HOG inference resources.
104
127
  +-----------------+------------------------------+---------------------------------------+-----------+
105
128
  ||OMA standalone|_| PhyloXML and Newick | All HOGs | YES |
106
129
  +-----------------+------------------------------+---------------------------------------+-----------+
130
+ | |FastOMA|_ | Newick | All HOGs | YES |
131
+ +-----------------+------------------------------+---------------------------------------+-----------+
107
132
  | |Ensembl|_ | |Newicke|_ | one HOG at a time | YES |
108
133
  +-----------------+------------------------------+---------------------------------------+-----------+
109
- | |HieranoidDB|_ | |Newickh|_ | one HOG at a time | YES |
134
+ | |HieranoidDB|_ | Newick | one HOG at a time | YES |
110
135
  +-----------------+------------------------------+---------------------------------------+-----------+
111
136
 
112
137
  .. |OMA browser| replace:: ``OMA browser``
113
138
  .. |OMA standalone| replace:: ``OMA standalone``
139
+ .. |FastOMA| replace:: ``FastOMA``
114
140
  .. |Ensembl| replace:: ``Ensembl``
115
141
  .. |HieranoidDB| replace:: ``HieranoidDB``
116
142
 
@@ -119,27 +145,56 @@ Support for pyHam by various HOG inference resources.
119
145
  .. |PhyloXMLs| replace:: ``PhyloXML``
120
146
  .. |Newicks| replace:: ``Newick``
121
147
  .. |Newicke| replace:: ``Newick``
122
- .. |Newickh| replace:: ``Newick``
123
148
 
124
149
  .. |All HOGso| replace:: ``All HOGs``
125
150
  .. |one HOG at a timeo| replace:: ``one HOG at a time``
126
151
 
127
152
  .. _OMA browser: https://omabrowser.org
128
153
  .. _OMA standalone: https://omabrowser.org/standalone/
154
+ .. _FastOMA: https://github.com/DessimozLab/FastOMA
129
155
  .. _Ensembl: https://www.ensembl.org/index.html
130
156
  .. _HieranoidDB: http://hieranoidb.sbc.su.se/
131
157
 
132
158
  .. _PhyloXMLo: https://omabrowser.org/All/speciestree.phyloxml
133
159
  .. _Newicko: https://omabrowser.org/All/speciestree.nwk
134
160
  .. _Newicke: https://www.ensembl.org/info/about/speciestree.html
135
- .. _Newickh: http://hieranoid.sbc.su.se/download/H2/66c.tree
136
161
 
137
162
  .. _All HOGso: https://omabrowser.org/All/oma-hogs.orthoXML.gz
138
163
  .. _one HOG at a timeo: https://omabrowser.org/oma/hogs/
139
164
 
140
165
 
166
+ Common input problems
167
+ ---------------------
168
+ Most errors when loading data come from a species tree that doesn't match the OrthoXML file.
169
+ To check your inputs before analysing them, run:
170
+
171
+ .. code-block:: sh
172
+
173
+ pyham-validate species_tree.nwk hogs.orthoxml
174
+
175
+ or, from Python, ``print(pyham.validate_input(tree_file, hog_file, ...))``, which takes the same
176
+ arguments as ``pyham.Ham``. It reports every problem it finds at once, each with the affected species,
177
+ levels or families and, where it can tell, how to fix it. The most common problems are:
178
+
179
+ - **Use the species tree the HOGs were inferred with.** pyHam maps each HOG onto the species
180
+ tree, so the tree must contain every species in the OrthoXML file under the same name, and
181
+ its topology must agree with how the HOGs are nested. With OMA standalone and FastOMA, use the
182
+ species tree written alongside the HOGs.
183
+ - **use_internal_name=True needs unique internal node names.** Some newick trees label internal
184
+ nodes with numbers (e.g. support values) instead of taxon names. pyHam then reports that the
185
+ internal names are not unique. Pass ``use_internal_name=False`` and pyHam will build names
186
+ from the child species instead.
187
+ - **PhyloXML trees need a name field on every node.** Choose the field with
188
+ ``phyloxml_leaf_name_tag`` and ``phyloxml_internal_name_tag``. If the tree has no
189
+ ``<taxonomy>`` elements, use ``clade_name``, or pass ``use_internal_name=False``.
190
+ - **Taxonomic conflicts.** If a HOG's taxonomic range (``TaxRange`` or taxid) disagrees with
191
+ the species tree, pyHam raises ``TaxonomicConflictError`` listing every conflicting family it
192
+ found. Pass ``fail_fast=True`` to stop at the first one.
193
+ - **Singletons.** Genes that belong to no HOG can be looked up with ``get_gene_by_id``, but
194
+ HOG-based tools such as tree profiles and iHam don't apply to them.
195
+
141
196
  Documentation
142
197
  -------------
143
- You can the full documentation of pyHam at http://zoo.cs.ucl.ac.uk/doc/pyham/index.html
198
+ The full documentation of pyHam, including the API reference, is available at https://pyham-dessimozlab.readthedocs.io.
144
199
 
145
200
 
@@ -22,23 +22,50 @@ If you use pyHam in your work, please consider citing:
22
22
 
23
23
  Installation
24
24
  ------------
25
- Ham is written in python3 (also compatible with python2), with little external dependencies, i.e.
26
- currently ete3, lml, six. The setup script should resolve these
27
- dependencies automatically.
28
- Consider using pip to install the package directly from a checked out git repo
25
+ pyHam requires Python 3.9 or newer. Its dependencies (ete4, lxml, requests, tqdm and scipy)
26
+ are installed automatically by pip:
29
27
 
30
28
  .. code-block:: sh
31
29
 
32
30
  python -m pip install --upgrade pip
33
31
  pip install pyham
34
32
 
33
+ To work on pyHam itself, install it in editable mode from a checkout of the git repository:
34
+
35
+ .. code-block:: sh
36
+
37
+ python -m pip install -e ".[dev]"
38
+ pytest
39
+
40
+ Quick start
41
+ -----------
42
+
43
+ .. code-block:: python
44
+
45
+ import pyham
46
+
47
+ ham = pyham.Ham("simpleEx.phyloxml", "simpleEx.orthoxml",
48
+ tree_format="phyloxml", use_internal_name=True)
49
+
50
+ # look up a gene family (HOG) and export it as a gene tree
51
+ hog = ham.get_hog_by_id("HOG:0355161")
52
+ print(hog.to_ete_tree().write())
53
+
54
+ # compare a species with one of its ancestors
55
+ human = ham.get_extant_genome_by_name("Homo sapiens")
56
+ primates = ham.get_ancestral_genome_by_name("Primates")
57
+ vmap = ham.compare_genomes_vertically(human, primates)
58
+ print(len(vmap.get_retained()), len(vmap.get_duplicated()),
59
+ len(vmap.get_lost()), len(vmap.get_gained()))
60
+
35
61
  Example
36
62
  -------
37
- We prepare a ready-to-use example (see example folder) with few python scripts to use main pyHam features.
38
- You just have to run the following command in bash:
63
+ The ``example`` folder contains a few ready-to-use scripts that show the main pyHam features.
64
+ Run them from inside that folder:
39
65
 
40
66
  .. code-block:: sh
41
67
 
68
+ cd example
42
69
  python run_hog_queries.py
43
70
  python run_treeProfile.py
44
71
  python run_iHam.py
@@ -61,13 +88,16 @@ Support for pyHam by various HOG inference resources.
61
88
  +-----------------+------------------------------+---------------------------------------+-----------+
62
89
  ||OMA standalone|_| PhyloXML and Newick | All HOGs | YES |
63
90
  +-----------------+------------------------------+---------------------------------------+-----------+
91
+ | |FastOMA|_ | Newick | All HOGs | YES |
92
+ +-----------------+------------------------------+---------------------------------------+-----------+
64
93
  | |Ensembl|_ | |Newicke|_ | one HOG at a time | YES |
65
94
  +-----------------+------------------------------+---------------------------------------+-----------+
66
- | |HieranoidDB|_ | |Newickh|_ | one HOG at a time | YES |
95
+ | |HieranoidDB|_ | Newick | one HOG at a time | YES |
67
96
  +-----------------+------------------------------+---------------------------------------+-----------+
68
97
 
69
98
  .. |OMA browser| replace:: ``OMA browser``
70
99
  .. |OMA standalone| replace:: ``OMA standalone``
100
+ .. |FastOMA| replace:: ``FastOMA``
71
101
  .. |Ensembl| replace:: ``Ensembl``
72
102
  .. |HieranoidDB| replace:: ``HieranoidDB``
73
103
 
@@ -76,27 +106,56 @@ Support for pyHam by various HOG inference resources.
76
106
  .. |PhyloXMLs| replace:: ``PhyloXML``
77
107
  .. |Newicks| replace:: ``Newick``
78
108
  .. |Newicke| replace:: ``Newick``
79
- .. |Newickh| replace:: ``Newick``
80
109
 
81
110
  .. |All HOGso| replace:: ``All HOGs``
82
111
  .. |one HOG at a timeo| replace:: ``one HOG at a time``
83
112
 
84
113
  .. _OMA browser: https://omabrowser.org
85
114
  .. _OMA standalone: https://omabrowser.org/standalone/
115
+ .. _FastOMA: https://github.com/DessimozLab/FastOMA
86
116
  .. _Ensembl: https://www.ensembl.org/index.html
87
117
  .. _HieranoidDB: http://hieranoidb.sbc.su.se/
88
118
 
89
119
  .. _PhyloXMLo: https://omabrowser.org/All/speciestree.phyloxml
90
120
  .. _Newicko: https://omabrowser.org/All/speciestree.nwk
91
121
  .. _Newicke: https://www.ensembl.org/info/about/speciestree.html
92
- .. _Newickh: http://hieranoid.sbc.su.se/download/H2/66c.tree
93
122
 
94
123
  .. _All HOGso: https://omabrowser.org/All/oma-hogs.orthoXML.gz
95
124
  .. _one HOG at a timeo: https://omabrowser.org/oma/hogs/
96
125
 
97
126
 
127
+ Common input problems
128
+ ---------------------
129
+ Most errors when loading data come from a species tree that doesn't match the OrthoXML file.
130
+ To check your inputs before analysing them, run:
131
+
132
+ .. code-block:: sh
133
+
134
+ pyham-validate species_tree.nwk hogs.orthoxml
135
+
136
+ or, from Python, ``print(pyham.validate_input(tree_file, hog_file, ...))``, which takes the same
137
+ arguments as ``pyham.Ham``. It reports every problem it finds at once, each with the affected species,
138
+ levels or families and, where it can tell, how to fix it. The most common problems are:
139
+
140
+ - **Use the species tree the HOGs were inferred with.** pyHam maps each HOG onto the species
141
+ tree, so the tree must contain every species in the OrthoXML file under the same name, and
142
+ its topology must agree with how the HOGs are nested. With OMA standalone and FastOMA, use the
143
+ species tree written alongside the HOGs.
144
+ - **use_internal_name=True needs unique internal node names.** Some newick trees label internal
145
+ nodes with numbers (e.g. support values) instead of taxon names. pyHam then reports that the
146
+ internal names are not unique. Pass ``use_internal_name=False`` and pyHam will build names
147
+ from the child species instead.
148
+ - **PhyloXML trees need a name field on every node.** Choose the field with
149
+ ``phyloxml_leaf_name_tag`` and ``phyloxml_internal_name_tag``. If the tree has no
150
+ ``<taxonomy>`` elements, use ``clade_name``, or pass ``use_internal_name=False``.
151
+ - **Taxonomic conflicts.** If a HOG's taxonomic range (``TaxRange`` or taxid) disagrees with
152
+ the species tree, pyHam raises ``TaxonomicConflictError`` listing every conflicting family it
153
+ found. Pass ``fail_fast=True`` to stop at the first one.
154
+ - **Singletons.** Genes that belong to no HOG can be looked up with ``get_gene_by_id``, but
155
+ HOG-based tools such as tree profiles and iHam don't apply to them.
156
+
98
157
  Documentation
99
158
  -------------
100
- You can the full documentation of pyHam at http://zoo.cs.ucl.ac.uk/doc/pyham/index.html
159
+ The full documentation of pyHam, including the API reference, is available at https://pyham-dessimozlab.readthedocs.io.
101
160
 
102
161
 
@@ -0,0 +1,201 @@
1
+
2
+ ########################################################################################
3
+
4
+ VERSION 1.2.0
5
+
6
+ FIX:
7
+ - Remove unnecessary files from git repo
8
+ - replace outdated nosetests -> pytest as test running
9
+
10
+ IMPROVEMENTS:
11
+ - Improve handling of HOG IDs in pyham. HOG objects use "hog_id" or "og" attribute
12
+ from orthoxml to show objects, and also include the taxonomic range.
13
+ - LOFT attribute will be loaded for gene elements if assigned in orthoxml.
14
+
15
+
16
+
17
+ ########################################################################################
18
+
19
+ VERSION 1.1.12
20
+
21
+ FIX:
22
+ - Fix issue of OrthoXML_manager.get_orthoxml_str not creating orthologous group if only content paralogous groups inside.
23
+
24
+ IMPROVEMENTS:
25
+ - Update iHam libraries to latest
26
+
27
+ ########################################################################################
28
+
29
+ VERSION 1.1.7
30
+
31
+ FIX:
32
+ - Fix issue with retrieving the correct species tree for a ham analysis if run
33
+ from remote datasource (oma server). (Fixes github issue #2)
34
+
35
+ IMPROVEMENTS:
36
+ - None
37
+
38
+ ########################################################################################
39
+
40
+ VERSION 1.1.6
41
+
42
+ FIX:
43
+ - Fix duplicated items in duplicationNode children for complex paralogous cases.
44
+
45
+ IMPROVEMENTS:
46
+ - None
47
+
48
+ ########################################################################################
49
+
50
+ VERSION 1.1.5
51
+
52
+ FIX:
53
+ - Fix iHam (keep use the d3.v3 instead of d3.v5).
54
+
55
+ IMPROVEMENTS:
56
+ - None
57
+
58
+ ########################################################################################
59
+
60
+ VERSION 1.1.4
61
+
62
+ FIX:
63
+ - Remote js library not loaded when opening iham or tree profile html output file.
64
+
65
+ IMPROVEMENTS:
66
+ - Add possibility to load one hog for remote database by single gene query (only oma for now)
67
+ - TreeProfile: Make visualisation clearer.
68
+
69
+ ########################################################################################
70
+
71
+ VERSION 1.1.3
72
+
73
+ FIX:
74
+ - Fix Bytes Error for phyloxml in python 3.
75
+
76
+ IMPROVEMENTS:
77
+ - Add few option to improve selection of xml tag in phyloxml for extant and ancestral
78
+ species names.
79
+
80
+ ########################################################################################
81
+
82
+ VERSION 1.1.2
83
+
84
+ FIX:
85
+ - Bug ancestral name were not set correctly using phyloxml taxonomy scientific name tag
86
+
87
+ IMPROVEMENTS:
88
+ - None.
89
+
90
+ ########################################################################################
91
+
92
+ VERSION 1.1.1
93
+
94
+ FIX:
95
+ - None
96
+
97
+ IMPROVEMENTS:
98
+ - Tree Profile: Add help modal.
99
+ - iHam: Update settings.
100
+
101
+ ########################################################################################
102
+
103
+ VERSION 1.1.0
104
+
105
+ FIX:
106
+ - None
107
+
108
+ IMPROVEMENTS:
109
+ - Tree Profile: add option to switch between number of genes resulting of each types of phylogenetic events or number of
110
+ phylogenetic events (NEW)
111
+ - Tree Profile: add few customisation options (Hide/Show elements, switch between fixed size of stacks or based on genome sizes)
112
+ - Add UnitTest for iHam
113
+ - Add number of duplication events in VerticalMapper.
114
+ - Add phyloXML as input format for phylogeny.
115
+
116
+ ########################################################################################
117
+
118
+ VERSION 1.0.9
119
+
120
+ FIX:
121
+ - None
122
+
123
+ IMPROVEMENTS:
124
+ - Tree profile: add scale bar, remove level annotations for taxonomic range without ancestral genes.
125
+ - For clarity purposes, genes that don't duplicate or get lost between two taxon are now denoted as 'retained' instead of 'identical'.
126
+
127
+ ########################################################################################
128
+
129
+ VERSION 1.0.8
130
+
131
+ FIX:
132
+ - fix secure duplication handling fix.
133
+
134
+ IMPROVEMENTS:
135
+ - None
136
+
137
+ ########################################################################################
138
+
139
+ VERSION 1.0.6
140
+
141
+ FIX:
142
+ - secure duplication handling.
143
+
144
+ IMPROVEMENTS:
145
+ - None
146
+
147
+
148
+ ########################################################################################
149
+
150
+ VERSION 1.0.5
151
+
152
+ FIX:
153
+ - Fix single HOG orthoXMLformating for iHam.
154
+
155
+ IMPROVEMENTS:
156
+ - None
157
+
158
+
159
+ ########################################################################################
160
+
161
+ VERSION 1.0.4
162
+
163
+ FIX:
164
+ - iHam compatible for p2 and p3.
165
+
166
+ IMPROVEMENTS:
167
+ - None
168
+
169
+
170
+ ########################################################################################
171
+
172
+ VERSION 1.0.2
173
+
174
+ FIX:
175
+ - UnitTesting module compatible for p2 and p3.
176
+
177
+ IMPROVEMENTS:
178
+ - None
179
+
180
+
181
+ ########################################################################################
182
+
183
+ VERSION 1.0.1
184
+
185
+ FIX:
186
+ - OrthoXML parser raise useless 'ValueError: Minimum 2 genomes are required, only 1 provided.' for highly duplicated HOGs.
187
+
188
+ IMPROVEMENTS:
189
+ - None
190
+
191
+ ########################################################################################
192
+
193
+ VERSION 1.0.0 - Official release
194
+
195
+ FIX:
196
+ - None
197
+
198
+ IMPROVEMENTS:
199
+ - None
200
+
201
+ ########################################################################################
@@ -16,6 +16,7 @@ Here is the documentation for the Ham objects.
16
16
  utils
17
17
  treeprofile
18
18
  iHam
19
+ validation
19
20
 
20
21
 
21
22