KarrLab/wc_model_gen

View on GitHub

Showing 120 of 341 total issues

File complexation.py has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Generator for macromolecular complexation submodel for eukaryotes
:Author: Yin Hoon Chew <yinhoon.chew@mssm.edu>
:Date: 2019-08-02
:Copyright: 2019, Karr Lab
:License: MIT
Severity: Minor
Found in wc_model_gen/eukaryote/complexation.py - About 5 hrs to fix

    Function gen_reactions has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def gen_reactions(self):
            """ Generate a lumped reaction that covers initiation, elongation and termination for each protein translated """
            model = self.model
            submodel = self.submodel
            cell = self.knowledge_base.cell
    Severity: Minor
    Found in wc_model_gen/prokaryote/translation.py - About 5 hrs 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 _import_cytosolic_trna_into_mitochondria has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        def _import_cytosolic_trna_into_mitochondria(self, cytosolic_trna_ids):
            """ Create reactions and rate laws for importing cytosolic tRNAs into the mitochondria.
                The concentrations of imported tRNAs in the mitochondria are set based on
                the provided fraction and the rates of transport are calibrated accordingly to achieve
                steady-states
    Severity: Minor
    Found in wc_model_gen/eukaryote/translation_translocation.py - About 5 hrs 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 34 (exceeds 5 allowed). Consider refactoring.
    Open

        def calibrate_submodel(self):
            """ Calibrate the submodel using data in the KB """        
            model = self.model        
            cell = self.knowledge_base.cell
            
    Severity: Minor
    Found in wc_model_gen/eukaryote/complexation.py - About 5 hrs 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 relax_bounds has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def relax_bounds(self, target, lower_bound_adjustable, upper_bound_adjustable):
            """ Relax bounds to achieve set target flux(es) while minimizing the total necessary adjustment
                to the flux bounds
            
            Args:
    Severity: Minor
    Found in wc_model_gen/eukaryote/metabolism.py - About 4 hrs 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_distribution_init_concentrations has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def gen_distribution_init_concentrations(self):
            """ Generate concentrations for the model from knowledge base """
            kb = self.knowledge_base
            model = self.model
            media = self.options['media']
    Severity: Minor
    Found in wc_model_gen/eukaryote/initialize_model.py - About 4 hrs 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 clean_and_validate_options has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def clean_and_validate_options(self):
            """ Apply default options and validate options """
            options = self.options
    
            transcription_unit = options.get('transcription_unit', {})
    Severity: Minor
    Found in wc_model_gen/eukaryote/transcription.py - About 4 hrs 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 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def gen_kb_reactions(self):
            """ Generate reactions encoded within KB
            """
    
            kb = self.knowledge_base
    Severity: Minor
    Found in wc_model_gen/eukaryote/initialize_model.py - About 4 hrs 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_rate_law has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def gen_michaelis_menten_like_rate_law(model, reaction, modifiers=None, modifier_reactants=None, exclude_substrates=None):
        """ Generate a Michaelis-Menten-like rate law. For a multi-substrate reaction,  
            the substrate term is formulated as the multiplication of a Hill equation
            with a coefficient of 1 for each substrate. For multi-steps reaction where
            each step is catalyzed by a different enzyme, the enzyme term is formulated
    Severity: Minor
    Found in wc_model_gen/utils.py - About 3 hrs 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_rate_laws has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def gen_kb_rate_laws(self):
            """ Generate the rate laws for reactions encoded in the knowledge base """
            kb = self.knowledge_base
            model = self.model
    
    
    Severity: Minor
    Found in wc_model_gen/eukaryote/initialize_model.py - About 3 hrs 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

    File initalize_model.py has 318 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Initalize the construction of wc_lang-encoded models from wc_kb-encoded knowledge base.
    
    :Author: Balazs Szigeti <balazs.szigeti@mssm.edu>
    :Date: 2018-01-21
    :Copyright: 2018, Karr Lab
    Severity: Minor
    Found in wc_model_gen/prokaryote/initalize_model.py - About 3 hrs to fix

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

          def calibrate_submodel(self):
              """ Calibrate the submodel using data in the KB """
              
              model = self.model        
              cell = self.knowledge_base.cell
      Severity: Minor
      Found in wc_model_gen/eukaryote/protein_degradation.py - About 3 hrs 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_response_functions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def gen_response_functions(model, beta, reaction_id, reaction_class, compartment, reaction_factors):
              """ Generate a list of response function expression string for each factor or 
                  group of factors (F) in the form of:
                             
                              F/(Km + F)
      Severity: Minor
      Found in wc_model_gen/utils.py - About 3 hrs 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 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def calibrate_submodel(self):
              """ Calibrate the submodel using data in the KB """
              
              model = self.model        
              cell = self.knowledge_base.cell
      Severity: Minor
      Found in wc_model_gen/eukaryote/rna_degradation.py - About 3 hrs 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

      File metabolism.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """ Generator for metabolism submodels based on KBs for random in silico organisms
      
      :Author: Balazs Szigeti <balazs.szigeti@mssm.edu>
      :Author: Jonathan Karr <karr@mssm.edu>
      :Author: Ashwin Srinivasan <ashwins@mit.edu>
      Severity: Minor
      Found in wc_model_gen/prokaryote/metabolism.py - About 3 hrs to fix

        Function gen_parameters has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def gen_parameters(self):
                """ Generate parameters 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 2 hrs 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 clean_and_validate_options has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def clean_and_validate_options(self):
                """ Apply default options and validate options """
                options = self.options
        
                culture_volume = options.get('culture_volume', 1.)
        Severity: Major
        Found in wc_model_gen/eukaryote/initialize_model.py - About 2 hrs to fix

          Function gen_reactions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def gen_reactions(self):
                  """ Generate reactions associated with submodel 
                  
                  Exchange reactions for components in the media will be be created if they do 
                  not exist. The maximum and minimum flux bounds for exchange reactions will also be set.
          Severity: Major
          Found in wc_model_gen/eukaryote/metabolism.py - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                                    if codon == 'ATG':
                                        aa = model.species_types.get_one(id='met').species.get_one(compartment=cytosol)
                                    elif codon == 'ACT' or codon == 'ACC' or codon == 'ACA' or codon == 'ACG':
                                        aa = model.species_types.get_one(id='thr').species.get_one(compartment=cytosol)
                                    elif codon == 'ATT' or codon == 'ATC' or codon == 'ATA':
            Severity: Critical
            Found in wc_model_gen/prokaryote/translation.py - About 2 hrs to fix

              Function gen_reactions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def gen_reactions(self):
                      """ Generate reactions assocated with min model
              
                      Raises:
                          :obj:`ValueError:` if any phosphate species are missing from the model
              Severity: Minor
              Found in wc_model_gen/prokaryote/metabolism.py - About 2 hrs 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