How to use the kipoiseq.utils.parse_dtype 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 / test_3_utils.py View on Github external
def test_parse_type():
    with pytest.raises(Exception):
        parse_dtype('string')
    with pytest.raises(Exception):
        parse_dtype('np.float322')

    assert parse_dtype('float') == float
    assert parse_dtype(float) == float
    assert parse_dtype("np.float32") == np.float32
github kipoi / kipoiseq / tests / test_3_utils.py View on Github external
def test_parse_type():
    with pytest.raises(Exception):
        parse_dtype('string')
    with pytest.raises(Exception):
        parse_dtype('np.float322')

    assert parse_dtype('float') == float
    assert parse_dtype(float) == float
    assert parse_dtype("np.float32") == np.float32
github kipoi / kipoiseq / tests / test_3_utils.py View on Github external
def test_parse_type():
    with pytest.raises(Exception):
        parse_dtype('string')
    with pytest.raises(Exception):
        parse_dtype('np.float322')

    assert parse_dtype('float') == float
    assert parse_dtype(float) == float
    assert parse_dtype("np.float32") == np.float32
github kipoi / kipoiseq / tests / test_3_utils.py View on Github external
def test_parse_type():
    with pytest.raises(Exception):
        parse_dtype('string')
    with pytest.raises(Exception):
        parse_dtype('np.float322')

    assert parse_dtype('float') == float
    assert parse_dtype(float) == float
    assert parse_dtype("np.float32") == np.float32
github kipoi / kipoiseq / tests / test_3_utils.py View on Github external
def test_parse_type():
    with pytest.raises(Exception):
        parse_dtype('string')
    with pytest.raises(Exception):
        parse_dtype('np.float322')

    assert parse_dtype('float') == float
    assert parse_dtype(float) == float
    assert parse_dtype("np.float32") == np.float32
github kipoi / kipoiseq / kipoiseq / dataloaders / sequence.py View on Github external
self.fasta_file = fasta_file
        self.auto_resize_len = auto_resize_len
        # self.use_strand = use_strand
        self.force_upper = force_upper
        # self.max_seq_len = max_seq_len

        # if use_strand:
        #     # require a 6-column bed-file if strand is used
        #     bed_columns = 6
        # else:
        #     bed_columns = 3

        self.bed = BedDataset(self.intervals_file,
                              num_chr=self.num_chr_fasta,
                              bed_columns=3,
                              label_dtype=parse_dtype(label_dtype),
                              ignore_targets=ignore_targets)
        self.fasta_extractors = None
github kipoi / kipoiseq / kipoiseq / transforms / transforms.py View on Github external
dtype=None,
                 alphabet_axis=1,
                 dummy_axis=None):
        # make sure the alphabet axis and the dummy axis are valid:
        if dummy_axis is not None:
            if alphabet_axis == dummy_axis:
                raise ValueError("dummy_axis can't be the same as dummy_axis")
            if not (dummy_axis >= 0 and dummy_axis <= 2):
                raise ValueError("dummy_axis can be either 0,1 or 2")
        assert alphabet_axis >= 0 and (alphabet_axis < 2 or (
                alphabet_axis <= 2 and dummy_axis is not None))

        self.alphabet_axis = alphabet_axis
        self.dummy_axis = dummy_axis
        self.alphabet = parse_alphabet(alphabet)
        self.dtype = parse_dtype(dtype)
        self.neutral_alphabet = neutral_alphabet
        self.neutral_value = neutral_value

        # set the transform parameters correctly
        if dummy_axis is not None and dummy_axis < 2:
            # dummy axis is added somewhere in the middle, so the alphabet axis is at the end now
            existing_alphabet_axis = 2
        else:
            # alphabet axis stayed the same
            existing_alphabet_axis = 1

        # check if no swapping needed
        if existing_alphabet_axis == self.alphabet_axis:
            self.alphabet_axis = None

        # how to transform the input