Beispiel #1
0
    def drop(self, drop=None, like=None):
        """Drop column(s) from the PyRanges object.

        If no arguments are given, all the columns except Chromosome, Start, End and Strand are
        dropped. To drop Strand, the drop_strand argument needs to be given.
        """

        from pyranges.methods.drop import _drop
        return _drop(self, drop, like)
Beispiel #2
0
    def drop(self, drop=None, keep=None, drop_strand=False):
        """Drop column(s) from the PyRanges object.

        If no arguments are given, all the columns except Chromosome, Start, End and Strand are
        dropped. To drop Strand, the drop_strand argument needs to be given.

        Args:
            drop (None, iterable or str): An iterable of columns to drop or a string containing a
            substring/regex of the columns to drop.
            keep (None, iterable or str): An iterable of columns to drop or a string containing a
            substring/regex of the columns not to drop.
            drop_strand (bool): Whether or not to drop the Strand column
        """
        from pyranges.methods.drop import _drop
        return _drop(self, drop, drop_strand)
Beispiel #3
0
def _getitem(self, val):

    if isinstance(val, list):
        dfs = _drop(self, keep=val).dfs
    elif isinstance(val, str):
        dfs = get_string(self, val)
    elif isinstance(val, tuple):
        dfs = get_tuple(self, val)
    elif isinstance(val, slice):
        dfs = get_slice(self, val)
    elif isinstance(val, dict):
        dfs = get_booldict(self, val)
    else:
        raise Exception("Not valid subsetter: {}".format(str(val)))

    if not dfs is None:
        return PyRanges(dfs)
    else:
        return PyRanges({})