コード例 #1
0
def insert_new_output_transition(cursor, operon_id):
    """Insert new output transition."""
    ot_id = select_last_inserted_table_id(cursor, "OutputTransition", "ot_id")
    ot_id = make_new_id(ot_id)
    sbml = "ot_sbml_{}.txt".format(ot_id)
    db.db_insert(cursor, "OperonOutputTransition", ["ope_id", "ot_id"], [operon_id, ot_id])
    db.db_insert(cursor, "OutputTransition", ["ot_id", "sbml"], [ot_id, sbml])

    return ot_id
コード例 #2
0
def insert_new_operon(cursor, plasmid_id, operon_name, direction):
    """Insert new operon."""
    operon_id = select_last_inserted_table_id(cursor, "Operon", "ope_id").replace("-", "")
    operon_id = make_new_id(operon_id)
    sbol = "operon_sbol_{}.png".format(operon_id)
    sbml = "operon_sbml_{}.txt".format(operon_id)
    db.db_insert(cursor, "PlasmidOperon", ["ope_id", "pla_id", "direction"], [operon_id, plasmid_id, direction])
    db.db_insert(cursor, "Operon", ["ope_id", "name", "sbol", "sbml"], [operon_id, operon_name, sbol, sbml])
    return operon_id
コード例 #3
0
def insert_new_input_transition(cursor, operon_id, logic):
    """Insert new input transition."""

    it_id = select_last_inserted_table_id(cursor, "InputTransition", "it_id")
    it_id = make_new_id(it_id)
    sbml = "it_sbml_{}.txt".format(it_id)
    db.db_insert(cursor, "OperonInputTransition", ["ope_id", "it_id"], [operon_id, it_id])
    db.db_insert(cursor, "InputTransition", ["it_id", "logic", "sbml"], [it_id, logic, sbml])

    return it_id
コード例 #4
0
def insert_new_output_transition_species(cursor, ot_id, species_name, species_type):
    """Insert new output transition species."""

    check_db_species_id = check_species_name_in_database(cursor, species_name.strip().lower())
    if check_db_species_id == "":
        last_spe_id = select_last_inserted_table_id(cursor, "Species", "spe_id")
        spe_id = make_new_id(last_spe_id)
        sbml = "species_sbml_{}".format(spe_id)
        sbml_species_file = rootPath + "/SBML_TXT_FILES/" + sbml
        db.db_insert(cursor, "Species", ["spe_id", "name", "type", "sbml"],
                     [spe_id, species_name.lower(), species_type.lower(), sbml])
        su.sbml_species(ot_id, species_name, sbml_species_file)

    else:
        spe_id = check_db_species_id

    last_out_id = select_last_inserted_table_id(cursor, "OutputTransitionSpecies", "out_id")
    out_id = make_new_id(last_out_id)
    db.db_insert(cursor, "OutputTransitionSpecies", ["out_id", "ot_id", "spe_id"], [out_id, ot_id, spe_id])

    return spe_id
コード例 #5
0
def insert_new_input_transition_species(cursor, it_id, species_name, species_type, species_repression):
    """Insert new input transition species."""

    check_db_species_id = check_species_name_in_database(cursor, species_name)
    if check_db_species_id == "":
        last_spe_id = select_last_inserted_table_id(cursor, "Species", "spe_id")
        spe_id = make_new_id(last_spe_id)
        sbml = "species_sbml_{}".format(spe_id)
        db.db_insert(cursor, "Species", ["spe_id", "name", "type", "sbml"],
                     [spe_id, species_name.lower(), species_type.lower(), sbml])
        sbml_species_file = rootPath + "/SBML_TXT_FILES/" + sbml
        su.sbml_species(it_id, species_name, sbml_species_file)

    else:
        spe_id = check_db_species_id
    last_in_id = select_last_inserted_table_id(cursor, "InputTransitionSpecies", "in_id")
    in_id = make_new_id(last_in_id)
    db.db_insert(cursor, "InputTransitionSpecies", ["in_id", "it_id", "spe_id", "repression"],
                 [in_id, it_id, spe_id, species_repression])

    return spe_id
コード例 #6
0
def insert_new_plasmid(cursor, plasmid_name, PMID):
    """Insert new plasmid."""
    plasmid_id = select_last_inserted_table_id(cursor, "Plasmid", "pla_id")
    plasmid_id = make_new_id(plasmid_id)
    db.db_insert(cursor, "Plasmid", ["pla_id", "name", "PMID"], [plasmid_id, plasmid_name, PMID])
    return plasmid_id