Skip to content

Commit

Permalink
Merge branch 'fix/trimming'
Browse files Browse the repository at this point in the history
  • Loading branch information
cdiener committed Jan 4, 2024
2 parents 2194b04 + 7ec6e8b commit 74c3fbd
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This includes a list of major changes for each minor version starting from 0.10.
For information on how to use `q2-micom` please refer to
[the tutorial](https://micom-dev.github.io/q2-micom).

#### 0.13.1

Fixes the broken prefix trimming.

Now also reports the matched relative abundance in verbose build output.

### 0.13.0

Fixes issues with the new model databases due to automatic stripping of taxonomic rank
Expand Down
24 changes: 20 additions & 4 deletions q2_micom/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,29 @@ def build_spec(
micom_taxonomy = pd.merge(model_files, tax, on=ranks)
micom_taxonomy = micom_taxonomy[micom_taxonomy.relative > cutoff]
del micom_taxonomy["file"]
stats = micom_taxonomy.sample_id.value_counts().describe()
n_stats = micom_taxonomy.sample_id.value_counts().describe()
ab_stats = micom_taxonomy.groupby("sample_id").relative.sum().describe() * 100.0
print("Merged with the database using ranks: %s" % ", ".join(ranks))
if stats.count == 1.0:
stats["std"] = 0.0
if n_stats.count() == 1:
n_stats["std"] = 0.0
ab_stats["std"] = 0.0
print(
"Each community model contains %d-%d taxa (average %d+-%d)."
% (stats["min"], stats["max"], round(stats["mean"]), round(stats["std"]))
% (
n_stats["min"],
n_stats["max"],
round(n_stats["mean"]),
round(n_stats["std"]),
)
)
print(
"Community models cover %.2f%%-%.2f%% of the total abundance (average %.2f%%+-%.2f%%)."
% (
ab_stats["min"],
ab_stats["max"],
round(ab_stats["mean"]),
round(ab_stats["std"]),
)
)
return micom_taxonomy

Expand Down
24 changes: 12 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ long_description = file: README.md
long_description_content_type = text/markdown
license = Apache License 2.0
url = https://github.com/micom-dev/q2-micom
classifiers =
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Bio-Informatics
Expand All @@ -22,7 +22,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
keywords =
keywords =
microbiome
modeling
metabolism
Expand All @@ -32,25 +32,25 @@ keywords =
zip_safe = False
packages = find:
python_requires = >=3.6
install_requires =
install_requires =
cobra>=0.18.1
micom>=0.33.0
micom>=0.33.1
jinja2>=2.10.3
qiime2>=2021.2
rich>=6.0
pandas>=1.0
tests_require =
tests_require =
coverage
pytest
pytest-cov
flake8

[options.package_data]
q2_micom =
q2_micom =
citations.bib

[options.entry_points]
qiime2.plugins =
qiime2.plugins =
q2-micom = q2_micom.plugin_setup:plugin

[bumpversion:file:setup.py]
Expand All @@ -62,7 +62,7 @@ search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[tool:pytest]
filterwarnings =
filterwarnings =
ignore::DeprecationWarning
ignore::FutureWarning

Expand All @@ -75,15 +75,15 @@ branch = True
omit = q2_micom/tests/*

[coverage:report]
exclude_lines =
exclude_lines =
pragma: no cover

def __repr__
if self\.debug

raise AssertionError
raise NotImplementedError

if 0:
if __name__ == .__main__.:
ignore_errors = True
Expand Down

0 comments on commit 74c3fbd

Please sign in to comment.