def __init__(self, db, include_gt_cols=False, out_format=DefaultRowFormat(None)): assert os.path.exists(db), "%s does not exist." % db self.db = db self.query_executed = False self.for_browser = False self.include_gt_cols = include_gt_cols # try to connect to the provided database self._connect_to_database() # extract the column names from the sample table. # needed for gt-filter wildcard support. self._collect_sample_table_columns() # list of samples ids for each clause in the --gt-filter self.sample_info = collections.defaultdict(list) # map sample names to indices. e.g. self.sample_to_idx[NA20814] -> 323 self.sample_to_idx = util.map_samples_to_indices(self.c) # and vice versa. e.g., self.idx_to_sample[323] -> NA20814 self.idx_to_sample = util.map_indices_to_samples(self.c) self.idx_to_sample_object = util.map_indices_to_sample_objects(self.c) self.formatter = out_format self.predicates = [self.formatter.predicate]
def __init__(self, db, include_gt_cols=False, out_format=DefaultRowFormat(None)): assert os.path.exists(db), "%s does not exist." % db self.db = db self.query_executed = False self.for_browser = False self.include_gt_cols = include_gt_cols self._connect_to_database() # map sample names to indices. e.g. self.sample_to_idx[NA20814] -> 323 self.sample_to_idx = util.map_samples_to_indices(self.c) # and vice versa. e.g., self.idx_to_sample[323] -> NA20814 self.idx_to_sample = util.map_indices_to_samples(self.c) self.idx_to_sample_object = util.map_indices_to_sample_objects(self.c) self.formatter = out_format self.predicates = [self.formatter.predicate]