How to use the kipoiseq.datasets.sequence.SeqStringDataset function in kipoiseq

To help you get started, we’ve selected a few kipoiseq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kipoi / kipoiseq / tests / datasets / dont_test_sequence.py View on Github external
def test_min_props():
    for Dl in [SeqStringDataset, SeqDataset]:
        props = dir(Dl)
        assert all([el in props for el in min_set_props])
github kipoi / kipoiseq / tests / datasets / dont_test_sequence.py View on Github external
def test_fasta_based_dataset():
    # just test the functionality
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta")
    ret_val = dl[0]
    assert isinstance(ret_val["inputs"], np.ndarray)
    assert ret_val["inputs"].shape == (1,)
    # test with set wrong seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", required_seq_len=3)
    with pytest.raises(Exception):
        dl[0]
    # test with short max_seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", max_seq_len=1)
    with pytest.raises(Exception):
        dl[0]
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="string")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.str_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="int")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.int_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="bool")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.bool_)
github kipoi / kipoiseq / tests / datasets / dont_test_sequence.py View on Github external
def test_fasta_based_dataset():
    # just test the functionality
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta")
    ret_val = dl[0]
    assert isinstance(ret_val["inputs"], np.ndarray)
    assert ret_val["inputs"].shape == (1,)
    # test with set wrong seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", required_seq_len=3)
    with pytest.raises(Exception):
        dl[0]
    # test with short max_seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", max_seq_len=1)
    with pytest.raises(Exception):
        dl[0]
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="string")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.str_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="int")
    ret_val = dl[0]
github kipoi / kipoiseq / tests / datasets / dont_test_sequence.py View on Github external
dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta")
    ret_val = dl[0]
    assert isinstance(ret_val["inputs"], np.ndarray)
    assert ret_val["inputs"].shape == (1,)
    # test with set wrong seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", required_seq_len=3)
    with pytest.raises(Exception):
        dl[0]
    # test with short max_seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", max_seq_len=1)
    with pytest.raises(Exception):
        dl[0]
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="string")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.str_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="int")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.int_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="bool")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.bool_)
github kipoi / kipoiseq / tests / datasets / dont_test_sequence.py View on Github external
def test_fasta_based_dataset():
    # just test the functionality
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta")
    ret_val = dl[0]
    assert isinstance(ret_val["inputs"], np.ndarray)
    assert ret_val["inputs"].shape == (1,)
    # test with set wrong seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", required_seq_len=3)
    with pytest.raises(Exception):
        dl[0]
    # test with short max_seqlen:
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", max_seq_len=1)
    with pytest.raises(Exception):
        dl[0]
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="string")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.str_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="int")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.int_)
    dl = SeqStringDataset(data_bpath + "sample_intervals.bed", data_bpath + "sample.fasta", label_dtype="bool")
    ret_val = dl[0]
    assert isinstance(ret_val['targets'][0], np.bool_)