Skip to content
Permalink
0ee5743cf1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
41 lines (29 sloc) 1.57 KB
from planet import db
class SequenceSequenceCladeAssociation(db.Model):
__tablename__ = 'sequence_sequence_clade'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True)
sequence_one_id = db.Column(db.Integer, db.ForeignKey('sequences.id', ondelete='CASCADE'))
sequence_two_id = db.Column(db.Integer, db.ForeignKey('sequences.id', ondelete='CASCADE'))
clade_id = db.Column(db.Integer, db.ForeignKey('clades.id', ondelete='CASCADE'), index=True)
tree_id = db.Column(db.Integer, db.ForeignKey('trees.id', ondelete='CASCADE'), index=True)
duplication = db.Column(db.Boolean)
duplication_consistency_score = db.Column(db.Float)
tree = db.relationship('Tree', lazy='joined',
backref=db.backref('sequence_sequence_clade_associations',
lazy='dynamic',
passive_deletes=True)
)
clade = db.relationship('Clade', lazy='joined',
backref=db.backref('sequence_sequence_clade_associations',
lazy='dynamic',
passive_deletes=True)
)
def __str__(self):
return "%d" % self.id
@property
def readable_type(self):
return "Duplication" if self.duplication else "Speciation"
@property
def readable_score(self):
return "%.3f" % self.duplication_consistency_score if self.duplication else "Not available"