vanheeringen-lab/gimmemotifs

View on GitHub
gimmemotifs/orthologs.py

Summary

Maintainability
C
7 hrs
Test Coverage
F
13%

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

Function motif2factor_from_orthologs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def motif2factor_from_orthologs(
    database: str = "gimme.vertebrate.v5.0",
    database_references: List[str] = None,
    extra_orthologs_references: List[str] = None,
    new_reference: List[str] = None,
Severity: Minor
Found in gimmemotifs/orthologs.py - About 1 hr to fix

    Function _unknownfactor2symbols has a Cognitive Complexity of 20 (exceeds 15 allowed). Consider refactoring.
    Open

    def _unknownfactor2symbols(factor, fields):
        """
        Query mygeneinfo for different aliases of our gene
        """
    
    
    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

    Avoid deeply nested control flow statements.
    Open

                        if len(res):
                            for _, gene_name, _, gene_id, *_ in res:
                                motif_set = True
                                if gene_name is not None:
                                    f.write(f"{motif}\t{gene_name}\tOrthologs\tN\n")
    Severity: Major
    Found in gimmemotifs/orthologs.py - About 45 mins to fix

      Function factor2orthogroups has a Cognitive Complexity of 16 (exceeds 15 allowed). Consider refactoring.
      Open

      def factor2orthogroups(factor, references, database, strategy):
          """
          Returns all the orthogroups a factor belongs to. This is NOT a trivial task.
      
          Some of the factors shouldn't be considered (blacklisted), some have an
      Severity: Minor
      Found in gimmemotifs/orthologs.py - About 25 mins 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

      There are no issues that match your filters.

      Category
      Status