kipoi.metadata

Module defining different metadata classes compatible with dataloaders

All classes inherit from collections.abc.Mapping which allows to use kipoi.data_utils.numpy_collate on them (e.g. they behave as a dictionary).

GenomicRanges

GenomicRanges(self, chr, start, end, id, strand='*')

Container for genomic interval(s)

All fields can be either a single values (str or int) or a numpy array of values.

Arguments

  • chr (str or np.array): Chromosome(s)
  • start (int or np.array): Interval start (0-based coordinates)
  • end (int or np.array): Interval end (0-based coordinates)
  • id (str or np.array): Interval id
  • strand (str or np.array): Interval strand ("+", "-", or "*")

from_interval

GenomicRanges.from_interval(interval)

Create the ranges object from pybedtools.Interval

Arguments

  • interval: pybedtools.Interval instance

to_interval

GenomicRanges.to_interval(self)

Convert GenomicRanges object to a Interval object

Returns

(pybedtools.Interval or list[pybedtools.Interval])