Esempio n. 1
0
class GraphDB(db.Model):
    __tablename__ = 'graph'
    __table_args__ = {'mysql_engine': 'InnoDB'}

    id = db.Column(db.Integer, primary_key=True)
    connected_component = db.Column(db.SmallInteger, nullable=False, index=True)
    atlas_id = db.Column(db.ForeignKey('atlas.id'), index=True, nullable=False)
    cutoff_id = db.Column(db.ForeignKey('cutoff.id'), nullable=False, index=True)
    pdbe_id = db.Column(db.ForeignKey('pdbe.id', ondelete='CASCADE'), nullable=False, index=True)

    atlas = db.relationship('AtlasDB', back_populates='graphs')
    cutoff = db.relationship('CutoffDB', back_populates='graphs')
    pdbe = db.relationship('PdbeDB', back_populates='graphs')

    def __repr__(self):
        return '<GraphDB(pdb={0}, name={1})>'.format(self.pdbe.pdb.pdb, self.atlas.name)
Esempio n. 2
0
class CutoffDB(db.Model):
    __tablename__ = 'cutoff'
    __table_args__ = (db.UniqueConstraint('scut', 'kcut'), {'mysql_engine': 'InnoDB'})
    id = db.Column(db.Integer, primary_key=True)
    scut = db.Column(SqliteNumeric(4, 2), nullable=False)
    kcut = db.Column(db.Integer, nullable=False)
    graphs = db.relationship('GraphDB', back_populates='cutoff')

    def __repr__(self):
        return '<CutoffDB(scut={0}, kcut={1})>'.format(self.scut, self.kcut)
Esempio n. 3
0
class AtlasDB(db.Model):
    __tablename__ = 'atlas'
    __table_args__ = {'mysql_engine': 'InnoDB'}
    id = db.Column(db.Integer, primary_key=True)
    nodes = db.Column(db.SmallInteger, nullable=False)
    edges = db.Column(db.SmallInteger, nullable=False)
    name = db.Column(db.String(30), nullable=False, unique=True)
    graphs = db.relationship('GraphDB', back_populates='atlas')

    def __repr__(self):
        return '<AtlasDB(name={0}, nodes={1}, edges={2})>'.format(self.name, self.nodes, self.edges)