예제 #1
0
def test__normalize_pseudoreaction_exchange_error_bad_coeff():
    reaction = Reaction('EX_gone')
    reaction.add_metabolites({Metabolite('glu__L_e'): -2})
    with pytest.raises(ConflictingPseudoreaction) as excinfo:
        _normalize_pseudoreaction(reaction)
    assert 'with coefficient' in str(excinfo.value)
    assert reaction.id == 'EX_gone'
예제 #2
0
def test__normalize_pseudoreaction_biomass_has_gpr():
    reaction = Reaction('my_biomass_2')
    reaction.gene_reaction_rule = 'b1779'
    with pytest.raises(ConflictingPseudoreaction) as excinfo:
        _normalize_pseudoreaction(reaction)
    assert 'has a gene_reaction_rule' in str(excinfo.value)
    assert reaction.id == 'my_biomass_2'
예제 #3
0
def test__normalize_pseudoreaction_demand():
    reaction = Reaction('DM_gone')
    reaction.add_metabolites({Metabolite('glu__L_c'): -1})
    reaction.lower_bound = 0
    reaction.upper_bound = 1000
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'DM_glu__L_c'
    assert reaction.subsystem == 'Intracellular demand'
예제 #4
0
def test__normalize_pseudoreaction_exchange_error_has_gpr():
    reaction = Reaction('EX_gone')
    reaction.add_metabolites({Metabolite('glu__L_e'): -1})
    reaction.gene_reaction_rule = 'b1779'
    with pytest.raises(ConflictingPseudoreaction) as excinfo:
        _normalize_pseudoreaction(reaction)
    assert 'has a gene_reaction_rule' in str(excinfo.value)
    assert reaction.id == 'EX_gone'
예제 #5
0
def test__normalize_pseudoreaction_exchange():
    reaction = Reaction('EX_gone')
    reaction.add_metabolites({Metabolite('glu__L_e'): -1})
    reaction.lower_bound = -1000
    reaction.upper_bound = 0
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'EX_glu__L_e'
    assert reaction.subsystem == 'Extracellular exchange'
예제 #6
0
def test__normalize_pseudoreaction_sink():
    reaction = Reaction('SInk_gone')
    reaction.add_metabolites({Metabolite('glu__L_c'): -1})
    reaction.lower_bound = -1000
    reaction.upper_bound = 0
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'SK_glu__L_c'
    assert reaction.subsystem == 'Intracellular source/sink'
예제 #7
0
def test__normalize_pseudoreaction_demand_reversed():
    reaction = Reaction('DM_gone')
    reaction.add_metabolites({Metabolite('glu__L_c'): 1})
    reaction.lower_bound = -1000
    reaction.upper_bound = 0
    _normalize_pseudoreaction(reaction)
    assert list(reaction.metabolites.values()) == [-1]
    assert reaction.lower_bound == 0
    assert reaction.upper_bound == 1000
    assert reaction.id == 'DM_glu__L_c'
예제 #8
0
def test__normalize_pseudoreaction_exchange_reversed():
    reaction = Reaction('EX_gone')
    reaction.add_metabolites({Metabolite('glu__L_e'): 1})
    reaction.lower_bound = 0
    reaction.upper_bound = 1000
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'EX_glu__L_e'
    assert reaction.lower_bound == -1000
    assert reaction.upper_bound == 0
    assert list(reaction.metabolites.values()) == [-1]
예제 #9
0
def test__normalize_pseudoreaction_atpm():
    reaction = Reaction('notATPM')
    reaction.add_metabolites({Metabolite('atp_c'): -1,
                              Metabolite('h2o_c'): -1,
                              Metabolite('pi_c'): 1,
                              Metabolite('h_c'): 1,
                              Metabolite('adp_c'): 1})
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'ATPM'
    assert reaction.subsystem == 'Biomass and maintenance functions'
예제 #10
0
def test__normalize_pseudoreaction_sink_reversed():
    reaction = Reaction('Sink_gone')
    reaction.add_metabolites({Metabolite('glu__L_c'): 1})
    reaction.lower_bound = 0
    reaction.upper_bound = 50
    _normalize_pseudoreaction(reaction)
    assert list(reaction.metabolites.values()) == [-1]
    assert reaction.lower_bound == -50
    assert reaction.upper_bound == 0
    assert reaction.id == 'SK_glu__L_c'
예제 #11
0
def test__normalize_pseudoreaction_atpm_has_gpr():
    reaction = Reaction('NPT1')
    reaction.add_metabolites({Metabolite('atp_c'): -1,
                              Metabolite('h2o_c'): -1,
                              Metabolite('pi_c'): 1,
                              Metabolite('h_c'): 1,
                              Metabolite('adp_c'): 1})
    reaction.gene_reaction_rule = 'b1779'
    _normalize_pseudoreaction(reaction)
    # should not change
    assert reaction.id == 'NPT1'
예제 #12
0
def test__normalize_pseudoreaction_atpm_reversed():
    reaction = Reaction('notATPM')
    reaction.add_metabolites({Metabolite('atp_c'): 1,
                              Metabolite('h2o_c'): 1,
                              Metabolite('pi_c'): -1,
                              Metabolite('h_c'): -1,
                              Metabolite('adp_c'): -1})
    reaction.lower_bound = -50
    reaction.upper_bound = 100
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'ATPM'
    assert reaction.lower_bound == -100
    assert reaction.upper_bound == 50
예제 #13
0
def test__normalize_pseudoreaction_exchange_error_bad_name():
    reaction = Reaction('gone')
    reaction.add_metabolites({Metabolite('glu__L_e'): -1})
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'EX_glu__L_e'
예제 #14
0
def test__normalize_pseudoreaction_biomass():
    reaction = Reaction('my_biomass_2')
    _normalize_pseudoreaction(reaction)
    assert reaction.id == 'BIOMASS_my_2'
    assert reaction.subsystem == 'Biomass and maintenance functions'