-
Notifications
You must be signed in to change notification settings - Fork 217
Add pytests for fingerprint plot #1372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SaimMomin12
wants to merge
2
commits into
deeptools:4.0.0
Choose a base branch
from
SaimMomin12:pytest_fingerprint
base: 4.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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.
This file contains hidden or 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,56 @@ | ||
import deeptools.plotFingerprint as pf | ||
|
||
import os.path | ||
from os import unlink | ||
|
||
|
||
ROOT = os.path.dirname(os.path.abspath(__file__)) + "/test_data/" | ||
BAM_IN1 = ROOT + "bowtie2_test1.bam" | ||
FIN_PLOT1 = ROOT + "plotFingerprint_result1.png" | ||
FIN_PLOT2 = ROOT + "plotFingerprint_result2.png" | ||
|
||
|
||
def test_fingerprint_plot_with_minimal_options(): | ||
""" | ||
Test minimal command line args for fingerprint plot | ||
""" | ||
out_png = '/tmp/fingerprint_plot1.png' | ||
args = "-b {} {} -o {}".format(BAM_IN1, BAM_IN1, out_png).split() | ||
pf.main(args) | ||
|
||
png_file_size = os.path.getsize(FIN_PLOT1) | ||
expected_file_size = os.path.getsize(out_png) | ||
size_tolerance = 15000 | ||
size_difference = abs(png_file_size - expected_file_size) | ||
assert size_difference <= size_tolerance, "File size do not match" | ||
unlink(out_png) | ||
|
||
|
||
def test_fingerprint_plot_with_advance_options(): | ||
""" | ||
Test command line args for fingerprint plot with additional options | ||
""" | ||
out_rawcounts = '/tmp/rawcounts.tsv' | ||
out_qualitymetric = '/tmp/qualitymetrics.tsv' | ||
out_png2 = '/tmp/fingerprint_plot2.png' | ||
args = "-b {} {} -o {} --outRawCounts {} --outQualityMetrics {} -T Test_Fingerpring_Plot --JSDsample {}".format(BAM_IN1, BAM_IN1, out_png2, out_rawcounts, out_qualitymetric, BAM_IN1).split() | ||
SaimMomin12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pf.main(args) | ||
|
||
with open(out_rawcounts, "r") as _foo: | ||
result = len(_foo.readlines()) | ||
_expected = 16072 | ||
assert result == _expected, "No of lines in rawcounts files differ" | ||
SaimMomin12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
with open(out_qualitymetric, "r") as _foo: | ||
result2 = len(_foo.readlines()) | ||
_expected = 3 | ||
assert result2 == _expected, "No of lines in quality metrics files differ" | ||
|
||
png_file_size = os.path.getsize(FIN_PLOT2) | ||
expected_file_size = os.path.getsize(out_png2) | ||
size_tolerance = 15000 | ||
size_difference = abs(png_file_size - expected_file_size) | ||
assert size_difference <= size_tolerance, "File sizes do not match" | ||
SaimMomin12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
unlink(out_png2) | ||
unlink(out_rawcounts) | ||
unlink(out_rawcounts) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.