-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pytest for ComputeMatrix along with associated test files
- Loading branch information
1 parent
c8b8802
commit 48c1cf5
Showing
8 changed files
with
75 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import deeptools.computeMatrix as cm | ||
|
||
import os.path | ||
from os import unlink | ||
|
||
ROOT = os.path.dirname(os.path.abspath(__file__)) + "/test_data/" | ||
REGIONS_IN1 = ROOT + "computeMatrix1.bed" | ||
REGIONS_IN2 = ROOT + "computeMatrix2.bed" | ||
BIGWIG_IN1 = ROOT + "bamCoverage_result4.bw" | ||
BIGWIG_IN2 = ROOT + "computeMatrix2.bw" | ||
OUT_ARCHIEVE1 = ROOT + "computeMatrix_result1.gz" | ||
OUT_ARCHIEVE2 = ROOT + "computeMatrix_result2.gz" | ||
OUT_ARCHIEVE3 = ROOT + "computeMatrix_result3.gz" | ||
|
||
def test_compute_matrix_with_reference_point_and_advance_options_1(): | ||
""" | ||
Test minimal command line args compute matrix with reference based | ||
mode along with advance options of sorting using sum and average | ||
type bin as sum | ||
""" | ||
outfile = '/tmp/computematrix_1.gz' | ||
args = "reference-point --regionsFileName {} --scoreFileName {} -o {} -bs 10 --sortUsing sum --averageTypeBins sum -b 10 -a 10".format(REGIONS_IN1, BIGWIG_IN1, outfile).split() | ||
cm.main(args) | ||
|
||
archieve_file_size = os.path.getsize(OUT_ARCHIEVE1) | ||
expected_file_size = os.path.getsize(outfile) | ||
size_tolerance = 500 | ||
size_difference = abs(archieve_file_size - expected_file_size) | ||
assert size_difference <= size_tolerance, "File size do not match" | ||
unlink(outfile) | ||
|
||
def test_compute_matrix_with_reference_point_and_advance_options_2(): | ||
""" | ||
Test minimal command line args compute matrix with reference based mode | ||
with before and after region start length | ||
""" | ||
outfile = '/tmp/computematrix_2.gz' | ||
args = "reference-point --regionsFileName {} --scoreFileName {} -o {} -bs 10 -b 10 -a 10".format(REGIONS_IN2, BIGWIG_IN2, outfile).split() | ||
cm.main(args) | ||
|
||
archieve_file_size = os.path.getsize(OUT_ARCHIEVE2) | ||
expected_file_size = os.path.getsize(outfile) | ||
size_tolerance = 500 | ||
size_difference = abs(archieve_file_size - expected_file_size) | ||
assert size_difference <= size_tolerance, "File size do not match" | ||
unlink(outfile) | ||
|
||
def test_compute_matrix_with_scale_regions(): | ||
""" | ||
Test minimal command line args compute matrix with scale regions mode | ||
""" | ||
outfile = '/tmp/computematrix_3.gz' | ||
args = "scale-regions --regionsFileName {} --scoreFileName {} -o {}".format(REGIONS_IN2, BIGWIG_IN2, outfile).split() | ||
cm.main(args) | ||
|
||
archieve_file_size = os.path.getsize(OUT_ARCHIEVE3) | ||
expected_file_size = os.path.getsize(outfile) | ||
size_tolerance = 500 | ||
size_difference = abs(archieve_file_size - expected_file_size) | ||
assert size_difference <= size_tolerance, "File size do not match" | ||
unlink(outfile) |
Binary file not shown.
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,8 @@ | ||
phiX174 1000 1500 CG11023 0 + | ||
phiX174 150 1750 cda5 0 - | ||
phiX174 150 177 cda8 0 - | ||
phiX174 75 1500 cda9 0 + | ||
phiX174 101 175 C11023 0 + | ||
phiX174 125 150 ca5 0 - | ||
phiX174 450 1750 ca8 0 + | ||
phiX174 80 1500 cda9 0 + |
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,6 @@ | ||
ch1 100 150 CG11023 0 + | ||
ch2 150 175 cda5 0 - | ||
ch3 100 125 cda8 0 + | ||
ch1 75 125 C11023 0 + | ||
ch2 125 150 ca5 0 - | ||
ch3 75 100 ca8 0 + |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.