Skip to content

Commit

Permalink
Bugfix/billgreenwald/formatbedpe miscall (#20)
Browse files Browse the repository at this point in the history
* missed an argument in formatbedpe; realized coverage of tests didn't check the actual command line tool so added tests for those to prevent this issue in the future

* bumped version and pushed poetry

* black

* black
  • Loading branch information
billgreenwald committed Nov 23, 2022
1 parent 8059c7d commit e394386
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -4,4 +4,4 @@
*/.ipynb*
*/*/.ipynb*
__pycache__*
poetry.lock
.idea/workspace.xml
17 changes: 11 additions & 6 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Module/PyGLtools/column_flip.py
Expand Up @@ -127,4 +127,4 @@ def formatbedpe(A, header):

header, A = _processFile(args["a"], args["stdInA"])

formatbedpe(A)
formatbedpe(A, header)
Binary file added dist/PyGLtools-3.0.1.tar.gz
Binary file not shown.
Binary file added dist/pygltools-3.0.1-py3-none-any.whl
Binary file not shown.
157 changes: 157 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "PyGLtools"
version = "3.0.0"
version = "3.0.1"
description = "A genomic arithmetic tool for HiC or other paired-locus data"
authors = ["Bill Young Greenwald <billyounggreenwald@gmail.com>"]
license = "BSD3"
Expand Down
121 changes: 121 additions & 0 deletions tests/test_command_line_interface.py
@@ -0,0 +1,121 @@
import subprocess
from pathlib import Path
from parametrization import Parametrization

ASSET_DIR = Path(__file__).parent
PYTHON_FILE_DIR = ASSET_DIR / "../Module/PyGLtools/"

##can parameterize this in a sec


@Parametrization.autodetect_parameters()
@Parametrization.case(
name="browser",
script=PYTHON_FILE_DIR / "browser.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2="",
)
@Parametrization.case(
name="closest",
script=PYTHON_FILE_DIR / "closest.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.sorted.pgl",
)
@Parametrization.case(
name="closest1D",
script=PYTHON_FILE_DIR / "closest1D.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.bed",
)
@Parametrization.case(
name="formatbedpe",
script=PYTHON_FILE_DIR / "column_flip.py",
input_file_1=ASSET_DIR / "fixtures/file.A.pgl",
input_file_2="",
)
@Parametrization.case(
name="condense",
script=PYTHON_FILE_DIR / "condense.py",
input_file_1=ASSET_DIR / "fixtures/file.A.pgl",
input_file_2="",
)
@Parametrization.case(
name="conveRt",
script=PYTHON_FILE_DIR / "conveRt.py",
input_file_1=ASSET_DIR / "fixtures/file.A.pgl",
input_file_2="",
)
@Parametrization.case(
name="coverage",
script=PYTHON_FILE_DIR / "coverage.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.sorted.pgl",
)
@Parametrization.case(
name="expand",
script=PYTHON_FILE_DIR / "expand.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2="",
)
@Parametrization.case(
name="findLoops",
script=PYTHON_FILE_DIR / "findLoops.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2="",
)
@Parametrization.case(
name="intersect",
script=PYTHON_FILE_DIR / "intersect.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.sorted.pgl",
)
@Parametrization.case(
name="intersect1D",
script=PYTHON_FILE_DIR / "intersect1D.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.bed",
)
@Parametrization.case(
name="juicebox",
script=PYTHON_FILE_DIR / "juicebox.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2="",
)
@Parametrization.case(
name="merge",
script=PYTHON_FILE_DIR / "merge.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2="",
)
@Parametrization.case(
name="samTopgl",
script=PYTHON_FILE_DIR / "samTopgl.py",
input_file_1=ASSET_DIR / "fixtures/test_sam.sam",
input_file_2="",
)
@Parametrization.case(
name="subtract",
script=PYTHON_FILE_DIR / "subtract.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.sorted.pgl",
)
@Parametrization.case(
name="subtract1D",
script=PYTHON_FILE_DIR / "subtract1D.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2=ASSET_DIR / "fixtures/file.B.bed",
)
@Parametrization.case(
name="window",
script=PYTHON_FILE_DIR / "window.py",
input_file_1=ASSET_DIR / "fixtures/file.A.sorted.pgl",
input_file_2="",
)
def test_command_line(script, input_file_1, input_file_2):

if input_file_2 == "":
res = subprocess.run(["python", script, "-a", input_file_1])
else:
res = subprocess.run(["python", script, "-a", input_file_1, "-b", input_file_2])

res.check_returncode()

0 comments on commit e394386

Please sign in to comment.