def readdb(self,Db=None,chrom=''):
        # connect to the local database file
        dbconnect=sqlite3.connect(Db)
        cursor=dbconnect.cursor()
        tablename=self.get_name()
        
        # get the summary table
        if chrom:
            sqlcmd="""select """+', '.join(self.columns)+""" from """+tablename+""" where chrom='%s'""" %(chrom)
        else:  
            sqlcmd="""select """+', '.join(self.columns)+""" from """ +tablename
            
        # fetch the data 
        cursor.execute(sqlcmd)
        data=cursor.fetchall()
        
        if data:    # if data is NOT empty
            if not self.isempty(): 
                warnings.warn("Resetting the current table, %s") %(tablename)
                self.table={}
            chrom=''
            for l in data:
                newchrom=str(l[0])
                if newchrom!=chrom:
                    chrom=newchrom
                    self.init_table(chrom)
                elements=self.parse_db_line(l)
                self.add_row(chrom,elements)
Read an AnnotTable from a sqlite3 db file. If chrom is given, only the data of the chromosome are read.
dataset/ETHPy150Open taoliu/taolib/Assoc/tables.py/AnnotTable.readdb