Beispiel #1
0
 def sendDB2Labbook(self, DB, recs=None, cols=None, name='main'):
     """Send copy of selected DB cols to a labbook table
     convenience method to allow quick duplication of main DB data"""
     from PEATDB.TableModels import TableModel
     if cols == None:
         cols = DB.meta.userfields.keys()
     if recs == None:
         recs = DB.getRecs()
     cols.append('name')    
     M = TableModel()
     #M.addColumn('name')            
     for rec in recs:
         M.addRow(rec)
         for c in cols:
             M.addColumn(c)
             if DB[rec].has_key(c):
                 M.data[rec][c] = DB[rec][c]
     DB.createLabbookSheet(name, M)
     return M
Beispiel #2
0
 def sendDB2Labbook(self, DB, recs=None, cols=None, name='main'):
     """Send copy of selected DB cols to a labbook table
     convenience method to allow quick duplication of main DB data"""
     from PEATDB.TableModels import TableModel
     if cols == None:
         cols = DB.meta.userfields.keys()
     if recs == None:
         recs = DB.getRecs()
     cols.append('name')
     M = TableModel()
     #M.addColumn('name')
     for rec in recs:
         M.addRow(rec)
         for c in cols:
             M.addColumn(c)
             if DB[rec].has_key(c):
                 M.data[rec][c] = DB[rec][c]
     DB.createLabbookSheet(name, M)
     return M
Beispiel #3
0
    def matrix2Table(self, matrix):
        """Creates a table model from a peatsa matrix"""         
        M = TableModel()
        M.addColumn('Mutations')

        fields = matrix.columnHeaders()
        for f in fields:
            M.addColumn(f)
        i = matrix.indexOfColumnWithHeader('Mutations')
        for row in matrix:
            mutationSet = Core.Data.MutationSet(row[i])
            code = '+'.join(mutationSet.mutationCodes(reduced=True))
            M.addRow(code)
            for f in fields:
                j = matrix.indexOfColumnWithHeader(f)
                if f == 'Mutations':
                    M.data[code]['Mutations'] = code
                else:                   
                    M.data[code][f] = str(row[j])
        return M
Beispiel #4
0
    def matrix2Table(self, matrix):
        """Creates a table model from a peatsa matrix"""
        M = TableModel()
        M.addColumn('Mutations')

        fields = matrix.columnHeaders()
        for f in fields:
            M.addColumn(f)
        i = matrix.indexOfColumnWithHeader('Mutations')
        for row in matrix:
            mutationSet = Core.Data.MutationSet(row[i])
            code = '+'.join(mutationSet.mutationCodes(reduced=True))
            M.addRow(code)
            for f in fields:
                j = matrix.indexOfColumnWithHeader(f)
                if f == 'Mutations':
                    M.data[code]['Mutations'] = code
                else:
                    M.data[code][f] = str(row[j])
        return M