Esempio n. 1
0
def test_clodius_aggregate_bedpe():
    input_file = op.join(testdir, "sample_data", "isidro.bedpe")

    with tempfile.TemporaryDirectory() as tmpdirname:
        output_file = op.join(tmpdirname, "isidro.bed2ddb")

        cca._bedpe(
            input_file,
            output_file,
            "b37",
            importance_column=None,
            chromosome=None,
            max_per_tile=100,
            tile_size=1024,
            has_header=True,
        )
        """
        runner = clt.CliRunner()
        result = runner.invoke(
                cca.bedpe,
                [input_file,
                '--output-file', output_file,
                '--importance-column', 'random',
                '--has-header',
                '--assembly', 'b37'])

        # print('output:', result.output, result)
        assert(result.exit_code == 0)
        """

        cdt.get_2d_tiles(output_file, 0, 0, 0)
        # print("entries:", entries)

        cdt.get_tileset_info(output_file)
        # TODO: Make assertions about result
        # print('tileset_info', tileset_info)

        cdt.get_2d_tiles(output_file, 1, 0, 0, numx=2, numy=2)
        # TODO: Make assertions about result
        # print("entries:", entries)

        cdt.get_tileset_info(output_file)
Esempio n. 2
0
def test_clodius_aggregate_bedpe():
    input_file = op.join(testdir, 'sample_data', 'isidro.bedpe')
    output_file = '/tmp/isidro.bed2ddb'

    cca._bedpe(input_file,
               output_file,
               'b37',
               importance_column=None,
               chromosome=None,
               max_per_tile=100,
               tile_size=1024,
               has_header=True)
    """
    runner = clt.CliRunner()
    result = runner.invoke(
            cca.bedpe,
            [input_file,
            '--output-file', output_file,
            '--importance-column', 'random',
            '--has-header', 
            '--assembly', 'b37'])

    #print('output:', result.output, result)
    assert(result.exit_code == 0)
    """

    entries = cdt.get_2d_tiles(output_file, 0, 0, 0)
    #print("entries:", entries)

    tileset_info = cdt.get_tileset_info(output_file)
    #print('tileset_info', tileset_info)

    entries = cdt.get_2d_tiles(output_file, 1, 0, 0, numx=2, numy=2)
    #print("entries:", entries)

    tileset_info = cdt.get_tileset_info(output_file)
Esempio n. 3
0
def test_clodius_aggregate_bedpe():
    input_file = op.join(testdir, 'sample_data',
                         'Rao_RepA_GM12878_Arrowhead.txt')
    output_file = '/tmp/bedpe.db'

    runner = clt.CliRunner()
    result = runner.invoke(cca.bedpe, [
        input_file, '--output-file', output_file, '--assembly', 'hg19',
        '--chr1-col', '1', '--from1-col', '2', '--to1-col', '3', '--chr2-col',
        '1', '--from2-col', '2', '--to2-col', '3'
    ])
    print("result:", result)
    print("result.output", result.output)

    assert (result.exit_code == 0)

    tiles = cdt.get_2d_tiles(output_file, 0, 0, 0, numx=1, numy=1)
    print("tiles:", tiles)

    assert ('\n' not in tiles[(0, 0)][0]['fields'][2])
Esempio n. 4
0
def test_clodius_aggregate_bedpe():
    input_file = op.join(testdir, "sample_data",
                         "Rao_RepA_GM12878_Arrowhead.txt")
    output_file = "/tmp/bedpe.db"

    runner = clt.CliRunner()
    result = runner.invoke(
        cca.bedpe,
        [
            input_file,
            "--output-file",
            output_file,
            "--assembly",
            "hg19",
            "--chr1-col",
            "1",
            "--from1-col",
            "2",
            "--to1-col",
            "3",
            "--chr2-col",
            "1",
            "--from2-col",
            "2",
            "--to2-col",
            "3",
        ],
    )
    """
    print("result:", result)
    print("result.output", result.output)
    """

    assert result.exit_code == 0

    tiles = cdt.get_2d_tiles(output_file, 0, 0, 0, numx=1, numy=1)

    assert "\n" not in tiles[(0, 0)][0]["fields"][2]
Esempio n. 5
0
def test_clodius_aggregate_bedpe():
    input_file = op.join(testdir, "sample_data",
                         "Rao_RepA_GM12878_Arrowhead.txt")
    output_file = "/tmp/bedpe.db"

    # make sure that aggregating without an assembly throws
    # doesn't succeed
    runner = clt.CliRunner()
    result = runner.invoke(
        cca.bedpe,
        [
            input_file,
            "--output-file",
            output_file,
            "--chr1-col",
            "1",
            "--from1-col",
            "2",
            "--to1-col",
            "3",
            "--chr2-col",
            "1",
            "--from2-col",
            "2",
            "--to2-col",
            "3",
        ],
    )

    assert result.exit_code == 1

    runner = clt.CliRunner()
    result = runner.invoke(
        cca.bedpe,
        [
            input_file,
            "--output-file",
            output_file,
            "--assembly",
            "hg19",
            "--chr1-col",
            "1",
            "--from1-col",
            "2",
            "--to1-col",
            "3",
            "--chr2-col",
            "1",
            "--from2-col",
            "2",
            "--to2-col",
            "3",
        ],
    )
    """
    print("result:", result)
    print("result.output", result.output)
    """

    assert result.exit_code == 0

    tiles = cdt.get_2d_tiles(output_file, 0, 0, 0, numx=1, numy=1)

    assert "\n" not in tiles[(0, 0)][0]["fields"][2]

    tiles_2d = bed2ddb.tiles(output_file, ["x.0.0.0"])

    assert len(tiles_2d[0][1][0]["fields"]) == 3

    tiles_1d = bed2ddb.tiles(output_file, ["x.0.0"])

    assert len(tiles_1d[0][1][0]["fields"]) == 3
Esempio n. 6
0
def test_get_tiles():
    filename = "test/sample_data/arrowhead_domains_short.txt.multires.db"

    cdt.get_2d_tiles(filename, 0, 0, 0, numx=1, numy=1)
def test_get_tiles():
    filename = 'test/sample_data/arrowhead_domains_short.txt.multires.db'

    tiles = cdt.get_2d_tiles(filename, 0,0,0, numx=1, numy=1)

    print("tiles:", tiles)