<commit_before># Copyright 2017 <NAME> and The Novo Nordisk Foundation Center for Biosustainability, DTU.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import

import logging

from cameo.flux_analysis.simulation import FluxDistributionResult
from cobra.core.dictlist import DictList
from cobra.core.model import Model
from cobra.core.reaction import  Reaction

__all__ = ["compete_metabolite", "inhibit_metabolite", "knockout_metabolite", "apply_anti_metabolite"]

logger = logging.getLogger(__name__)


def compete_metabolite(model, metabolite, reference_dist, fraction=0.5, allow_accumulation=True, constant=1e4):
    """
    Increases the usage of a metabolite based on a reference flux distributions.

    Parameters
    ----------
    model : Model
        A constraint-based model.
    metabolite : cobra.Metabolite
        A metabolite.
    reference_dist : dict or FluxDistributionResult
        The result of a FBA like simulation. Alternative can be dictionaries of reaction.id -> flux.
    fraction : float
        How much does it requires the reactions to go up.<commit_msg>fix: extra space breaks flake8<commit_after># Copyright 2017 <NAME> and The Novo Nordisk Foundation Center for Biosustainability, DTU.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import

import logging

from cameo.flux_analysis.simulation import FluxDistributionResult
from cobra.core.dictlist import DictList
from cobra.core.model import Model
from cobra.core.reaction import Reaction

__all__ = ["compete_metabolite", "inhibit_metabolite", "knockout_metabolite", "apply_anti_metabolite"]

logger = logging.getLogger(__name__)


def compete_metabolite(model, metabolite, reference_dist, fraction=0.5, allow_accumulation=True, constant=1e4):
    """
    Increases the usage of a metabolite based on a reference flux distributions.

    Parameters
    ----------
    model : Model
        A constraint-based model.
    metabolite : cobra.Metabolite
        A metabolite.
    reference_dist : dict or FluxDistributionResult
        The result of a FBA like simulation. Alternative can be dictionaries of reaction.id -> flux.
    fraction : float
        How much does it requires the reactions to go up.
{'fraction_non_alphanumeric': 0.0663170882171499, 'fraction_numerical': 0.0077112893275755705, 'mean_word_length': 4.115141955835962, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '964393', 'n_tokens_mistral': 886, 'n_tokens_neox': 838, 'n_words': 361}