KarrLab/intro_to_wc_modeling

View on GitHub

Showing 135 of 135 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        for part in rxn.participants:
            if part.species.type == 'Protein':
                initCopyNumber = mdl.speciesCounts[part.species.index, part.compartment.index]
intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 44..46
intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 64..66

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        for part in rxn.participants:
            if part.species.type == 'RNA':
                initCopyNumber = mdl.speciesCounts[part.species.index, part.compartment.index]
intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 44..46
intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 54..56

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        for part in rxn.participants:
            if part.species.type == 'RNA':
                initCopyNumber = mdl.speciesCounts[part.species.index, part.compartment.index]
intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 54..56
intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 64..66

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main():
    # create a figure with 2x1 subplots
    fig, axes = pyplot.subplots(nrows=2, ncols=1)

    # plot data on the subplots

    Function main has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(init_concs=None):
        """ Run dFBA simsulation, plot results, and save plots
    
        Args:
            init_concs (:obj:`dict`, optional): initial concentrations
    Severity: Minor
    Found in intro_to_wc_modeling/cell_modeling/simulation/dfba.py - About 1 hr 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 main has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def main(init_concs=None):
        """ Run dFBA simsulation, plot results, and save plots
    
        Args:
            init_concs (:obj:`dict`, optional): initial concentrations
    Severity: Minor
    Found in intro_to_wc_modeling/cell_modeling/simulation/dfba.py - About 1 hr to fix

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          analysis.plot(
              model=submdl,
              time=time,
              volume=volume,
              speciesCounts=speciesCounts,
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/simulation.py on lines 181..188
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/simulation.py on lines 191..198

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 43.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          analysis.plot(
              model=mdl,
              time=time,
              volume=volume,
              speciesCounts=speciesCounts,
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/simulation.py on lines 181..188
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 154..161

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 43.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          analysis.plot(
              model=submdl,
              time=time,
              volume=volume,
              speciesCounts=speciesCounts,
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/simulation.py on lines 171..178

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 43.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          analysis.plot(
              model=mdl,
              time=time,
              volume=volume,
              speciesCounts=speciesCounts,
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/simulation.py on lines 191..198
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 154..161

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 43.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          analysis.plot(
              model=mdl,
              time=time,
              volume=volume,
              speciesCounts=speciesCounts,
      intro_to_wc_modeling/cell_modeling/simulation/multi_algorithm/submodel_simulation.py on lines 144..151

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 43.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, id='', name='', submodel='', reversible=None, participants=[],

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                axes[1].set_ylim([numpy.min(n) - 5, numpy.max(n) + 5])
        intro_to_wc_modeling/cell_modeling/simulation/mrna_and_proteins_using_several_methods.py on lines 928..928

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                axes[1].set_ylim([numpy.min(n) - 5, numpy.max(n) + 5])
        intro_to_wc_modeling/cell_modeling/simulation/mrna_and_proteins_using_several_methods.py on lines 866..866

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 42.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function insert_records has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def insert_records(session):
            # create homo sapiens organism with one reaction
            organism = Organism(ncbi_id=9606, name='Homo sapiens')
            session.add(organism)
        
        

          Function main has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def main(out_dir=None):
              """ Simulate individual models and combined model, plot results, and save plots
          
              Args:
                  out_dir (:obj:`str`, optional): path to directory to save results
          Severity: Minor
          Found in intro_to_wc_modeling/cell_modeling/model_composition.py - About 1 hr to fix

            Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, id='', name='', structure='', empiricalFormula='', molecularWeight=None,

              Function d_conc_d_t has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def d_conc_d_t(concs, time):
                  """ Calculate differentials for Goldbeter 1991 cell cycle model
                  (`BIOMD0000000003 <http://www.ebi.ac.uk/biomodels-main/BIOMD0000000003>`_)
              
                  Args:
              Severity: Minor
              Found in intro_to_wc_modeling/cell_modeling/simulation/ode.py - About 1 hr to fix

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    def dGLCi_dt(self, x):
                        return 1.0 * self.v_14(x) - 1.0 * self.v_1(x)
                Severity: Major
                Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 7 other locations - About 1 hr to fix
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 357..358
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 360..361
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 363..364
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 378..379
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 381..382
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 384..385
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 387..388

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 40.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    def dF6P_dt(self, x):
                        return 1.0 * self.v_2(x) - 1.0 * self.v_5(x)
                Severity: Major
                Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 7 other locations - About 1 hr to fix
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 357..358
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 360..361
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 369..370
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 378..379
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 381..382
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 384..385
                intro_to_wc_modeling/cell_modeling/model_composition.py on lines 387..388

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 40.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language