Esempio n. 1
0
def test_two_viewpoints_per_file_batch_mode_significances_differential_pvalue(
):
    output_folder = mkdtemp(prefix="output_")

    args = "-if {} -iff {} --range {} {} --outputFolder {} -psn {} -bm  --differentialTestResult {} -diff {} -si {} -siff {} -p -xf {} -bmf {} -t {}".format(
        ROOT + 'chicViewpoint/fileNames_two_matrices.txt',
        ROOT + 'chicViewpoint/output_1', 200000, 200000, output_folder, 2,
        ROOT + 'chicDifferentialTest/rejectedFilesList.txt',
        ROOT + 'chicDifferentialTest/batch_mode_fisher_outfile/',
        ROOT + 'chicSignificantInteractions/output_5_significant_files.txt',
        ROOT + 'chicSignificantInteractions/output_5/', 1.5,
        ROOT + 'background.txt', 1).split()
    chicPlotViewpoint.main(args)

    res = compare_images(
        ROOT +
        'chicPlotViewpoint/batchMode/two/Eya1_FL-E13-5_MB-E10-5_chr1_chr1_14300280.png',
        output_folder + '/Eya1_FL-E13-5_MB-E10-5_chr1_chr1_14300280.png',
        tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/batchMode/two/Sox17_FL-E13-5_MB-E10-5_chr1_chr1_4487435.png',
        output_folder + '/Sox17_FL-E13-5_MB-E10-5_chr1_chr1_4487435.png',
        tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/batchMode/two/Tfap2d_FL-E13-5_MB-E10-5_chr1_chr1_19093103.png',
        output_folder + '/Tfap2d_FL-E13-5_MB-E10-5_chr1_chr1_19093103.png',
        tolerance)
    assert res is None, res
    assert set(os.listdir(ROOT + "chicPlotViewpoint/batchMode/two")) == set(
        os.listdir(output_folder))
Esempio n. 2
0
def test_one_viewpoint_per_file_batch_mode():
    output_folder = mkdtemp(prefix="output_")

    args = "-if {} -iff {} --range {} {} --outputFolder {} -psn {} -bm -t {}".format(
        ROOT + 'chicViewpoint/fileNames_one_matrix.txt',
        ROOT + 'chicViewpoint/output_4', 200000, 200000, output_folder, 1,
        1).split()
    chicPlotViewpoint.main(args)

    res = compare_images(
        ROOT +
        'chicPlotViewpoint/batchMode/one/Eya1_FL-E13-5_chr1_chr1_14300280.png',
        output_folder + '/Eya1_FL-E13-5_chr1_chr1_14300280.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/batchMode/one/Sox17_FL-E13-5_chr1_chr1_4487435.png',
        output_folder + '/Sox17_FL-E13-5_chr1_chr1_4487435.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/batchMode/one/Tfap2d_FL-E13-5_chr1_chr1_19093103.png',
        output_folder + '/Tfap2d_FL-E13-5_chr1_chr1_19093103.png', tolerance)
    assert res is None, res
    assert set(os.listdir(ROOT + "chicPlotViewpoint/batchMode/one")) == set(
        os.listdir(output_folder))
Esempio n. 3
0
def test_single_significant_pvalue():
    outfile = NamedTemporaryFile(suffix='.tar.gz', delete=False)
    outfile.close()
    args = "-if {} --range {} {} -o {} -t {} --combinationMode single --backgroundModelFile {} --significantInteractions {} --pValue --plotSignificantInteractions".format(
        ROOT + 'chicViewpoint/two_matrices.hdf5', 200000, 200000, outfile.name,
        1, ROOT + 'background.txt',
        ROOT + 'chicSignificantInteractions/significantInteractions_dual.hdf5'
    ).split()
    chicPlotViewpoint.main(args)

    file_obj = tarfile.open(outfile.name, "r")

    namelist = file_obj.getnames()
    assert len(namelist) == 6
    assert 'FL-E13-5_chr1_Eya1.png' in namelist
    assert 'MB-E10-5_chr1_Eya1.png' in namelist
    assert 'FL-E13-5_chr1_Sox17.png' in namelist
    assert 'MB-E10-5_chr1_Sox17.png' in namelist
    assert 'FL-E13-5_chr1_Tfap2d.png' in namelist
    assert 'MB-E10-5_chr1_Tfap2d.png' in namelist

    output_folder = mkdtemp(prefix="output_")

    file_obj.extractall(output_folder)
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/background_single_signficant_pvalues/FL-E13-5_chr1_Eya1.png',
        output_folder + '/FL-E13-5_chr1_Eya1.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/background_single_signficant_pvalues/MB-E10-5_chr1_Eya1.png',
        output_folder + '/MB-E10-5_chr1_Eya1.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/background_single_signficant_pvalues/FL-E13-5_chr1_Sox17.png',
        output_folder + '/FL-E13-5_chr1_Sox17.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/background_single_signficant_pvalues/MB-E10-5_chr1_Sox17.png',
        output_folder + '/MB-E10-5_chr1_Sox17.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/background_single_signficant_pvalues/FL-E13-5_chr1_Tfap2d.png',
        output_folder + '/FL-E13-5_chr1_Tfap2d.png', tolerance)
    assert res is None, res
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/background_single_signficant_pvalues/MB-E10-5_chr1_Tfap2d.png',
        output_folder + '/MB-E10-5_chr1_Tfap2d.png', tolerance)

    assert res is None, res
Esempio n. 4
0
def test_one_viewpoint_colormap_pvalue_truncate_zeros():
    outfile = NamedTemporaryFile(suffix='.png', delete=False)
    outfile.close()
    args = "-if {} --range {} {} --pValue --colorMapPvalue {} -o {} --pValue --colorMapPvalue plasma --maxPValue 0.5 --minPValue 0.1 -t {} --truncateZeroPvalues".format(
        ROOT +
        'chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.txt',
        200000, 200000, 'plasma', outfile.name, 1).split()
    chicPlotViewpoint.main(args)

    res = compare_images(ROOT + 'chicPlotViewpoint/two_viewpoint_pvalue.png',
                         outfile.name, tolerance)
    assert res is None, res
Esempio n. 5
0
def test_two_viewpoint_fileformat_dpi():
    outfile = NamedTemporaryFile(suffix='.pdf', delete=False)
    outfile.close()
    args = "-if {} {} --range {} {} -o {} --dpi {} --outputFormat {} -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',
        200000, 200000, outfile.name, 100, 'pdf', 1).split()
    chicPlotViewpoint.main(args)

    res = compare_images(ROOT + 'chicPlotViewpoint/two_viewpoint.pdf',
                         outfile.name, tolerance)
    assert res is None, res
Esempio n. 6
0
def test_one_viewpoint():
    outfile = NamedTemporaryFile(suffix='.png', delete=False)
    outfile.close()
    args = "-if {} --range {} {} -o {}".format(
        ROOT +
        'chicViewpoint/output_1/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.bed',
        200000, 200000, outfile.name).split()
    chicPlotViewpoint.main(args)

    res = compare_images(
        ROOT +
        'chicPlotViewpoint/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.png',
        outfile.name, tolerance)
    assert res is None, res
Esempio n. 7
0
def test_two_viewpoint_background_differential():
    outfile = NamedTemporaryFile(suffix='.png', delete=False)
    outfile.close()
    args = "-if {} {} --range {} {} -o {} -bmf {} --differentialTestResult {} -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',
        200000, 200000, outfile.name, ROOT + 'background.txt', ROOT +
        'chicDifferentialTest/batch_mode_fisher/FL-E13-5_MB-E10-5_chr1_chr1_14300280_14300280_Eya1_H0_rejected.txt',
        1).split()
    chicPlotViewpoint.main(args)

    res = compare_images(
        ROOT + 'chicPlotViewpoint/two_viewpoint_background_differential.png',
        outfile.name, tolerance)
    assert res is None, res
Esempio n. 8
0
def test_two_viewpoint_background_significant():
    outfile = NamedTemporaryFile(suffix='.png', delete=False)
    outfile.close()
    args = "-if {} {} --range {} {} -o {} -bmf {} --significantInteractions {} {} -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',
        200000, 200000, outfile.name, ROOT + 'background.txt', ROOT +
        'chicSignificantInteractions/output_3/FL-E13-5_chr1_chr1_14300280_14300280_Eya1_output_significant.txt',
        ROOT +
        'chicSignificantInteractions/output_3/MB-E10-5_chr1_chr1_14300280_14300280_Eya1_output_significant.txt',
        1).split()
    chicPlotViewpoint.main(args)

    res = compare_images(
        ROOT + 'chicPlotViewpoint/two_viewpoint_background_significant.png',
        outfile.name, tolerance)
    assert res is None, res
Esempio n. 9
0
def test_one_gene():
    outfile = NamedTemporaryFile(suffix='.tar.gz', delete=False)
    outfile.close()
    args = "-if {} --range {} {} -o {} -t {} --combinationMode oneGene --combinationName Eya1".format(
        ROOT + 'chicViewpoint/two_matrices.hdf5', 200000, 200000, outfile.name,
        1).split()
    chicPlotViewpoint.main(args)

    file_obj = tarfile.open(outfile.name, "r")

    namelist = file_obj.getnames()
    assert len(namelist) == 3
    assert 'FL-E13-5_chr1_Eya1.png' in namelist

    output_folder = mkdtemp(prefix="output_")

    file_obj.extractall(output_folder)
    res = compare_images(
        ROOT +
        'chicPlotViewpoint/FL-E13-5_chr1_chr1_14300280_14300280_Eya1.png',
        output_folder + '/FL-E13-5_chr1_Eya1.png', tolerance)
    assert res is None, res