KarrLab/wc_model_gen

View on GitHub
wc_model_gen/eukaryote/complexation.py

Summary

Maintainability
F
1 wk
Test Coverage
A
97%

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

    def gen_reactions(self):
        """ Generate reactions associated with submodel """
        model = self.model
        cell = self.knowledge_base.cell

Severity: Minor
Found in wc_model_gen/eukaryote/complexation.py - About 4 days 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 determine_initial_concentration has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def determine_initial_concentration(self):
        """ Estimate the initial concentrations of complex species using the following steps: 

            1) For each complex species, calculate the maximum possible copy number by taking the minimum
               of the availability of each subunit, which is determined as the ratio of
Severity: Minor
Found in wc_model_gen/eukaryote/complexation.py - About 6 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 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 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

    Avoid deeply nested control flow statements.
    Open

                            if model.distribution_init_concentrations.get_one(species=participant.species).mean <= \
                                subunit_equilibrium_level[participant.species]:
                                if reaction not in for_removal:
                                    for_removal.append(reaction)
                
    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

                                if type(compl_subunit.species_type) == wc_kb.eukaryote.ProteinSpeciesType:                            
                                    
                                    model_rxn = model.reactions.create(
                                        submodel=self.submodel,
                                        id='{}_dissociation_in_{}_degrade_{}'.format(
        Severity: Major
        Found in wc_model_gen/eukaryote/complexation.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_subunit_species.species_type.type != wc_ontology['WC:metabolite']:
                                        self._maximum_possible_amount[model_compl_species.id].append(
                                            model_subunit_species.distribution_init_concentration.mean / subunit_coefficient)
            
            
            Severity: Major
            Found in wc_model_gen/eukaryote/complexation.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if species_init_conc:
                                          species_init_conc.mean += flux * participant.coefficient
                                          
                                      else:
                                          conc_model = model.distribution_init_concentrations.create(
              Severity: Major
              Found in wc_model_gen/eukaryote/complexation.py - About 45 mins to fix

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

                                                        for aa in protein_seq:
                                                            aa_id = amino_acid_id_conversion[aa]
                                                            if aa_id not in aa_content:
                                                                aa_content[aa_id] = 1
                                                                gvar.protein_aa_usage[subunit.species_type.id][aa] = 1
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 6 hrs to fix
                wc_model_gen/eukaryote/translation_translocation.py on lines 297..304

                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 100.

                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 met in metabolic_participants:
                            met_species_type = model.species_types.get_one(id=met)
                            metabolites[met] = {
                                'c': met_species_type.species.get_or_create(compartment=cytoplasm, model=model),
                                'm': met_species_type.species.get_or_create(compartment=mitochondrion, model=model)
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 2 other locations - About 3 hrs to fix
                wc_model_gen/eukaryote/rna_degradation.py on lines 67..71
                wc_model_gen/eukaryote/transcription.py on lines 175..179

                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 64.

                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

                                                    if subunit.species_type.id in gvar.protein_aa_usage:                                        
                                                        for aa, aa_id in amino_acid_id_conversion.items():
                                                            if gvar.protein_aa_usage[subunit.species_type.id][aa]:
                                                                aa_content[aa_id] = gvar.protein_aa_usage[subunit.species_type.id][aa]
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 3 hrs to fix
                wc_model_gen/eukaryote/translation_translocation.py on lines 281..284

                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 64.

                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

                                            model_rxn = model.reactions.create(
                                                submodel=self.submodel,
                                                id='{}_dissociation_in_{}_degrade_{}'.format(
                                                    compl.id, compl_compartment.id, compl_subunit.species_type.id),
                                                name='Dissociation of {} in {} and degradation of {}'.format(
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 2 hrs to fix
                wc_model_gen/eukaryote/complexation.py on lines 239..244

                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 58.

                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

                                            model_rxn = model.reactions.create(
                                                submodel=self.submodel,
                                                id='{}_dissociation_in_{}_degrade_{}'.format(
                                                    compl.id, compl_compartment.id, compl_subunit.species_type.id),
                                                name='Dissociation of {} in {} and degradation of {}'.format(
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 2 hrs to fix
                wc_model_gen/eukaryote/complexation.py on lines 154..159

                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 58.

                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 3 locations. Consider refactoring.
                Open

                                                        if subunit.species_type.transcript.gene.id in selenoproteome:
                                                            processed_seq = raw_seq[:-1] if raw_seq.endswith('*') else raw_seq
                                                            protein_seq = ''.join(i if i!='*' else 'U' for i in processed_seq)
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 2 other locations - About 2 hrs to fix
                wc_model_gen/eukaryote/protein_degradation.py on lines 99..101
                wc_model_gen/eukaryote/translation_translocation.py on lines 292..294

                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 55.

                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 5 locations. Consider refactoring.
                Open

                                diss_k_cat = model.parameters.create(id='k_cat_{}'.format(reaction.id),
                                    type=wc_ontology['WC:k_cat'],
                                    units=unit_registry.parse_units('molecule^-1 s^-1'))
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 4 other locations - About 1 hr to fix
                wc_model_gen/eukaryote/transcription.py on lines 1050..1053
                wc_model_gen/eukaryote/translation_translocation.py on lines 980..983
                wc_model_gen/eukaryote/translation_translocation.py on lines 1056..1059
                wc_model_gen/prokaryote/metabolism.py on lines 165..167

                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 41.

                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 4 locations. Consider refactoring.
                Open

                                                    model_rxn.participants.add(metabolites['amp'][
                                                        degradation_comp_id].species_coefficients.get_or_create(
                                                        coefficient=ntp_count['A']))
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 3 other locations - About 1 hr to fix
                wc_model_gen/eukaryote/complexation.py on lines 285..287
                wc_model_gen/eukaryote/complexation.py on lines 288..290
                wc_model_gen/eukaryote/complexation.py on lines 291..293

                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 39.

                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 4 locations. Consider refactoring.
                Open

                                                    model_rxn.participants.add(metabolites['ump'][
                                                        degradation_comp_id].species_coefficients.get_or_create(
                                                        coefficient=ntp_count['U']))
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 3 other locations - About 1 hr to fix
                wc_model_gen/eukaryote/complexation.py on lines 282..284
                wc_model_gen/eukaryote/complexation.py on lines 285..287
                wc_model_gen/eukaryote/complexation.py on lines 288..290

                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 39.

                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

                                                    model_rxn.participants.add(
                                                        h2o.species_coefficients.get_or_create(
                                                        coefficient=-(sum(aa_content.values())-1)))                                   
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 1 hr to fix
                wc_model_gen/eukaryote/protein_degradation.py on lines 147..149

                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 39.

                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

                                        species = model.species_types.get_one(
                                            id=param.id.split('_')[-1]).species.get_one(
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 1 hr to fix
                wc_model_gen/eukaryote/translation_translocation.py on lines 1063..1064

                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 39.

                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 4 locations. Consider refactoring.
                Open

                                                    model_rxn.participants.add(metabolites['cmp'][
                                                        degradation_comp_id].species_coefficients.get_or_create(
                                                        coefficient=ntp_count['C']))
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 3 other locations - About 1 hr to fix
                wc_model_gen/eukaryote/complexation.py on lines 282..284
                wc_model_gen/eukaryote/complexation.py on lines 288..290
                wc_model_gen/eukaryote/complexation.py on lines 291..293

                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 39.

                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 4 locations. Consider refactoring.
                Open

                                                    model_rxn.participants.add(metabolites['gmp'][
                                                        degradation_comp_id].species_coefficients.get_or_create(
                                                        coefficient=ntp_count['G']))
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 3 other locations - About 1 hr to fix
                wc_model_gen/eukaryote/complexation.py on lines 282..284
                wc_model_gen/eukaryote/complexation.py on lines 285..287
                wc_model_gen/eukaryote/complexation.py on lines 291..293

                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 39.

                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

                                rate_law_exp, error = wc_lang.RateLawExpression.deserialize(expression, {
                                    wc_lang.Parameter: {diss_k_cat.id: diss_k_cat},
                                    wc_lang.Species: {complex_species.id: complex_species},
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 1 hr to fix
                wc_model_gen/eukaryote/translation_translocation.py on lines 1437..1439

                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 39.

                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

                                                    if subunit_coefficient > 1:
                                                        model_rxn.participants.add(
                                                            model_subunit_species.species_coefficients.get_or_create(
                                                            coefficient=subunit_coefficient-1))
                Severity: Minor
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 55 mins to fix
                wc_model_gen/eukaryote/complexation.py on lines 298..301

                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 37.

                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

                                compl_compartment_id = reaction.id[reaction.id.index('_in_') + 4 : 
                                    reaction.id.index('_degrade')]
                Severity: Minor
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 55 mins to fix
                wc_model_gen/eukaryote/complexation.py on lines 375..376

                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 37.

                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

                                                    if subunit_coefficient > 1:
                                                        model_rxn.participants.add(
                                                            model_subunit_species.species_coefficients.get_or_create(
                                                            coefficient=subunit_coefficient-1))
                Severity: Minor
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 55 mins to fix
                wc_model_gen/eukaryote/complexation.py on lines 227..230

                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 37.

                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

                                compl_compartment_id = reaction.id[reaction.id.index('_in_') + 4 : 
                                    reaction.id.index('_degrade')]
                Severity: Minor
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 55 mins to fix
                wc_model_gen/eukaryote/complexation.py on lines 330..331

                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 37.

                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

                                                        gvar.protein_aa_usage[subunit.species_type.id] = {
                                                            i:0 for i in list(amino_acid_id_conversion.keys())}
                Severity: Minor
                Found in wc_model_gen/eukaryote/complexation.py and 1 other location - About 45 mins to fix
                wc_model_gen/eukaryote/translation_translocation.py on lines 286..286

                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 35.

                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 12 locations. Consider refactoring.
                Open

                        Avogadro = model.parameters.get_or_create(
                            id='Avogadro',
                            type=None,
                            value=scipy.constants.Avogadro,
                            units=unit_registry.parse_units('molecule mol^-1'))
                Severity: Major
                Found in wc_model_gen/eukaryote/complexation.py and 11 other locations - About 40 mins to fix
                wc_model_gen/eukaryote/transcription.py on lines 1095..1099
                wc_model_gen/eukaryote/translation_translocation.py on lines 1387..1391
                wc_model_gen/prokaryote/protein_degradation.py on lines 131..135
                wc_model_gen/prokaryote/rna_degradation.py on lines 107..111
                wc_model_gen/prokaryote/transcription.py on lines 105..109
                wc_model_gen/prokaryote/translation.py on lines 167..171
                wc_model_gen/utils.py on lines 210..214
                wc_model_gen/utils.py on lines 255..259
                wc_model_gen/utils.py on lines 343..347
                wc_model_gen/utils.py on lines 432..436
                wc_model_gen/utils.py on lines 514..518

                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 34.

                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

                There are no issues that match your filters.

                Category
                Status