Пример #1
0
 def simpleUpdateWrapper(self, valueDict, db, genome, column):
     """
     If your classifier is going to do a simple 1-1 update with a valueDict, use this.
     """
     with sql_lib.ExclusiveSqlConnection(db) as cur:
         sql_lib.updateRows(cur, genome, self.primaryKeyColumn, column,
                            self.invertDict(valueDict))
Пример #2
0
 def simpleBedUpdateWrapper(self, valueDict, db, genome, column):
     """
     If your details-mode classifier has BED records for values in its valueDict, use this.
     """
     with sql_lib.ExclusiveSqlConnection(db) as cur:
         sql_lib.updateRows(cur, genome, self.primaryKeyColumn, column,
                            self.detailsEntryIter(valueDict.iteritems()))
Пример #3
0
 def initializeSqlTable(self, db, genome, columns, primaryKey):
     with sql_lib.ExclusiveSqlConnection(db) as cur:
         sql_lib.initializeTable(cur,
                                 genome,
                                 columns,
                                 primaryKey,
                                 drop_if_exists=True)
 def upsert_dict_wrapper(self, d):
     """even more convenient wrapper for upserting. Assumes input is a dict 
     mapping alignment names to a value.
     """
     with sql_lib.ExclusiveSqlConnection(self.db) as cur:
         for aln, value in d.iteritems():
             sql_lib.upsert(cur, self.genome, self.primary_key, aln,
                            self.__class__.__name__, str(value))
Пример #5
0
 def buildNameRow(self, db, genome, aug_aIds, aIds, primaryKey):
     with sql_lib.ExclusiveSqlConnection(db) as cur:
         cur.execute(
             """ALTER TABLE '{}' ADD COLUMN aId TEXT """.format(genome))
         sql_lib.updateRows(cur, genome, primaryKey, "aId",
                            izip(aIds, aug_aIds))
Пример #6
0
 def initializeSqlRows(self, db, genome, aIds, primaryKey):
     with sql_lib.ExclusiveSqlConnection(db) as cur:
         sql_lib.insertRows(cur, genome, primaryKey, [primaryKey],
                            izip_longest(aIds, [None]))
 def upsert_wrapper(self, alignmentName, value):
     """convenience wrapper for upserting into a column in the sql lib.
     So you don't have to call __name__, self.primaryKey, etc each time"""
     with sql_lib.ExclusiveSqlConnection(self.db) as cur:
         sql_lib.upsert(cur, self.genome, self.primary_key, alignmentName,
                        self.__class__.__name__, str(value))