def __init__(self, source, named_columns=False, column_names=None, **kwargs): """ :param named_columns: optionally return dictionaries keying each column with 'chrom', 'start', 'end', 'strand', or 'name'. Optional: defaults to False :type named_columns: bool :param column_names: an ordered list of strings that will be used as the keys for each column in the returned dictionaries. The number of key, value pairs each returned dictionary has will be as short as the number of column names provided. :type column_names: """ # TODO: validate is a wig # still good to maintain a ref to the raw source bc Reader won't self.raw_source = source self.parser = bx_wig.Reader(source) super(WiggleDataProvider, self).__init__(self.parser, **kwargs) self.named_columns = named_columns self.column_names = column_names or self.COLUMN_NAMES
def test_reader(self): #Test position reader assert position_reader_result == [ ",".join(map(str, value)) for value in wiggle.Reader(StringIO(test_wig)) ]