KarrLab/wc_model_gen

View on GitHub

Showing 120 of 341 total issues

Avoid deeply nested control flow statements.
Open

                        if cplx_species.compartment in conc_per_comp:
                            conc_per_comp[cplx_species.compartment] += stoic * \
                                cplx_species.distribution_init_concentration.mean
                        else:        
                            conc_per_comp[cplx_species.compartment] = stoic * \
Severity: Major
Found in wc_model_gen/eukaryote/translation_translocation.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if subunit_id not in gvar.transcript_ntp_usage:
                                seq = subunit.species_type.get_seq()
                                gvar.transcript_ntp_usage[subunit.species_type.id] = {
                                    'A': seq.upper().count('A'),
                                    'C': seq.upper().count('C'),
    Severity: Major
    Found in wc_model_gen/eukaryote/initialize_model.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if species.distribution_init_concentration:
                                  if species.distribution_init_concentration.mean:    
                                      param.value = beta * species.distribution_init_concentration.mean \
                                          / Avogadro.value / species.compartment.init_volume.mean
                                      param.comments = 'The value was assumed to be {} times the concentration of {} in {}'.format(
      Severity: Major
      Found in wc_model_gen/eukaryote/complexation.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if model_compl_species.distribution_init_concentration:
                                    param.value = self._effective_dissociation_constant['{}[{}]'.format(
                                        complex_st_id, compl_compartment_id)] * model_compl_species.distribution_init_concentration.mean
                                else:
                                    param.value = self._effective_dissociation_constant['{}[{}]'.format(
        Severity: Major
        Found in wc_model_gen/eukaryote/complexation.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for part in prot_deg_reaction.participants:
                                      if part.species.id in met_requirement:
                                          met_requirement[part.species.id] += -part.coefficient * prot_concentration * \
                                              doubling_time / prot_half_life
          
          
          Severity: Major
          Found in wc_model_gen/eukaryote/metabolism.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if aa_coefficient:
                                        old_coef = aa_coefficient.coefficient
                                        el_reaction.participants.remove(aa_coefficient)
                                        el_reaction.participants.add(
                                            aa_species.species_coefficients.get_or_create(
            Severity: Major
            Found in wc_model_gen/eukaryote/translation_translocation.py - About 45 mins to fix

              Function test_metabolite_production has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def test_metabolite_production(submodel, reaction_bounds, pseudo_reactions=None, 
              Severity: Minor
              Found in wc_model_gen/utils.py - About 35 mins to fix

                Function gen_michaelis_menten_like_rate_law has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def gen_michaelis_menten_like_rate_law(model, reaction, modifiers=None, modifier_reactants=None, exclude_substrates=None):
                Severity: Minor
                Found in wc_model_gen/utils.py - About 35 mins to fix

                  Function gen_mass_action_rate_law has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def gen_mass_action_rate_law(model, reaction, model_k, modifiers=None, modifier_reactants=None):
                  Severity: Minor
                  Found in wc_model_gen/utils.py - About 35 mins to fix

                    Function calibrate_submodel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calibrate_submodel(self):
                            """ Calibrate the submodel using data in the KB """
                            model = self.model
                            beta = self.options.get('beta')
                    
                    
                    Severity: Minor
                    Found in wc_model_gen/prokaryote/rna_degradation.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function calibrate_submodel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calibrate_submodel(self):
                            """ Calibrate the submodel using data in the KB """
                            model = self.model
                            beta = self.options.get('beta')
                    
                    
                    Severity: Minor
                    Found in wc_model_gen/prokaryote/transcription.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function conv_for_optim has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def conv_for_optim(self):
                            """ Convert metabolism reactions into an optimization problem model
                    
                            Returns:
                                :obj:`conv_opt.Model`: a conv_opt model for optimization
                    Severity: Minor
                    Found in wc_model_gen/eukaryote/metabolism.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function gen_rate_laws has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gen_rate_laws(self):
                            """ Generate rate laws for the reactions in the submodel """
                            model = self.model        
                            cell = self.knowledge_base.cell
                            nucleus = model.compartments.get_one(id='n')
                    Severity: Minor
                    Found in wc_model_gen/eukaryote/rna_degradation.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function gen_michaelis_menten_like_propensity_function has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def gen_michaelis_menten_like_propensity_function(model, reaction, substrates_as_modifiers=None, exclude_substrates=None):
                        """ Generate a Michaelis-Menten-like propensity function. 
                            For species that are considered 'substrates', the substrate term is formulated as the 
                            multiplication of a Hill equation with a coefficient of 1 for each 'substrate'. 
                            For species that are considered 'modifiers', the modifier term is formulated
                    Severity: Minor
                    Found in wc_model_gen/utils.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function calibrate_submodel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calibrate_submodel(self):
                            """ Calibrate the submodel using data in the KB """
                            model = self.model
                            beta = self.options.get('beta')
                    
                    
                    Severity: Minor
                    Found in wc_model_gen/prokaryote/protein_degradation.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function gen_compartments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gen_compartments(self):
                            """ Generate compartments for the model from knowledge base """
                            kb = self.knowledge_base
                            model = self.model
                    
                    
                    Severity: Minor
                    Found in wc_model_gen/eukaryote/initialize_model.py - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function gen_rate_laws has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gen_rate_laws(self):
                            """ Generate rate laws for carbohydrate and lipid formation reactions. High
                                rates are assumed so that the macromolecules are formed as soon as the
                                components are available.        
                            """
                    Severity: Minor
                    Found in wc_model_gen/eukaryote/metabolism.py - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function calc_gtp_per_translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calc_gtp_per_translate(self):
                            """ Calculates the average GTP needed for a translation reaction """
                            submodel = self.model.submodels.get_one(id='translation')
                    
                            gtp_per_translation = []
                    Severity: Minor
                    Found in wc_model_gen/prokaryote/metabolism.py - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function gen_kb_reactions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gen_kb_reactions(self):
                            """ Generate reactions encoded within KB
                                TODO: rxn.submodel attribute is removed from KB, so submodel assignement needs to be taken care of here.
                                      Since all rxns explicitly encoded in KB are metabolic ones, it is manually set to be metablism atm, but
                                      not more sophisticated approach
                    Severity: Minor
                    Found in wc_model_gen/prokaryote/initalize_model.py - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function calc_h_per_transcript has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calc_h_per_transcript(self):
                            """ Calculates the average H needed for a transcription reaction """
                            submodel = self.model.submodels.get_one(id='transcription')
                    
                            h_per_transcript = []
                    Severity: Minor
                    Found in wc_model_gen/prokaryote/metabolism.py - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language