示例#1
0
def test_cload_custom_tempdir(bins_path, pairs_path):
    for temp_dir in [op.join(testdir, 'data'), '-']:
        cload_pairs.callback(
            bins_path,
            pairs_path,
            testcool_path,
            metadata=None,
            assembly='toy',
            chunksize=10,
            zero_based=False,
            comment_char='#',
            input_copy_status='unique',
            no_symmetric_upper=False,
            field=(),
            temp_dir=temp_dir,
            no_delete_temp=False,
            storage_options=None,
            no_count=True,
            max_merge=200,
            chrom1=1,
            pos1=2,
            chrom2=3,
            pos2=4,
        )
        pixels = cooler.Cooler(testcool_path).pixels()[:]
        assert 'count' in pixels.columns and types.is_integer_dtype(
            pixels.dtypes['count'])
示例#2
0
def test_cload_field(bins_path, pairs_path):
    kwargs = dict(
        metadata=None,
        assembly='toy',
        chunksize=10,
        zero_based=False,
        comment_char='#',
        input_copy_status='unique',
        no_symmetric_upper=False,
        temp_dir=None,
        no_delete_temp=False,
        storage_options=None,
        no_count=True,
        max_merge=200,
        chrom1=1,
        pos1=2,
        chrom2=3,
        pos2=4,
    )
    cload_pairs.callback(bins_path,
                         pairs_path,
                         testcool_path,
                         field=('score=7:dtype=float', ),
                         **kwargs)
    pixels = cooler.Cooler(testcool_path).pixels()[:]
    assert 'count' in pixels.columns and types.is_integer_dtype(
        pixels.dtypes['count'])
    assert 'score' in pixels.columns and types.is_float_dtype(
        pixels.dtypes['score'])
示例#3
0
def test_cload_custom_tempdir(bins_path, pairs_path):
    for temp_dir in [op.join(testdir, "data"), "-"]:
        cload_pairs.callback(
            bins_path,
            pairs_path,
            testcool_path,
            metadata=None,
            assembly="toy",
            chunksize=10,
            zero_based=False,
            comment_char="#",
            input_copy_status="unique",
            no_symmetric_upper=False,
            field=(),
            temp_dir=temp_dir,
            no_delete_temp=False,
            storage_options=None,
            no_count=True,
            max_merge=200,
            chrom1=2,
            pos1=3,
            chrom2=4,
            pos2=5,
        )
        pixels = cooler.Cooler(testcool_path).pixels()[:]
        assert "count" in pixels.columns and types.is_integer_dtype(
            pixels.dtypes["count"])
示例#4
0
def test_cload_pairs(bins_path, pairs_path, ref_path):
    kwargs = dict(
        metadata=None,
        assembly='hg19',
        chunksize=int(15e6),
        zero_based=False,
        comment_char='#',
        input_copy_status='unique',
        no_symmetric_upper=False,
        field=(),
        temp_dir=None,
        no_delete_temp=False,
        storage_options=None,
        no_count=False,
        max_merge=200,
        chrom1=1,
        pos1=2,
        chrom2=3,
        pos2=4,
    )
    cload_pairs.callback(bins_path, pairs_path, testcool_path, **kwargs)
    with h5py.File(testcool_path, 'r') as f1, \
         h5py.File(ref_path, 'r') as f2:
        assert np.all(f1['pixels/bin1_id'][:] == f2['pixels/bin1_id'][:])
        assert np.all(f1['pixels/bin2_id'][:] == f2['pixels/bin2_id'][:])
        assert np.all(f1['pixels/count'][:] == f2['pixels/count'][:])
    try:
        os.remove(testcool_path)
    except OSError:
        pass
示例#5
0
def test_cload_field(bins_path, pairs_path):
    kwargs = dict(
        metadata=None,
        assembly="toy",
        chunksize=10,
        zero_based=False,
        comment_char="#",
        input_copy_status="unique",
        no_symmetric_upper=False,
        temp_dir=None,
        no_delete_temp=False,
        storage_options=None,
        no_count=True,
        max_merge=200,
        chrom1=2,
        pos1=3,
        chrom2=4,
        pos2=5,
    )
    cload_pairs.callback(bins_path,
                         pairs_path,
                         testcool_path,
                         field=("score=8:dtype=float", ),
                         **kwargs)
    pixels = cooler.Cooler(testcool_path).pixels()[:]
    assert "count" in pixels.columns and types.is_integer_dtype(
        pixels.dtypes["count"])
    assert "score" in pixels.columns and types.is_float_dtype(
        pixels.dtypes["score"])