class Reaction(db.Model): """ Represents a reaction Attributes: metabolite_id (:obj:`int`): ID of the corresponding metabolite coefficient (:obj:`float`): Stoichiometric coefficient _is_reactant (:obj:`bool`): Indicates of corresponding metabolite is a reactant _is_product (:obj:`bool`): Indicates of corresponding metabolite is a product _is_modifier (:obj:`bool`): Indicates of corresponding metabolite is a modifier rxn_type (:obj:`str`): Classifer of reaction """ __tablename__ = 'reaction' reaction_id = db.Column(db.Integer, primary_key=True) metabolite_id = db.Column(db.Integer, db.ForeignKey('metabolite.metabolite_id')) metabolite = db.relationship(Metabolite, backref='reaction') compartment_id = db.Column(db.Integer, db.ForeignKey('cell_compartment.id')) compartment = db.relationship(CellCompartment, backref='reaction') coefficient = db.Column(db.Float) _is_reactant = db.Column(db.Boolean) _is_product = db.Column(db.Boolean) _is_modifier = db.Column(db.Boolean) rxn_type = db.Column(db.Unicode) kinetic_law_id = db.Column(db.Integer, db.ForeignKey('kinetic_law.kinetic_law_id')) kinetic_law = db.relationship(KineticLaw, backref='reaction') def __repr__(self): return 'Reaction(%s)' % (self.reaction_id)
class Metabolite(PhysicalEntity): """ Represents a Metabolite - An instance of Physical Entity Attributes: metabolite_id (:obj:`int`): Common Schema Observation Identifier metabolite_name (:obj:`str`): Name of the Metabolite description (:obj:`str`): comment = db.Column(db.Unicode) _is_name_ambiguous = db.Column(db.Boolean) """ __tablename__ = 'metabolite' query_class = FullTextQuery metabolite_id = db.Column(db.Integer, db.ForeignKey('physical_entity.observation_id'), primary_key=True) metabolite_name = db.Column(db.Unicode) description = db.Column(db.Unicode) comment = db.Column(db.Unicode) _is_name_ambiguous = db.Column(db.Boolean) simple_search_vector = db.Column(TSVectorType('metabolite_name')) complex_search_vector = db.Column( TSVectorType('metabolite_name', 'description')) structure_id = db.Column(db.Integer, db.ForeignKey('structure.struct_id')) structure = db.relationship('Structure', backref='metabolite') def __repr__(self): return self.__class__.__name__ + '||%s' % (self.id)
class Concentration(PhysicalProperty): """ Represents the concentration of an entity Attributes: value (:obj:`float`): concentration of a tagged metabolite error (:obj:`float`): uncertainty of corresponding concentration value """ __tablename__ = 'concentration' concentration_id = db.Column( db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) metabolite_id = db.Column(db.Integer, db.ForeignKey('metabolite.metabolite_id')) metabolite = db.relationship('Metabolite', backref='concentration') value = db.Column(db.Float) error = db.Column(db.Float) units = db.Column(db.Unicode) def __repr__(self): return 'Concentration(%s)' % (self.concentration_id)
class AbundanceData(db.Model): """ Represents protein abundance data from the Pax DB database Attributes: abundance (:obj:`float`): Represents protein abundance from given observation in ppm dataset_id (:obj:`int`): Represents the dataset from which the abundance stems from subunit_id (:obj:`int`): Represents the protein frmo which the abundance stems from """ __tablename__ = 'abundance_data' abundance_id = db.Column(db.Integer, primary_key=True) abundance = db.Column(db.Float) dataset_id = db.Column(db.Integer, db.ForeignKey('abundance_dataset.dataset_id')) dataset = db.relationship('AbundanceDataSet', backref='abundance_data', foreign_keys=[dataset_id]) subunit_id = db.Column(db.Integer, db.ForeignKey('protein_subunit.subunit_id'), index=True) subunit = db.relationship('ProteinSubunit') pax_load = db.Column(db.Integer) uniprot_id = db.Column(db.Unicode) def __repr__(self): return 'AbundanceData(%s)' % (self.abundance_id)
class KineticLaw(PhysicalProperty): """ Represents the concentration of an entity Attributes: enzyme_id (:obj:`int`): ID of enzyme driving the kinetic law enzyme_type (:obj:`str`): Enzyme classification (Ex. Modifier-Catalyst) tissue (:obj:`str`): Tissue from which kinetic law stems from mechanism (:obj:`str`): Rate kinetics of Kinetic Law equation (:obj:`str`): Equation of the rate kinetics """ __tablename__ = 'kinetic_law' kinetic_law_id = db.Column( db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) enzyme_id = db.Column(db.Integer, db.ForeignKey('protein_complex.complex_id'), index=True) enzyme = db.relationship(ProteinComplex, backref='kinetic_law') enzyme_type = db.Column(db.Unicode) tissue = db.Column(db.Unicode) mechanism = db.Column(db.Unicode) equation = db.Column(db.Unicode) def __repr__(self): return 'KineticLaw(%s)' % (self.kinetic_law_id)
class DNABindingDataset(PhysicalProperty): """ Represents a dataset for Transcription Factor Binding Attributes: version (:obj:`int`): Represents the version of binding matrix complex_id (:obj:`int`): Relation ID for transcription factor complex subunit_id (:obj:`int`): Relation ID for transcription factor subunit """ __tablename__ = 'dna_binding_dataset' dataset_id = db.Column(db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) version = db.Column(db.Integer) complex_id = db.Column(db.Integer, db.ForeignKey('protein_complex.complex_id')) tf = db.relationship('ProteinComplex', backref='dna_binding_dataset') subunit_id = db.Column(db.Integer, db.ForeignKey('protein_subunit.subunit_id')) subunit = db.relationship('ProteinSubunit', backref='dna_binding_dataset') def __repr__(self): return 'DNABindingDataset(%s)' % (self.dataset_id)
class ProteinSubunit(PhysicalEntity): """ Represents a Protein Subunit - An instance of Physical Entity Attributes: subunit_id (:obj:`int`): Common Schema Observation Identifier subunit_name (:obj:`str`): Name of the Protein Subunit uniprot_id (:obj:`str`): Uniprot ID for the Subunit entrez_id (:obj:`int`): Entrez ID for the Subunit gene_name (:obj:`str`): Name of Gene which subunit is derived gene_syn (:obj:`str`): Synonym of Gene class_name (:obj:`str`): Class Name of Subunit family_name (:obj:`str`): Family Name of Subunit coefficient (:obj:`str`): Number of units required for complex sequence (:obj:`str`): Sequence of Subunit molecular_weight (:obj:`float`): Molecular weight of subunit """ __tablename__ = 'protein_subunit' query_class = FullTextQuery subunit_id = db.Column(db.Integer, db.ForeignKey('physical_entity.observation_id'), primary_key=True, autoincrement=True) subunit_name = db.Column(db.Unicode) uniprot_id = db.Column(db.Unicode) entrez_id = db.Column(db.BigInteger) ec_number = db.Column(db.Unicode) gene_name = db.Column(db.Unicode) gene_syn = db.Column(db.Unicode) class_name = db.Column(db.Unicode) family_name = db.Column(db.Unicode) coefficient = db.Column(db.Integer) canonical_sequence = db.Column(db.Unicode) mass = db.Column(db.Unicode) length = db.Column(db.Unicode) molecular_weight = db.Column(db.Float) pax_load = db.Column(db.Integer) uniprot_checked = db.Column(db.Boolean) simple_search_vector = db.Column(TSVectorType('subunit_name')) complex_search_vector = db.Column( TSVectorType('subunit_name', 'uniprot_id', 'gene_name')) proteincomplex_id = db.Column(db.Integer, db.ForeignKey('protein_complex.complex_id')) proteincomplex = db.relationship('ProteinComplex', backref='protein_subunit', foreign_keys=[proteincomplex_id]) def __repr__(self): return self.__class__.__name__ + '||%s' % (self.id)
class DNABindingData(db.Model): """ Represents Matrix binding profile for a protein transcription factor Attributes: position (:obj:`int`): Position in the sequence frequency_a (:obj:`int`): Frequency of A frequency_c (:obj:`int`): Frequency of C frequency_g (:obj:`int`): Frequency of G frequency_t (:obj:`int`): Frequency of T jaspar_id (:obj:`int`): ID of Jaspar Matrix (used for bulk insert mapping) dataset_id (:obj:`int`): Represents the dataset from which the data stems from """ __tablename__ = 'dna_binding_data' position_id = db.Column(db.Integer, primary_key=True) position = db.Column(db.Integer, index=True) frequency_a = db.Column(db.Integer) frequency_c = db.Column(db.Integer) frequency_g = db.Column(db.Integer) frequency_t = db.Column(db.Integer) jaspar_id = db.Column(db.Integer) dataset_id = db.Column(db.Integer, db.ForeignKey('dna_binding_dataset.dataset_id')) dataset = db.relationship('DNABindingDataset', backref='dna_binding_data', foreign_keys=[dataset_id]) def __repr__(self): return 'DNABindingData(%s)' % (self.position_id)
class Parameter(db.Model): """ Represents a parameter for a given kinetic law and metabolite Attributes: kinetic_law_id (:obj:`int`): corresponding kinetic law to the parameter sabio_type (:obj:`int`): sabio identifier for type of parameter metabolite_id (:obj:`int`): corresponding metabolite for the parameter value (:obj:`float`): Value of parameter error (:obj:`float`): Uncertainty of the value units (:obj:`str`): units of the parameter observed_name (:obj:`str`): observed name of parameter observed_sabio_type (:obj:`int`): observed sabio type observed_value (:obj:`float`): observed value of parameter observed_error (:obj:`float`): observed error of parameter observed_units (:obj:`str`): observed units of parameter """ __tablename__ = 'parameter' parameter_id = db.Column(db.Integer, primary_key=True) kinetic_law_id = db.Column(db.Integer, db.ForeignKey('kinetic_law.kinetic_law_id')) kinetic_law = db.relationship(KineticLaw, backref='parameter') sabio_type = db.Column(db.Integer, index=True) metabolite_id = db.Column(db.Integer, db.ForeignKey('metabolite.metabolite_id'), index=True) metabolite = db.relationship(Metabolite, backref='parameter') value = db.Column(db.Float) error = db.Column(db.Float) units = db.Column(db.Unicode, index=True) observed_name = db.Column(db.Unicode) observed_sabio_type = db.Column(db.Integer) observed_value = db.Column(db.Float) observed_error = db.Column(db.Float) observed_units = db.Column(db.Unicode) def __repr__(self): return 'Parameter(%s)' % (self.parameter_id)
class ReferenceGenome(PhysicalProperty): __tablename__ = 'reference_genome' reference_genome_id = db.Column( db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) namespace = db.Column(db.Unicode) organism_strain = db.Column(db.Unicode) download_url = db.Column(db.Unicode) def __repr__(self): return 'ReferenceGenome(%s)' % (self.reference_genome_id)
class Experiment(db.Model): __tablename__ = 'experiment' id = db.Column(db.Integer, primary_key=True) #observations = db.relationship('Observation', backref='experiment') _experimentmetadata_id = db.Column(db.Integer, db.ForeignKey('_experimentmetadata.id')) _experimentmetadata = db.relationship('ExperimentMetadata', backref='experiment') def __repr__(self): return 'Experiment(%s||%s)' % (self.id, self._experimentmetadata_id)
class RNASeqExperiment(Experiment): __tablename__ = 'rna_seq_experiment' experiment_id = db.Column(db.Integer, db.ForeignKey('experiment.id'), primary_key=True) samples = db.relationship('RNASeqDataSet', secondary=rnaseqdataset_rnaseqexperiment, backref='experiment') accession_number = db.Column(db.Unicode) exp_name = db.Column(db.Unicode) has_fastq_files = db.Column(db.Boolean) def __repr__(self): return 'RNASeqExperiment(%s)' % (self.experiment_id)
class RNASeqDataSet(PhysicalProperty): __tablename__ = 'rna_seq_dataset' sample_id = db.Column(db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) experiment_accession_number = db.Column(db.Unicode) sample_name = db.Column(db.Unicode) assay = db.Column(db.Unicode) ensembl_organism_strain = db.Column(db.Unicode) read_type = db.Column(db.Unicode) full_strain_specificity = db.Column(db.Boolean) reference_genome = db.relationship('ReferenceGenome', secondary=rnaseqdataset_referencegenome, backref='sample') def __repr__(self): return 'RNASeqDataset(%s)' % (self.sample_id)
class Observation(db.Model): """ Represents an Observation of a Physical Entity or Property in the Common Schema Attributes: id (:obj:`int`): Common Schema Observation Identifier _metadata_id (:obj:`int` of :obj:`Metadata`): Related Metadata ID """ __tablename__ = 'observation' id = db.Column(db.Integer, primary_key=True, autoincrement=True) _metadata_id = db.Column(db.Integer, db.ForeignKey('_metadata.id')) _metadata = db.relationship('Metadata') def __repr__(self): return 'Observation({0})'.format(self.id)
class PhysicalProperty(Observation): """ Represents a Physical Property in the Common Schema Attributes: observation_id (:obj:`int`): Common Schema Observation Identifier type (:obj:`str`): Type of Physical Property (Ex. Concentration) name (:obj:`str`): Name of the Physical Property """ observation_id = db.Column(db.Integer, db.ForeignKey('observation.id'), primary_key=True) type = db.Column(db.Unicode) name = db.Column(db.Unicode) __tablename__ = 'physical_property' def __repr__(self): return 'PhysicalProperty(%s||%s)' % (self.name, self.observation_id)
class PhysicalEntity(Observation): """ Represents a Physical Entity in the Common Schema Attributes: observation_id (:obj:`int`): Common Schema Observation Identifier type (:obj:`str`): Type of Physical Entity (Ex. Metabolite) name (:obj:`str`): Name of the Physical Entity (Ex. Water ) """ __tablename__ = 'physical_entity' observation_id = db.Column(db.Integer, db.ForeignKey('observation.id'), primary_key=True, autoincrement=True) type = db.Column(db.Unicode) name = db.Column(db.Unicode) def __repr__(self): return 'PhysicalEntity(%s||%s)' % (self.name, self.observation_id)
class ProteinInteraction(PhysicalProperty): """ Represents a protein-protein interaction Attributes: participant_a (:obj:`str`): Participant A in the interaction participant_b (:obj:`str`): Participant B in the interaction interaction (:obj:`str`): Interaction ID site_a (:obj:`str`): Binding Site of Participant A site_b (:obj:`str`): Binding Site of Participant B stoich_a (:obj:`str`): Stoichiometry of Participant A stoich_b (:obj:`str`): Stoichiometry of Participant B """ __tablename__ = 'protein_interactions' query_class = FullTextQuery interaction_id = db.Column( db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) protein_a = db.Column(db.Unicode) protein_b = db.Column(db.Unicode) gene_a = db.Column(db.Unicode) gene_b = db.Column(db.Unicode) type_a = db.Column(db.Unicode) type_b = db.Column(db.Unicode) role_a = db.Column(db.Unicode) role_b = db.Column(db.Unicode) loc_a = db.Column(db.Unicode) loc_b = db.Column(db.Unicode) stoich_a = db.Column(db.Unicode) stoich_b = db.Column(db.Unicode) interaction_type = db.Column(db.Unicode) confidence = db.Column(db.Unicode) def __repr__(self): return 'ProteinInteratction(%s)' % (self.interaction_id)
class ProteinComplex(PhysicalEntity): """ Represents a Protein Complex - An instance of Physical Entity Attributes: complex_id (:obj:`int`): Common Schema Observation Identifier complex_name (:obj:`str`): Name of the Protein Complex go_id (:obj:`str`): GO functional annotation go_dsc (:obj:`str`): Description of the annotation funcat_id (:obj:`str`): FUNCAT functional annotation funcat_dsc (:obj:`str`): Description of the annotation su_cmt (:obj:`str`): Subunit comments complex_cmt (:obj:`str`): Compex comments disease_cmt (:obj:`str`): Disease comments class_name (:obj:`str`): Class Name of Subunit family_name (:obj:`str`): Family Name of Subunit molecular_weight (:obj:`float`): Molecular weight of subunit """ __tablename__ = 'protein_complex' query_class = FullTextQuery complex_id = db.Column(db.Integer, db.ForeignKey('physical_entity.observation_id'), primary_key=True) complex_name = db.Column(db.Unicode) go_id = db.Column(db.Unicode) go_dsc = db.Column(db.Unicode) funcat_id = db.Column(db.Unicode) funcat_dsc = db.Column(db.Unicode) su_cmt = db.Column(db.Unicode) complex_cmt = db.Column(db.Unicode) disease_cmt = db.Column(db.Unicode) class_name = db.Column(db.Unicode) family_name = db.Column(db.Unicode) molecular_weight = db.Column(db.Float) simple_search_vector = db.Column(TSVectorType('complex_name')) def __repr__(self): return self.__class__.__name__ + '||%s' % (self.id)
class Structure(PhysicalProperty): """ Represents a structure of a metabolite Attributes: _value_smiles (:obj:`str`): Smiles format for metabolite representation _value_inchi (:obj:`str`): Inchi format for metabolite representation _structure_formula_connectivity (:obj:`str`): Connectivity of metabolite """ __tablename__ = 'structure' struct_id = db.Column(db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) _value_smiles = db.Column(db.Unicode) _value_inchi = db.Column(db.Unicode) _structure_formula_connectivity = db.Column(db.Unicode) def __repr__(self): return 'Structure(%s)' % (self.struct_id)
class AbundanceDataSet(PhysicalProperty): """ Represents a dataset for protein abundance Attributes: file_name (:obj:`str`): Name of data set which data stems from score (:obj:`float`): Quality of the experimental analysis (PAXdb Measure) weight (:obj:`int`): coverage (:obj:`int`): Percentage of genome coverage """ __tablename__ = 'abundance_dataset' dataset_id = db.Column(db.Integer, db.ForeignKey('physical_property.observation_id'), primary_key=True) file_name = db.Column(db.Unicode, unique=True) score = db.Column(db.Float) weight = db.Column(db.Integer) coverage = db.Column(db.Integer) def __repr__(self): return 'AbundanceDataset(%s)' % (self.dataset_id)
""" _exeperimentmetadata_method = db.Table( '_exeperimentmetadata_method', db.Model.metadata, db.Column('_exeperimentmetadata_id', db.Integer, db.ForeignKey('_exeperimentmetadata.id'), index=True), db.Column('method_id', db.Integer, db.ForeignKey('method.id'), index=True), ) """ _metadata_taxon = db.Table( '_metadata_taxon', db.Model.metadata, db.Column('_metadata_id', db.Integer, db.ForeignKey('_metadata.id'), index=True), db.Column('taxon_id', db.Integer, db.ForeignKey('taxon.ncbi_id'), index=True), ) # :obj:`db.Table`: Metadata:Taxon many-to-many association table _metadata_method = db.Table( '_metadata_method', db.Model.metadata, db.Column('_metadata_id', db.Integer, db.ForeignKey('_metadata.id'), index=True),