vanheeringen-lab/gimmemotifs

View on GitHub

Showing 82 of 82 total issues

Function motifs has a Cognitive Complexity of 52 (exceeds 15 allowed). Consider refactoring.
Open

def motifs(args):
    """Calculate ROC_AUC and other metrics and optionally plot ROC curve."""
    if args.outdir is None:
        raise ValueError("an output directory is required!")
    if not os.path.exists(args.outdir):
Severity: Minor
Found in gimmemotifs/commands/motifs.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

Motif has 46 functions (exceeds 20 allowed). Consider refactoring.
Open

class Motif(object):

    """
    Representation of a transcription factor binding motif.

Severity: Minor
Found in gimmemotifs/motif/base.py - About 6 hrs to fix

    Function calc_stats_iterator has a Cognitive Complexity of 49 (exceeds 15 allowed). Consider refactoring.
    Open

    def calc_stats_iterator(
        fg_file=None,
        bg_file=None,
        fg_table=None,
        bg_table=None,
    Severity: Minor
    Found in gimmemotifs/stats.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 cluster_motifs has a Cognitive Complexity of 47 (exceeds 15 allowed). Consider refactoring.
    Open

    def cluster_motifs(
        motifs,
        match="total",
        metric="wic",
        combine="mean",
    Severity: Minor
    Found in gimmemotifs/motif/cluster.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 cli has 136 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def cli(sys_args):
        config = MotifConfig()
        params = config.get_default_params()
        default_pfm_file = os.path.join(config.get_motif_dir(), params["motif_db"])
        default_pfm = params["motif_db"]
    Severity: Major
    Found in gimmemotifs/cli.py - About 5 hrs to fix

      Function set_meanstd has a Cognitive Complexity of 41 (exceeds 15 allowed). Consider refactoring.
      Open

          def set_meanstd(self, gc=False):
              if not self.background:
                  self.set_background(gc=gc)
      
              self.meanstd = {}
      Severity: Minor
      Found in gimmemotifs/scanner/base.py - About 4 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function plot_ensembl_logo has a Cognitive Complexity of 37 (exceeds 15 allowed). Consider refactoring.
      Open

      def plot_ensembl_logo(self, fname=None, ic=True, title=True, letters=True, height=2):
          """Plot motif logo.
      
          This is an implementation of the logo presented here:
          http://www.ensembl.info/2018/10/15/new-ensembl-motif-features/
      Severity: Minor
      Found in gimmemotifs/motif/_plotting.py - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function parse has a Cognitive Complexity of 34 (exceeds 15 allowed). Consider refactoring.
      Open

          def parse(self, fo):
              """
              Convert MEME output to motifs
      
              Parameters
      Severity: Minor
      Found in gimmemotifs/tools/memew.py - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function parse has a Cognitive Complexity of 34 (exceeds 15 allowed). Consider refactoring.
      Open

          def parse(self, fo):
              """
              Convert MEME output to motifs
      
              Parameters
      Severity: Minor
      Found in gimmemotifs/tools/meme.py - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function moap has a Cognitive Complexity of 33 (exceeds 15 allowed). Consider refactoring.
      Open

      def moap(
          inputfile,
          method="hypergeom",
          scoring=None,
          outfile=None,
      Severity: Minor
      Found in gimmemotifs/maelstrom/moap.py - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      ExtraStyler has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ExtraStyler(Styler):
          """
          Extra styles for a DataFrame or Series based on pandas.styler using HTML and CSS.
          """
      
      
      Severity: Minor
      Found in gimmemotifs/report.py - About 3 hrs to fix

        Scanner has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Scanner(object):
            """
            scan sequences with motifs
            """
        
        
        Severity: Minor
        Found in gimmemotifs/scanner/base.py - About 2 hrs to fix

          MotifConfig has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MotifConfig(object):
              """Configuration object for the gimmemotifs module."""
          
              # Borg design pattern: all instances of this class will have the same attributes
              __shared_state = {}
          Severity: Minor
          Found in gimmemotifs/config.py - About 2 hrs to fix

            Function set_threshold has a Cognitive Complexity of 28 (exceeds 15 allowed). Consider refactoring.
            Open

                def set_threshold(self, fpr=None, threshold=None, gc=False):
                    """Set motif scanning threshold based on background sequences.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in gimmemotifs/scanner/base.py - About 2 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Function diff_plot has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def diff_plot(
                motifs,
                pwms,
                names,
                freq,
            Severity: Major
            Found in gimmemotifs/plot.py - About 2 hrs to fix

              Function get_all_scores has a Cognitive Complexity of 27 (exceeds 15 allowed). Consider refactoring.
              Open

                  def get_all_scores(
                      self,
                      motifs,
                      dbmotifs,
                      match,
              Severity: Minor
              Found in gimmemotifs/comparison.py - About 2 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function load_orthogroups_in_db has a Cognitive Complexity of 27 (exceeds 15 allowed). Consider refactoring.
              Open

              def load_orthogroups_in_db(db, genomes, orthofinder_result):
                  """
                  Save the results of orthofinder (tsv file) in a relational database
                  (SQLite). This makes it possible to easily switch between genes and
                  orthogroups.
              Severity: Minor
              Found in gimmemotifs/orthologs.py - About 2 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function set_background has a Cognitive Complexity of 26 (exceeds 15 allowed). Consider refactoring.
              Open

                  def set_background(
                      self, fname=None, genome=None, size=200, nseq=None, gc=False, gc_bins=None
                  ):
                      """Set the background to use for FPR and z-score calculations.
              
              
              Severity: Minor
              Found in gimmemotifs/scanner/base.py - About 2 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function compare_motifs has a Cognitive Complexity of 25 (exceeds 15 allowed). Consider refactoring.
              Open

                  def compare_motifs(
                      self, m1, m2, match="total", metric="wic", combine="mean", pval=False
                  ):
                      """Compare two motifs.
              
              
              Severity: Minor
              Found in gimmemotifs/comparison.py - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function make_motif2factors has a Cognitive Complexity of 25 (exceeds 15 allowed). Consider refactoring.
              Open

              def make_motif2factors(
                  prefix,
                  new_reference,
                  database_references,
                  motifsandfactors,
              Severity: Minor
              Found in gimmemotifs/orthologs.py - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

              Severity
              Category
              Status
              Source
              Language