KarrLab/rand_wc_model_gen

View on GitHub

Showing 46 of 46 total issues

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

                        tu = self.knowledge_base.cell.loci.get_or_create(
                            id='tu_{}_{}'.format(i_chr + 1, i_gene + 1), __type=wc_kb.prokaryote.TranscriptionUnitLocus)
Severity: Major
Found in rand_wc_model_gen/kb_gen/genome.py and 3 other locations - About 1 hr to fix
rand_wc_model_gen/kb_gen/genome.py on lines 215..216
rand_wc_model_gen/kb_gen/genome.py on lines 355..356
rand_wc_model_gen/kb_gen/genome.py on lines 406..407

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

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 plot has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def plot(model, results, filename):
    """ plot simulation results of the hard-coded rna model

    """

Severity: Minor
Found in rand_wc_model_gen/model_gen/core.py - About 1 hr to fix

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

                seq = Seq.Seq(''.join(random.choice(('A', 'C', 'G', 'T'), p=((1 - mean_gc_frac) / 2, mean_gc_frac /
                                                                             2, mean_gc_frac / 2, (1 - mean_gc_frac) / 2), size=(seq_len, ))), Alphabet.DNAAlphabet())
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/chrs_genes_tus.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/kb_gen/genome.py on lines 173..174

    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

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

            model = wc_lang.io.Reader().run(config['model']['path'])[wc_lang.Model][0]
    Severity: Major
    Found in rand_wc_model_gen/__main__.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/__main__.py on lines 96..96

    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

            PROB_BASES = [(1 - mean_gc_frac) / 2, mean_gc_frac /
                          2, mean_gc_frac/2, (1-mean_gc_frac)/2]
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/genome.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/kb_gen/chrs_genes_tus.py on lines 81..82

    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

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

            model = wc_lang.io.Reader().run(config['model']['path'])[wc_lang.Model][0]
    Severity: Major
    Found in rand_wc_model_gen/__main__.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/__main__.py on lines 131..131

    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

                if not math.isnan(met['Extracellular concentration (M)']):
                    cell.concentrations.get_or_create(
                        species=met_species,
                        value=met['Extracellular concentration (M)'])
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/metabolites.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/kb_gen/metabolites.py on lines 59..62

    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

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

                if not math.isnan(met['Intracellular concentration (M)']):
                    cell.concentrations.get_or_create(
                        species=met_species,
                        value=met['Intracellular concentration (M)'])
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/metabolites.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/kb_gen/metabolites.py on lines 68..71

    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

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

                    gene = cell.loci.get_or_create(id='gene_{}_{}'.format(
                        i_chr + 1, i_gene + 1), __type=wc_kb.prokaryote.GeneLocus)
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/chrs_genes_tus.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/kb_gen/chrs_genes_tus.py on lines 94..95

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

                    tu = cell.loci.get_or_create(id='tu_{}_{}'.format(
                        i_chr + 1, i_gene + 1), __type=wc_kb.prokaryote.TranscriptionUnitLocus)
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/chrs_genes_tus.py and 1 other location - About 1 hr to fix
    rand_wc_model_gen/kb_gen/chrs_genes_tus.py on lines 104..105

    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

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

            axes.set_xlim([time[0] / 3600, time[-1] / 3600])
    Severity: Minor
    Found in rand_wc_model_gen/analysis/sim/rna.py and 1 other location - About 50 mins to fix
    rand_wc_model_gen/analysis/sim/rna.py on lines 63..63

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

    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.set_xlim([time[0] / 3600, time[-1] / 3600])
    Severity: Minor
    Found in rand_wc_model_gen/analysis/sim/rna.py and 1 other location - About 50 mins to fix
    rand_wc_model_gen/analysis/sim/rna.py on lines 41..41

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

    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

            rna_ids = [st.id + '[c]' for st in self.model.species_types if st.id.startswith('rna_')]
    Severity: Minor
    Found in rand_wc_model_gen/analysis/sim/rna.py and 1 other location - About 45 mins to fix
    rand_wc_model_gen/analysis/sim/rna.py on lines 52..52

    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

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

            rna_ids = [st.id + '[c]' for st in self.model.species_types if st.id.startswith('rna_')]
    Severity: Minor
    Found in rand_wc_model_gen/analysis/sim/rna.py and 1 other location - About 45 mins to fix
    rand_wc_model_gen/analysis/sim/rna.py on lines 35..35

    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

    Avoid deeply nested control flow statements.
    Open

                            if five_prime_start < 0:
                                five_prime_start = 0
                            tu.genes.append(gene)
    Severity: Major
    Found in rand_wc_model_gen/kb_gen/genome.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if three_prime_end >= len(seq):
                                  three_prime_end = len(seq) - 1
                              tu = self.knowledge_base.cell.loci.get_or_create(
      Severity: Major
      Found in rand_wc_model_gen/kb_gen/genome.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                while operon_genes <= 1:
                                    operon_genes = self.rand(operon_gen_num)[0]
        
                                # add 3', 5' UTRs to the ends of the transcription unit (upstream of first gene, downstream of last gene)
                                tu = self.knowledge_base.cell.loci.get_or_create(
        Severity: Major
        Found in rand_wc_model_gen/kb_gen/genome.py - About 45 mins to fix

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

                      met_species = wc_kb.core.Species(
                          species_type=met_species_type,
                          compartment=cell.compartments.get_or_create(
                              __type=wc_kb.core.Compartment, id='c'))
          Severity: Minor
          Found in rand_wc_model_gen/kb_gen/metabolites.py and 1 other location - About 45 mins to fix
          rand_wc_model_gen/kb_gen/metabolites.py on lines 64..67

          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

          Avoid deeply nested control flow statements.
          Open

                                  for gene in tu.genes:
                                      # creates ProteinSpecipe object for corresponding protein sequence(s)
                                      # print(gene.get_seq()[0:3])
                                      prot = cell.species_types.get_or_create(
                                          id='prot_{}'.format(gene.id), __type=wc_kb.prokaryote.ProteinSpeciesType)
          Severity: Major
          Found in rand_wc_model_gen/kb_gen/genome.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for k in range(operon_genes-1):
            
                                        i_gene += 1
            
                                        if i_gene >= len(chromosome.loci):
            Severity: Major
            Found in rand_wc_model_gen/kb_gen/genome.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language