puretabix/tabix.py
def fetch_lines(self, name, start, end=None):
        """
        Returns lines in the region of interest
        """
        # default if only start specified
        if not end:
            end = start

        region = self.fetch_bytes(name, start, end)
        # no region, no lines
        if not region:
            return ""

        # turn the bytes into a list of strings
        lines = region.decode("utf-8").splitlines()

        # filter out comments
        lines = (line for line in lines if not line.startswith(self.index.meta))

        # filter lines of wrong lengths i.e. cut off around chunk boundries
        lines = (
            line
            for line in lines
            if len(line.split("\t"))
            >= max(
                self.index.column_sequence,
                self.index.column_begin,
                self.index.column_end,
            )
        )
        # filter lines before start
        column_begin = self.index.column_begin
        # default to using begin column again
        column_end = (
            self.index.column_end if self.index.column_end else self.index.column_begin
        )
        lines = (
            line for line in lines if int(line.split("\t")[column_begin - 1]) >= start
        )
        lines = (line for line in lines if int(line.split("\t")[column_end - 1]) <= end)

        return lines

        Returns lines in the region of interest
        
Returns lines in the region of interest
Returns lines in the region of interest
def fetch_lines(self, name, start, end=None):
        if not end:
            end = start
        region = self.fetch_bytes(name, start, end)
        if not region:
            return ""
        lines = region.decode("utf-8").splitlines()
        lines = (line for line in lines if not line.startswith(self.index.meta))
        lines = (
            line
            for line in lines
            if len(line.split("\t"))
            >= max(
                self.index.column_sequence,
                self.index.column_begin,
                self.index.column_end,
            )
        )
        column_begin = self.index.column_begin
        column_end = (
            self.index.column_end if self.index.column_end else self.index.column_begin
        )
        lines = (
            line for line in lines if int(line.split("\t")[column_begin - 1]) >= start
        )
        lines = (line for line in lines if int(line.split("\t")[column_end - 1]) <= end)
        return lines
def fetch_lines ( self , name , start , end = None ) : if not end : end = start region = self . fetch_bytes ( name , start , end ) if not region : return "" lines = region . decode ( "utf-8" ) . splitlines ( ) lines = ( line for line in lines if not line . startswith ( self . index . meta ) ) lines = ( line for line in lines if len ( line . split ( "\t" ) ) >= max ( self . index . column_sequence , self . index . column_begin , self . index . column_end , ) ) column_begin = self . index . column_begin column_end = ( self . index . column_end if self . index . column_end else self . index . column_begin ) lines = ( line for line in lines if int ( line . split ( "\t" ) [ column_begin - 1 ] ) >= start ) lines = ( line for line in lines if int ( line . split ( "\t" ) [ column_end - 1 ] ) <= end ) return lines
Returns lines in the region of interest
Returns lines in the region of interest
"""
        Returns lines in the region of interest
        """ # default if only start specified # no region, no lines # turn the bytes into a list of strings # filter out comments # filter lines of wrong lengths i.e. cut off around chunk boundries # filter lines before start # default to using begin column again
self
name
start
end