eukcc 2.1.3__tar.gz → 2.2.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 (35) hide show
  1. {eukcc-2.1.3/eukcc.egg-info → eukcc-2.2.0}/PKG-INFO +6 -4
  2. {eukcc-2.1.3 → eukcc-2.2.0}/README.md +2 -2
  3. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/__main__.py +11 -3
  4. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/eukcc.py +5 -2
  5. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/refine.py +1 -1
  6. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/set_define.py +1 -1
  7. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/treehandler.py +18 -7
  8. eukcc-2.2.0/eukcc/version.py +1 -0
  9. {eukcc-2.1.3 → eukcc-2.2.0/eukcc.egg-info}/PKG-INFO +6 -4
  10. {eukcc-2.1.3 → eukcc-2.2.0}/pyproject.toml +8 -1
  11. {eukcc-2.1.3 → eukcc-2.2.0}/setup.py +1 -1
  12. {eukcc-2.1.3 → eukcc-2.2.0}/tests/test_tree.py +20 -1
  13. eukcc-2.1.3/eukcc/version.py +0 -1
  14. {eukcc-2.1.3 → eukcc-2.2.0}/LICENSE +0 -0
  15. {eukcc-2.1.3 → eukcc-2.2.0}/MANIFEST.in +0 -0
  16. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/__init__.py +0 -0
  17. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/base.py +0 -0
  18. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/bin.py +0 -0
  19. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/exec.py +0 -0
  20. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/fasta.py +0 -0
  21. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/file.py +0 -0
  22. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/find_markerset.py +0 -0
  23. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc/helper.py +0 -0
  24. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc.egg-info/SOURCES.txt +0 -0
  25. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc.egg-info/dependency_links.txt +0 -0
  26. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc.egg-info/entry_points.txt +0 -0
  27. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc.egg-info/requires.txt +0 -0
  28. {eukcc-2.1.3 → eukcc-2.2.0}/eukcc.egg-info/top_level.txt +0 -0
  29. {eukcc-2.1.3 → eukcc-2.2.0}/scripts/binlinks.py +0 -0
  30. {eukcc-2.1.3 → eukcc-2.2.0}/scripts/filter_euk_bins.py +0 -0
  31. {eukcc-2.1.3 → eukcc-2.2.0}/setup.cfg +0 -0
  32. {eukcc-2.1.3 → eukcc-2.2.0}/tests/test_basic.py +0 -0
  33. {eukcc-2.1.3 → eukcc-2.2.0}/tests/test_eukcc.py +0 -0
  34. {eukcc-2.1.3 → eukcc-2.2.0}/tests/test_fasta.py +0 -0
  35. {eukcc-2.1.3 → eukcc-2.2.0}/tests/test_file.py +0 -0
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eukcc
3
- Version: 2.1.3
3
+ Version: 2.2.0
4
4
  Summary: Check eukaryotic genomes or MAGs for completeness and contamination
5
- Home-page: https://github.com/Finn-Lab/EukCC/
5
+ Home-page: https://github.com/EBI-Metagenomics/EukCC
6
6
  Author: Paul Saary
7
7
  Author-email: Paul Saary <eukcc@paulsaary.de>, MGnify team <metagenomics-help@ebi.ac.uk>
8
8
  License: GPLv3
9
+ Project-URL: Homepage, https://github.com/EBI-Metagenomics/EukCC
10
+ Project-URL: Documentation, https://eukcc.readthedocs.io/
9
11
  Keywords: bioinformatics,mags,eukaryotic,completeness,contamination
10
12
  Classifier: Programming Language :: Python :: 3.6
11
13
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -87,11 +89,11 @@ In addition, you need to install mandatory requirements:
87
89
 
88
90
  ### eukcc single
89
91
 
90
- - `eukcc.csv` - table with estimated completeness, contamination and taxonomy lineage
92
+ - `eukcc.tsv` - table with estimated completeness, contamination and taxonomy lineage
91
93
 
92
94
  ### eukcc folder
93
95
 
94
- - `eukcc.csv` - table with estimated completeness, contamination and taxonomy lineage for **good** quality bins
96
+ - `eukcc.tsv` - table with estimated completeness, contamination and taxonomy lineage for **good** quality bins
95
97
  - `merged_bins.csv` - table of merged refined bins
96
98
  - `bad_quality.csv`- table with estimated completeness, contamination and taxonomy lineage for **bad** quality bins (chosen marker gene set is supported by less than half of the alignments)
97
99
  - `missing_marker_genes.txt` - line separated list of bins with not defined set of marker genes
@@ -51,11 +51,11 @@ In addition, you need to install mandatory requirements:
51
51
 
52
52
  ### eukcc single
53
53
 
54
- - `eukcc.csv` - table with estimated completeness, contamination and taxonomy lineage
54
+ - `eukcc.tsv` - table with estimated completeness, contamination and taxonomy lineage
55
55
 
56
56
  ### eukcc folder
57
57
 
58
- - `eukcc.csv` - table with estimated completeness, contamination and taxonomy lineage for **good** quality bins
58
+ - `eukcc.tsv` - table with estimated completeness, contamination and taxonomy lineage for **good** quality bins
59
59
  - `merged_bins.csv` - table of merged refined bins
60
60
  - `bad_quality.csv`- table with estimated completeness, contamination and taxonomy lineage for **bad** quality bins (chosen marker gene set is supported by less than half of the alignments)
61
61
  - `missing_marker_genes.txt` - line separated list of bins with not defined set of marker genes
@@ -27,6 +27,14 @@ def update(dbfile=None):
27
27
  ncbi.update_taxonomy_database()
28
28
 
29
29
 
30
+ def no_estimate(E, state):
31
+ """
32
+ It was not possible to estimate this genome. Write the result file with NAs and stop.
33
+ """
34
+ E.write_result(E.state, os.path.join(state["out"], "eukcc.tsv"))
35
+ E.terminate(201)
36
+
37
+
30
38
  def run_eukcc(args):
31
39
  state = eukcc_state(workdir=None, options=vars(args))
32
40
  logging.info("EukCC version {}".format(version.__version__))
@@ -77,7 +85,7 @@ def run_eukcc(args):
77
85
  ):
78
86
  logging.info("Doing a first pass placement in the base database")
79
87
  if E.placement() is None:
80
- E.terminate(1)
88
+ no_estimate(E, state)
81
89
  # decide which db to use
82
90
  clade = E.determine_subdb()
83
91
  if clade != "base":
@@ -87,7 +95,7 @@ def run_eukcc(args):
87
95
 
88
96
  # pick marker set and placement in one step
89
97
  if E.pick_marker_set() is None:
90
- E.terminate(1)
98
+ no_estimate(E, state)
91
99
  E.state["scmg_data"] = E.hmmsearch_scmg(
92
100
  E.state["workdir"], E.state["faa"], E.state["marker_set"]["profiles"]
93
101
  )
@@ -99,7 +107,7 @@ def run_eukcc(args):
99
107
  # aggregate all the interesting data, such as estimated quality
100
108
  # the expected and found SCMGs and the workdir
101
109
  E.state.save_state()
102
- E.write_result(E.state, os.path.join(state["out"], "eukcc.csv"))
110
+ E.write_result(E.state, os.path.join(state["out"], "eukcc.tsv"))
103
111
 
104
112
  if state["extra"]:
105
113
  # search for missing markers
@@ -942,6 +942,7 @@ class eukcc:
942
942
  """
943
943
  if result is None:
944
944
  logging.debug("Empty result given, so we write NAs for all values")
945
+ result = [self.state]
945
946
 
946
947
  if type(result) == dict:
947
948
  result = [result]
@@ -959,10 +960,12 @@ class eukcc:
959
960
  else:
960
961
  lng = "NA"
961
962
 
963
+ # quality is missing if we could not estimate this genome
964
+ quality = res.get("quality") or {}
962
965
  row = {
963
966
  "fasta": res["fasta"],
964
- "completeness": res["quality"]["completeness"],
965
- "contamination": res["quality"]["contamination"],
967
+ "completeness": quality.get("completeness", "NA"),
968
+ "contamination": quality.get("contamination", "NA"),
966
969
  "ncbi_lng": lng,
967
970
  }
968
971
  writer.writerow(row)
@@ -150,7 +150,7 @@ def refine(state):
150
150
  )
151
151
 
152
152
  # initialize output tables
153
- result_table = os.path.join(state["out"], "eukcc.csv")
153
+ result_table = os.path.join(state["out"], "eukcc.tsv")
154
154
  write_table(None, result_table, header=True)
155
155
  # table for bad quality bins
156
156
  bad_quality_result_table = os.path.join(state["out"], "bad_quality.csv")
@@ -31,5 +31,5 @@ def define_set_w_genomes(args):
31
31
  # launch new EukCC instance
32
32
  E = eukcc(state)
33
33
  if E.pick_marker_set() is None:
34
- E.terminate(1)
34
+ E.terminate(201)
35
35
  E.state.save_state(filename=state["name"])
@@ -166,20 +166,31 @@ def tax_LCA(
166
166
  t = Tree(tree)
167
167
  info = load_tax_info(taxinfo, dbfile=etedb)
168
168
 
169
- if placements is None:
170
- known_leafes = set(info.keys())
171
- else:
172
- node = t.get_tree_root()
173
- known_leafes = set(node.get_leaf_names()) - set(placements)
169
+ # Split tree leaves into known references and queries:
170
+ #
171
+ # Tree leaves: ref_A ref_B query_1 query_2 query_3
172
+ # │ │ │ │ │
173
+ # └─ known ─┘ └──── queries ─────┘
174
+ # Taxonomy info: ref_A ref_B
175
+ # Placements: query_1 query_2 query_3
176
+ #
177
+ # A known leaf is a tree leaf with taxonomy information.
178
+ # Query leaves are everything else; if placements are provided,
179
+ # only queries present in the placement set are considered.
180
+
181
+ all_leafes = set(t.get_tree_root().get_leaf_names())
182
+ known_leafes = all_leafes & set(info.keys())
183
+ query_leafes = all_leafes - known_leafes
184
+ if placements is not None:
185
+ query_leafes = query_leafes & set(placements)
174
186
 
175
187
  logging.debug(
176
188
  "Determining the LCA in a tree with {} leafes".format(len(known_leafes))
177
189
  )
178
190
 
179
191
  leafes = set()
180
- all_leafes = set(node.get_leaf_names())
181
192
  pl_lngs = []
182
- for place in all_leafes - known_leafes:
193
+ for place in query_leafes:
183
194
  # jump to node
184
195
  node = t.search_nodes(name=place)[0]
185
196
  while True:
@@ -0,0 +1 @@
1
+ __version__ = "2.2.0"
@@ -1,11 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eukcc
3
- Version: 2.1.3
3
+ Version: 2.2.0
4
4
  Summary: Check eukaryotic genomes or MAGs for completeness and contamination
5
- Home-page: https://github.com/Finn-Lab/EukCC/
5
+ Home-page: https://github.com/EBI-Metagenomics/EukCC
6
6
  Author: Paul Saary
7
7
  Author-email: Paul Saary <eukcc@paulsaary.de>, MGnify team <metagenomics-help@ebi.ac.uk>
8
8
  License: GPLv3
9
+ Project-URL: Homepage, https://github.com/EBI-Metagenomics/EukCC
10
+ Project-URL: Documentation, https://eukcc.readthedocs.io/
9
11
  Keywords: bioinformatics,mags,eukaryotic,completeness,contamination
10
12
  Classifier: Programming Language :: Python :: 3.6
11
13
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -87,11 +89,11 @@ In addition, you need to install mandatory requirements:
87
89
 
88
90
  ### eukcc single
89
91
 
90
- - `eukcc.csv` - table with estimated completeness, contamination and taxonomy lineage
92
+ - `eukcc.tsv` - table with estimated completeness, contamination and taxonomy lineage
91
93
 
92
94
  ### eukcc folder
93
95
 
94
- - `eukcc.csv` - table with estimated completeness, contamination and taxonomy lineage for **good** quality bins
96
+ - `eukcc.tsv` - table with estimated completeness, contamination and taxonomy lineage for **good** quality bins
95
97
  - `merged_bins.csv` - table of merged refined bins
96
98
  - `bad_quality.csv`- table with estimated completeness, contamination and taxonomy lineage for **bad** quality bins (chosen marker gene set is supported by less than half of the alignments)
97
99
  - `missing_marker_genes.txt` - line separated list of bins with not defined set of marker genes
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "eukcc"
3
- version = "2.1.3"
3
+ dynamic = ["version"]
4
4
  readme = "README.md"
5
5
  license = {text = "GPLv3"}
6
6
  authors = [
@@ -25,6 +25,10 @@ dependencies = [
25
25
  "six"
26
26
  ]
27
27
 
28
+ [project.urls]
29
+ Homepage = "https://github.com/EBI-Metagenomics/EukCC"
30
+ Documentation = "https://eukcc.readthedocs.io/"
31
+
28
32
  [build-system]
29
33
  requires = ["setuptools>=61.0"]
30
34
  build-backend = "setuptools.build_meta"
@@ -35,6 +39,9 @@ packages = [
35
39
  "scripts",
36
40
  ]
37
41
 
42
+ [tool.setuptools.dynamic]
43
+ version = {attr = "eukcc.version.__version__"}
44
+
38
45
  [project.scripts]
39
46
  # eukcc
40
47
  eukcc = "eukcc.__main__:main"
@@ -15,7 +15,7 @@ setuptools.setup(
15
15
  description="Check eukaryotic genomes or MAGs for completeness and contamination",
16
16
  long_description=long_description,
17
17
  long_description_content_type="text/markdown",
18
- url="https://github.com/Finn-Lab/EukCC/",
18
+ url="https://github.com/EBI-Metagenomics/EukCC",
19
19
  py_modules=[],
20
20
  entry_points={
21
21
  "console_scripts": [
@@ -1,10 +1,11 @@
1
1
  import unittest
2
2
  import os
3
- from eukcc.treehandler import tree_sets
3
+ from eukcc.treehandler import tree_sets, tax_LCA
4
4
 
5
5
  TESTDATA_SCMG_GZ = os.path.join(os.path.dirname(__file__), "testfiles", "SCMG_TEST.csv.gz")
6
6
  TESTDATA_SCTREE = os.path.join(os.path.dirname(__file__), "testfiles", "tree_scmg.csv")
7
7
  TESTDATA_TAXINFO = os.path.join(os.path.dirname(__file__), "testfiles", "tree_taxinfo.csv")
8
+ TESTDATA_TAX_LCA = os.path.join(os.path.dirname(__file__), "testfiles", "tax_lca_taxinfo.csv")
8
9
 
9
10
 
10
11
  class test_tree(unittest.TestCase):
@@ -21,3 +22,21 @@ class test_tree(unittest.TestCase):
21
22
  s, placement, TESTDATA_SCTREE, set_species=4, set_size=2, set_prevalence=80, taxinfo=TESTDATA_TAXINFO
22
23
  )
23
24
  self.assertEqual(t.marker_set.profiles, set(["Marker100", "Marker80"]))
25
+
26
+ def test_tax_LCA_partial_placements(self):
27
+ tree = (
28
+ "(((GCA_015473125.1,metaeuk_OY253681.1_29),(((GCA_006384855.1,metaeuk_OY253673.1_71),"
29
+ "metaeuk_OY253685.1_62),((((metaeuk_OY253682.1_41,GCA_004138255.1),metaeuk_OY253672.1_198),"
30
+ "((GCA_011766145.1,metaeuk_OY253676.1_95),(GCA_004335775.1,metaeuk_OY253680.1_173))),"
31
+ "((GCA_010646915.1,metaeuk_OY253673.1_210),((metaeuk_OY253668.1_317,GCA_002794665.1),"
32
+ "GCA_000690575.1))))),metaeuk_OY253675.1_91);"
33
+ )
34
+ lng = tax_LCA(
35
+ tree,
36
+ TESTDATA_TAX_LCA,
37
+ placements=["metaeuk_OY253681.1_29", "metaeuk_OY253676.1_95"],
38
+ add_protist_common=False,
39
+ )
40
+
41
+ # root, cellular organisms, Eukaryota, Viridiplantae, Chlorophyta
42
+ self.assertEqual(lng, ["1", "131567", "2759", "33090", "3041"])
@@ -1 +0,0 @@
1
- __version__ = "2.1.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes