Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
class ExperimentMetadata(db.Model):
    """
    db.Table representing Metadata identifiers for entities and properties

    Attributes:
        name (:obj:`str`): Name of the entity or property

    """
    __tablename__ = '_experimentmetadata'

    name = db.Column(db.Unicode, unique=True)
    id = db.Column(db.Integer, primary_key=True)
    description = db.Column(db.Text())

    method = db.relationship('Method',
                             secondary=_experimentmetadata_method,
                             backref='_experimentmetadata')
    taxon = db.relationship('Taxon',
                            secondary=_experimentmetadata_taxon,
                            backref='_experimentmetadata')
    experiment_design = db.relationship(
        'ExperimentDesign',
        secondary=_experimentmetadata_experimentdesign,
        backref='_experimentmetadata')
    experiment_type = db.relationship(
        'ExperimentType',
        secondary=_experimentmetadata_experimenttype,
        backref='_experimentmetadata')
    resource = db.relationship('Resource',
                               secondary=_experimentmetadata_resource,
                               backref='_experimentmetadata')

    def __repr__(self):
        return 'ExperimentMetadata(%s||%s)' % (self.name, self.id)
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
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)
Пример #10
0
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)
Пример #11
0
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)
Пример #12
0
class Metadata(db.Model):
    """
    db.Table representing Metadata identifiers for entities and properties

    Attributes:
        name (:obj:`str`): Name of the entity or property

    """
    __tablename__ = '_metadata'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Unicode, unique=True)

    taxon = db.relationship('Taxon',
                            secondary=_metadata_taxon,
                            backref='_metadata')
    method = db.relationship('Method',
                             secondary=_metadata_method,
                             backref='_metadata')
    resource = db.relationship('Resource',
                               secondary=_metadata_resource,
                               backref='_metadata')
    cell_line = db.relationship('CellLine',
                                secondary=_metadata_cell_line,
                                backref='_metadata')
    synonym = db.relationship('Synonym',
                              secondary=_metadata_synonym,
                              backref='_metadata')
    conditions = db.relationship('Conditions',
                                 secondary=_metadata_conditions,
                                 backref='_metadata')
    cell_compartment = db.relationship('CellCompartment',
                                       secondary=_metadata_compartment,
                                       backref='_metadata')
    characteristic = db.relationship('Characteristic',
                                     secondary=_metadata_characteristic,
                                     backref='_metadata')
    variable = db.relationship('Variable',
                               secondary=_metadata_variable,
                               backref='_metadata')

    def __repr__(self):
        return 'Metadata(%s||%s)' % (self.name, self.id)
Пример #13
0
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)
Пример #14
0
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)
Пример #15
0
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)