Skip to content

Commit

Permalink
Set threads to 1 for chic test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimwolff committed Mar 9, 2020
1 parent a72f6d3 commit 30391a5
Show file tree
Hide file tree
Showing 9 changed files with 427 additions and 289 deletions.
68 changes: 40 additions & 28 deletions hicexplorer/test/general/test_chicAggregateStatistic.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from hicexplorer import chicAggregateStatistic
from tempfile import NamedTemporaryFile, mkdtemp
import os
import pytest
import warnings
warnings.simplefilter(action="ignore", category=RuntimeWarning)
warnings.simplefilter(action="ignore", category=PendingDeprecationWarning)
import pytest
import os
from tempfile import NamedTemporaryFile, mkdtemp

from hicexplorer import chicAggregateStatistic
ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "test_data/cHi-C/")
ROOT = os.path.join(os.path.dirname(os.path.dirname(
os.path.abspath(__file__))), "test_data/cHi-C/")


def are_files_equal(file1, file2, delta=2, skip=0):
Expand Down Expand Up @@ -35,17 +36,20 @@ def test_regular_mode():
output_folder = mkdtemp(prefix="output_")

args = "--interactionFile {} {} --targetFile {} --outFileNameSuffix {} \
--outputFolder {}".format(ROOT + 'chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt',
ROOT + 'chicViewpoint/output_1/MB-E10-5_chr1_chr1_14300280_14300280_Eya1.txt ',
ROOT + 'chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_target.txt',
'aggregated.txt',
output_folder).split()
--outputFolder {} -t {}".format(ROOT + 'chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt',
ROOT + 'chicViewpoint/output_1/MB-E10-5_chr1_chr1_14300280_14300280_Eya1.txt ',
ROOT + 'chicSignificantInteractions/output_5_target/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_target.txt',
'aggregated.txt',
output_folder, 1).split()
chicAggregateStatistic.main(args)

assert are_files_equal(ROOT + "chicAggregateStatistic/regular_mode/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt", output_folder + '/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/regular_mode/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt", output_folder + '/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/regular_mode/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt",
output_folder + '/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/regular_mode/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt",
output_folder + '/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')

assert set(os.listdir(ROOT + "chicAggregateStatistic/regular_mode/")) == set(os.listdir(output_folder))
assert set(os.listdir(ROOT + "chicAggregateStatistic/regular_mode/")
) == set(os.listdir(output_folder))


def test_batch_mode():
Expand All @@ -54,23 +58,31 @@ def test_batch_mode():

outfile.close()
args = "--interactionFile {} --targetFile {} --outFileNameSuffix {} \
--outputFolder {} -iff {} -tff {} -w {} -bm".format(ROOT + 'chicViewpoint/fileNames_two_matrices.txt',
ROOT + 'chicSignificantInteractions/output_5_target_list.txt',
'aggregated.txt',
output_folder,
ROOT + 'chicViewpoint/output_1',
ROOT + 'chicSignificantInteractions/output_5_target',
outfile.name).split()
--outputFolder {} -iff {} -tff {} -w {} -bm -t {}".format(ROOT + 'chicViewpoint/fileNames_two_matrices.txt',
ROOT + 'chicSignificantInteractions/output_5_target_list.txt',
'aggregated.txt',
output_folder,
ROOT + 'chicViewpoint/output_1',
ROOT + 'chicSignificantInteractions/output_5_target',
outfile.name, 1).split()
chicAggregateStatistic.main(args)
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode_file_names.txt", outfile.name)
assert are_files_equal(
ROOT + "chicAggregateStatistic/batch_mode_file_names.txt", outfile.name)

assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt", output_folder + '/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt", output_folder + '/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt",
output_folder + '/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt",
output_folder + '/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_aggregated.txt')

assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt", output_folder + '/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt", output_folder + '/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt",
output_folder + '/FL-E13-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt",
output_folder + '/MB-E10-5_chr1_chr1_4487435_4487435_Sox17_aggregated.txt')

assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt", output_folder + '/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt", output_folder + '/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt",
output_folder + '/FL-E13-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt')
assert are_files_equal(ROOT + "chicAggregateStatistic/batch_mode/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt",
output_folder + '/MB-E10-5_chr1_chr1_19093103_19093103_Tfap2d_aggregated.txt')

assert set(os.listdir(ROOT + "chicAggregateStatistic/batch_mode/")) == set(os.listdir(output_folder))
assert set(os.listdir(ROOT + "chicAggregateStatistic/batch_mode/")
) == set(os.listdir(output_folder))
Loading

0 comments on commit 30391a5

Please sign in to comment.