def test_plot():

    outfile = NamedTemporaryFile(suffix='.png', prefix='plotFile', delete=False)
    matrix = ROOT + 'small_test_matrix_50kb_res.h5'
    args = "--matrices {} --plotFile {} --plotsize 6 4".format(matrix, outfile.name).split()
    hicPlotDistVsCounts.main(args)

    # local computer: test passes with delta of 3000
    # travis: needs to be at least 4500 to pass
    # I love this voodoo :(
    size_new = os.path.getsize(outfile.name)
    size_reference = os.path.getsize(ROOT + 'hicPlotDistVsCounts/dist_vs_counts.png',)
    assert abs(size_new - size_reference) < 5000

    os.remove(outfile.name)
def test_trivial_run(matrices, plotFile, labels, plotsize1, plotsize2, perchr, outFileData, skipDiagonal, maxdepth, chromosomeExclude):
    """
        Simple test for general behaviour with all commandline args.
    """

    args = "--matrices {} --plotFile {} --labels {} --plotsize {} {} {} --outFileData {} --maxdepth {} --chromosomeExclude {}".format(
        matrices,
        plotFile.name,
        labels,
        plotsize1,
        plotsize2,
        perchr,
        outFileData.name,
        maxdepth,
        chromosomeExclude,
    ).split()

    hicPlotDistVsCounts.main(args)
Exemple #3
0
def test_plot():

    outfile = NamedTemporaryFile(suffix='.png',
                                 prefix='plotFile',
                                 delete=False)
    matrix = ROOT + 'small_test_matrix_50kb_res.h5'
    args = "--matrices {} --plotFile {} --plotsize 6 4".format(
        matrix, outfile.name).split()
    hicPlotDistVsCounts.main(args)

    # don't using matplotlib compare images not anymore
    # because matplotlib is, depending on version, implementation or context,
    # slightly different images
    size_new = os.path.getsize(outfile.name)
    size_reference = os.path.getsize(
        ROOT + 'hicPlotDistVsCounts/dist_vs_counts.png', )
    assert abs(size_new - size_reference) < 3000

    os.remove(outfile.name)