-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test case and files for hicAverageContacts
- Loading branch information
1 parent
c0da96e
commit ed21a0c
Showing
6 changed files
with
52 additions
and
24 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
from tempfile import NamedTemporaryFile | ||
from hicexplorer import hicAverageRegions | ||
import numpy.testing as nt | ||
import numpy as np | ||
import pytest | ||
from scipy.sparse import load_npz | ||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "test_data/") | ||
|
||
def test_average_regions(): | ||
|
||
outfile = NamedTemporaryFile(suffix='.npz', prefix='average_region', delete=False) | ||
matrix = ROOT + 'small_test_matrix.cool' | ||
bed_file = ROOT + 'hicAverageRegions/regions.bed' | ||
args = "--matrix {} --regions {} -o {} --range 100000 100000".format(matrix, bed_file, outfile.name).split() | ||
log.debug('path: {}'.format(matrix)) | ||
|
||
hicAverageRegions.main(args) | ||
|
||
test_file = load_npz(ROOT + 'hicAverageRegions/result_range_100000.npz') | ||
new_file = load_npz(outfile.name) | ||
|
||
nt.assert_almost_equal(test_file.data, new_file.data, decimal=0) | ||
|
||
os.remove(outfile.name) | ||
|
||
def test_average_regions_range_in_bins(): | ||
|
||
outfile = NamedTemporaryFile(suffix='.npz', prefix='average_region', delete=False) | ||
matrix = ROOT + 'small_test_matrix.cool' | ||
bed_file = ROOT + 'hicAverageRegions/regions.bed' | ||
args = "--matrix {} --regions {} -o {} --rangeInBins 100 100".format(matrix, bed_file, outfile.name).split() | ||
hicAverageRegions.main(args) | ||
|
||
test_file = load_npz(ROOT + 'hicAverageRegions/result_rangeInBins_100.npz') | ||
new_file = load_npz(outfile.name) | ||
|
||
nt.assert_almost_equal(test_file.data, new_file.data, decimal=0) | ||
|
||
os.remove(outfile.name) |
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 @@ | ||
chr2L 2500000 | ||
chr2L 3500000 | ||
chr2L 4500000 | ||
chr2L 5500000 | ||
chr2L 7000000 | ||
chr2L 19000000 |
Binary file not shown.
Binary file added
BIN
+3.93 KB
hicexplorer/test/test_data/hicAverageRegions/result_rangeInBins_100.npz
Binary file not shown.
Binary file not shown.