BjornFJohansson/pydna

View on GitHub

Showing 219 of 219 total issues

Dseq has 47 functions (exceeds 20 allowed). Consider refactoring.
Open

class Dseq(_Seq):
    """Dseq holds information for a double stranded DNA fragment.

    Dseq also holds information describing the topology of
    the DNA fragment (linear or circular).
Severity: Minor
Found in src/pydna/dseq.py - About 6 hrs to fix

    Dseqrecord has 47 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Dseqrecord(_SeqRecord):
        """Dseqrecord is a double stranded version of the Biopython SeqRecord [#]_ class.
        The Dseqrecord object holds a Dseq object describing the sequence.
        Additionally, Dseqrecord hold meta information about the sequence in the
        from of a list of SeqFeatures, in the same way as the SeqRecord does.
    Severity: Minor
    Found in src/pydna/dseqrecord.py - About 6 hrs to fix

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

      class ExactPosition(_ExactPosition):
          def __copy__(self):
              c = empty_copy(self)
              c.__dict__ = self.__dict__
              return c
      Severity: Major
      Found in scripts/biosubclasses.py and 2 other locations - About 6 hrs to fix
      scripts/biosubclasses.py on lines 48..60
      scripts/biosubclasses.py on lines 63..75

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

      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

      class SimpleLocation(_SimpleLocation):
          def __copy__(self):
              c = empty_copy(self)
              c.__dict__ = self.__dict__
              return c
      Severity: Major
      Found in scripts/biosubclasses.py and 2 other locations - About 6 hrs to fix
      scripts/biosubclasses.py on lines 33..45
      scripts/biosubclasses.py on lines 63..75

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

      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

      class SeqFeature(_SeqFeature):
          def __copy__(self):
              c = empty_copy(self)
              c.__dict__ = self.__dict__
              return c
      Severity: Major
      Found in scripts/biosubclasses.py and 2 other locations - About 6 hrs to fix
      scripts/biosubclasses.py on lines 33..45
      scripts/biosubclasses.py on lines 48..60

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

      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

      File amplify.py has 427 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python3
      # -*- coding: utf-8 -*-
      # Copyright 2013-2023 by Björn Johansson.  All rights reserved.
      # This code is part of the Python-dna distribution and governed by its
      # license.  Please see the LICENSE.txt file that should have been included
      Severity: Minor
      Found in src/pydna/amplify.py - About 6 hrs to fix

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

            def __init__(
                self,
                watson,
                crick=None,
                ovhg=None,
        Severity: Minor
        Found in src/pydna/dseq.py - About 5 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            def run(
                self,
                till_len=0.75,  # percent of gel_len
                till_time=None,  # hours
                exposure=0.5,  # [0-1]
        Severity: Minor
        Found in scripts/gel/gel_old.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

        SeqRecord has 40 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class SeqRecord(_SeqRecord):
            """
            A subclass of the Biopython SeqRecord class.
        
            Has a number of extra methods and uses
        Severity: Minor
        Found in src/pydna/seqrecord.py - About 5 hrs to fix

          Function eq has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          def eq(*args, **kwargs):
              """Compare two or more DNA sequences for equality.
          
              Compares two or more DNA sequences for equality i.e. if they
              represent the same double stranded DNA molecule.
          Severity: Minor
          Found in src/pydna/utils.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

          File assembly.py has 380 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #!/usr/bin/env python3
          # -*- coding: utf-8 -*-
          # Copyright 2013-2023 by Björn Johansson.  All rights reserved.
          # This code is part of the Python-dna distribution and governed by its
          # license.  Please see the LICENSE.txt file that should have been included
          Severity: Minor
          Found in src/pydna/assembly.py - About 5 hrs to fix

            Function map_trace_files has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                def map_trace_files(self, pth, limit=25):  # TODO allow path-like objects
                    import glob
            
                    traces = []
                    for name in glob.glob(pth):
            Severity: Minor
            Found in src/pydna/dseqrecord.py - About 5 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function assemble_circular has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                def assemble_circular(self, length_bound=None):
                    cps = {}  # circular assembly
                    cpsrc = {}
                    cpaths = sorted(_nx.simple_cycles(self.G, length_bound=length_bound), key=len)
                    cpaths_sorted = []
            Severity: Minor
            Found in src/pydna/assembly.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

            File genbankfixer.py has 377 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #!/usr/bin/env python3
            # -*- coding: utf-8 -*-
            # Copyright 2013-2023 by Björn Johansson.  All rights reserved.
            # This code is part of the pydna distribution and governed by its
            # license.  Please see the LICENSE.txt file that should have been included
            Severity: Minor
            Found in src/pydna/genbankfixer.py - About 5 hrs to fix

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

                          if noise is None or noise <= 0:
                              rgb_arr += back_col
                          else:
                              bckg = _np.random.normal(back_col, noise, (len(rgb_arr), len(rgb_arr[0])))
                              rgb_arr += bckg[:, :, _np.newaxis]
              Severity: Major
              Found in scripts/gel/gel2.py and 1 other location - About 4 hrs to fix
              scripts/gel/gel_old.py on lines 1037..1041

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

              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 noise is None or noise <= 0:
                      rgb_arr += back_col
                  else:
                      bckg = _np.random.normal(back_col, noise, (len(rgb_arr), len(rgb_arr[0])))
                      rgb_arr += bckg[:, :, _np.newaxis]
              Severity: Major
              Found in scripts/gel/gel_old.py and 1 other location - About 4 hrs to fix
              scripts/gel/gel2.py on lines 473..477

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

              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

                  vWBR = lambda L, muS, muL, gamma: (1 / muS + (1 / muL - 1 / muS) * (1 - _np.exp(-L / gamma))) ** -1
              Severity: Major
              Found in scripts/gel/gel_old.py and 1 other location - About 4 hrs to fix
              scripts/gel/gel2.py on lines 245..245

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

              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

                      vWBR = lambda L, muS, muL, gamma: (1 / muS + (1 / muL - 1 / muS) * (1 - _np.exp(-L / gamma))) ** -1
              Severity: Major
              Found in scripts/gel/gel2.py and 1 other location - About 4 hrs to fix
              scripts/gel/gel_old.py on lines 845..845

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

              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

                  return (lp * L / 3 * (1 - lp / L + lp / L * _np.exp(-L / lp))) ** (1 / 2)
              Severity: Major
              Found in scripts/gel/gel_old.py and 1 other location - About 4 hrs to fix
              scripts/gel/gel2.py on lines 174..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 77.

              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

              Ogston_Rouse = lambda Nbp, kB, T, a, eta, b, l: kB * T * a**3 / (eta * b**2 * l**2 * Nbp**2)
              Severity: Major
              Found in scripts/gel/gel2.py and 1 other location - About 4 hrs to fix
              scripts/gel/gel_old.py on lines 498..498

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

              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