Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions pydeeptools/deeptools/test/test_plotProfiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import deeptools.plotProfile as pp

import os.path
from os import unlink
from matplotlib.testing.compare import compare_images

ROOT = os.path.dirname(os.path.abspath(__file__)) + "/test_data/"
MATRIX_IN = ROOT + "computeMatrix_result1.gz"
PNG_OUT1 = ROOT + "profiler_result1.png"
PNG_OUT2 = ROOT + "profiler_result2.png"


def test_profiler_plot_with_minimal_args():
"""
Test minimal command line args for profiler plot
"""
outfile1 = '/tmp/profiler1.png'
args = "-m {} -o {}".format(MATRIX_IN, outfile1).split()
pp.main(args)

res = compare_images(PNG_OUT1, outfile1, 50)
assert res is None, res
unlink(outfile1)


def test_profiler_plot_with_advance_args():
"""
Test advance command line args for profiler plot
"""
outfile2 = '/tmp/profiler2.png'
profile_out = '/tmp/profiler_res.tsv'
args = "-m {} -o {} --outFileNameData {}".format(MATRIX_IN, outfile2, profile_out).split()
pp.main(args)

res = compare_images(PNG_OUT2, outfile2, 50)
assert res is None, res
unlink(outfile2)

_foo = open(profile_out, "r")
resp = _foo.readlines()[2]
_foo.close()
expected = 'bamCoverage_result4_bw_0\tgenes\t2477942.875\t2610260.125\n'
assert expected in resp, f"'{expected}' not found in '{resp}'"
unlink(profile_out)
Loading