-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from gibsramen/develop
Update to 0.4.2
- Loading branch information
Showing
47 changed files
with
1,192 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
*.swo | ||
*.swp | ||
*egg-info/ | ||
*__pycache__/ | ||
dist/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include xebec/cookiecutter.json | ||
graft xebec/{{cookiecutter.project_name}} | ||
graft xebec/js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[pytest] | ||
filterwarnings = | ||
ignore::DeprecationWarning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Much of this page is taken from the gemelli setup file | ||
import ast | ||
import re | ||
from setuptools import find_packages, setup | ||
|
||
# version parsing from __init__ pulled from Flask's setup.py | ||
# https://github.com/mitsuhiko/flask/blob/master/setup.py | ||
_version_re = re.compile(r"__version__\s+=\s+(.*)") | ||
|
||
with open("xebec/__init__.py", "rb") as f: | ||
hit = _version_re.search(f.read().decode("utf-8")).group(1) | ||
version = str(ast.literal_eval(hit)) | ||
|
||
with open("README.md") as f: | ||
long_description = f.read() | ||
|
||
classes = """ | ||
Development Status :: 3 - Alpha | ||
License :: OSI Approved :: BSD License | ||
Topic :: Software Development :: Libraries | ||
Topic :: Scientific/Engineering | ||
Topic :: Scientific/Engineering :: Bio-Informatics | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3 :: Only | ||
Operating System :: Unix | ||
Operating System :: POSIX | ||
Operating System :: MacOS :: MacOS X | ||
""" | ||
classifiers = [s.strip() for s in classes.split("\n") if s] | ||
|
||
description = ( | ||
"Snakemake pipeline for microbiome diversity effect size " | ||
"benchmarking." | ||
) | ||
|
||
standalone = ["xebec=xebec.cli.cli:xebec"] | ||
|
||
setup( | ||
name="xebec", | ||
author="Gibraan Rahman", | ||
author_email="grahman@eng.ucsd.edu", | ||
description=description, | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/gibsramen/xebec", | ||
version=version, | ||
license="BSD-3-Clause", | ||
packages=["xebec/src", "xebec/cli", "xebec"], | ||
install_requires=[ | ||
"numpy", | ||
"h5py==3.1.0", | ||
"evident>=0.2.0", | ||
"gemelli>=0.0.8", | ||
"pandas>=1.0.0", | ||
"scikit-bio>=0.5.6", | ||
"unifrac", | ||
"snakemake", | ||
"cookiecutter", | ||
"seaborn", | ||
"bokeh", | ||
"click" | ||
], | ||
include_package_data=True, | ||
package_data={"": ["xebec/js", "xebec/{{cookiecutter.project_name}}"]}, | ||
entry_points={"console_scripts": standalone}, | ||
classifiers=classifiers, | ||
) |
5 changes: 5 additions & 0 deletions
5
...project_name}}/workflow/scripts/helper.py → xebec/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import os | ||
from pathlib import PurePath | ||
import subprocess | ||
|
||
import click | ||
from cookiecutter.main import cookiecutter | ||
|
||
from xebec import COOKIE_DIR | ||
from xebec.src._validate import (validate_table, validate_metadata, | ||
validate_tree) | ||
|
||
|
||
@click.command(name="xebec") | ||
@click.option("--feature-table", "-ft", required=True, type=click.Path(), | ||
help="Feature table in BIOM format.") | ||
@click.option("--metadata", "-m", required=True, type=click.Path(), | ||
help="Sample metadata in TSV format.") | ||
@click.option("--tree", "-t", required=True, type=click.Path(), | ||
help="Phylogenetic tree in Newick format.") | ||
@click.option("--output", "-o", required=True, type=click.Path(), | ||
help="Output workflow directory.") | ||
@click.option("--max-category-levels", default=5, show_default=True, | ||
type=int, help="Max number of levels in a category.") | ||
@click.option("--min-level-count", default=3, show_default=True, | ||
type=int, help="Min number of samples per level per category.") | ||
@click.option("--rarefy-percentile", default=10, show_default=True, | ||
type=float, help="Percentile of sample depths at which to rarefy.") | ||
@click.option("--validate-input/--no-validate-input", default=True, | ||
help="Whether to validate input before creating workflow.", | ||
show_default=True) | ||
@click.option("--execute/--no-execute", default=False, type=bool, | ||
help="Whether to automatically execute the workflow.", | ||
show_default=True) | ||
def xebec( | ||
feature_table, | ||
metadata, | ||
tree, | ||
output, | ||
max_category_levels, | ||
min_level_count, | ||
rarefy_percentile, | ||
validate_input, | ||
execute | ||
): | ||
feature_table = os.path.abspath(feature_table) | ||
metadata = os.path.abspath(metadata) | ||
tree = os.path.abspath(tree) | ||
|
||
if validate_input: | ||
validate_table(feature_table) | ||
validate_metadata(metadata) | ||
validate_tree(tree) | ||
|
||
output = PurePath(output) | ||
project_dir = output.parent | ||
project_name = os.path.basename(output) | ||
os.chdir(project_dir) | ||
|
||
args={ | ||
"project_name": project_name, | ||
"feature_table_file": feature_table, | ||
"sample_metadata_file": metadata, | ||
"phylogenetic_tree_file": tree, | ||
"max_category_levels": max_category_levels, | ||
"min_level_count": min_level_count, | ||
"rarefaction_depth_percentile": rarefy_percentile, | ||
} | ||
|
||
cookiecutter(COOKIE_DIR, no_input=True, extra_context=args) | ||
|
||
if execute: | ||
os.chdir(project_name) | ||
subprocess.run(["snakemake", "--cores", "1"], check=True) | ||
|
||
|
||
if __name__ == "__main__": | ||
xebec() |
File renamed without changes.
Oops, something went wrong.