def __init__(self, db_path, version, run=run, progress=progress, quiet = False): if not os.path.exists(db_path): raise ConfigError, "Database ('%s') does not exist. You must create one first." % db_path self.quiet = quiet self.db_type = None self.db_path = db_path self.version = version self.next_available_id = {} self.splits_info = None self.contigs_info = None self.split_length = None self.genes_are_called = None self.run = run self.progress = progress database = db.DB(self.db_path, version) self.db_type = database.get_meta_value('db_type') if self.db_type == 'contigs': # FIXME: a better design is required. the salient point is, "Table" must serve for both profile db # and contigs db calls. self.split_length = database.get_meta_value('split_length') self.genes_are_called = database.get_meta_value('genes_are_called') self.contigs_info = database.get_table_as_dict(t.contigs_info_table_name, string_the_key = True) self.splits_info = database.get_table_as_dict(t.splits_info_table_name) self.contig_name_to_splits = utils.get_contig_name_to_splits_dict(self.splits_info, self.contigs_info) self.gene_calls_dict = None database.disconnect()
def __init__(self, db_path, version, run=run, progress=progress, quiet = False): if not os.path.exists(db_path): raise ConfigError, "Database ('%s') does not exist. You must create one first." % db_path self.quiet = quiet self.db_type = None self.db_path = db_path self.version = version self.next_available_id = {} self.splits_info = None self.contigs_info = None self.split_length = None self.run = run self.progress = progress database = db.DB(self.db_path, version) self.db_type = database.get_meta_value('db_type') if self.db_type == 'contigs': # FIXME: a better design is required. the salient point is, "Table" must serve for both profile db # and contigs db calls. self.split_length = database.get_meta_value('split_length') self.contigs_info = database.get_table_as_dict(t.contigs_info_table_name, string_the_key = True) self.splits_info = database.get_table_as_dict(t.splits_info_table_name) self.contig_name_to_splits = utils.get_contig_name_to_splits_dict(self.splits_info, self.contigs_info) database.disconnect()
def __init__(self, db_path, version, run=run, progress=progress, quiet=False, simple=False): if not db_path: raise ConfigError( "Table superclass is being initiated without a db path, and it is very\ very concerning :( Anvi'o needs an adult.") if not os.path.exists(db_path): raise ConfigError( "Database ('%s') does not exist. You must create one first." % db_path) self.quiet = quiet self.db_type = None self.db_path = db_path self.version = version self.next_available_id = {} self.splits_info = None self.contigs_info = None self.split_length = None self.genes_are_called = None self.run = run self.progress = progress database = db.DB(self.db_path, version) self.db_type = database.get_meta_value('db_type') if not simple and self.db_type == 'contigs': # FIXME: a better design is required. the salient point is, "Table" must serve for both profile db # and contigs db calls. self.split_length = database.get_meta_value('split_length') self.genes_are_called = database.get_meta_value('genes_are_called') self.contigs_info = database.get_table_as_dict( t.contigs_info_table_name, string_the_key=True) self.splits_info = database.get_table_as_dict( t.splits_info_table_name) self.contig_name_to_splits = utils.get_contig_name_to_splits_dict( self.splits_info, self.contigs_info) self.gene_calls_dict = None database.disconnect()