LucaCappelletti94/ucsc_genomes_downloader

View on GitHub

Showing 12 of 12 total issues

File genome.py has 471 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (C) 2019 by
#   Luca Cappelletti <luca.cappelletti1@unimi.it>
#
# All rights reserved.
# MIT license.
Severity: Minor
Found in ucsc_genomes_downloader/genome.py - About 7 hrs to fix

    Function gaps has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def gaps(chrom: str, sequence: str):
        i = 0
        chromStart = None
        chunksize = 500
        max_chunk_size = 10000
    Severity: Minor
    Found in ucsc_genomes_downloader/utils/gaps.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

    Genome has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Genome:
        """Class to automatically retrieve informations and sequences for a Genome from the UCSC Genome Browser assembly database.
    
        Usage examples
        --------------
    Severity: Minor
    Found in ucsc_genomes_downloader/genome.py - About 3 hrs to fix

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

          def __init__(
              self,
              assembly: str,
              chromosomes: Tuple[str] = None,
              filters: Tuple[str] = ("chru", "chrmt", "scaffold", "contig", "super", "chrbin", "random", "hap", "alt", "fix"),
      Severity: Minor
      Found in ucsc_genomes_downloader/genome.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 _extract_sequences has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _extract_sequences(
      Severity: Major
      Found in ucsc_genomes_downloader/utils/extract_sequence.py - About 50 mins to fix

        Function extract_sequence has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def extract_sequence(chromosomes: Dict, chrom: str, chromStart: int, chromEnd: int, strand: str, mapping: Dict) -> str:
        Severity: Minor
        Found in ucsc_genomes_downloader/utils/extract_sequence.py - About 45 mins to fix

          Function extract_sequences has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def extract_sequences(
          Severity: Minor
          Found in ucsc_genomes_downloader/utils/extract_sequence.py - About 45 mins to fix

            Function aligned_tessellate_bed has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def aligned_tessellate_bed(chrom: str, chromStart: int, chromEnd: int, window_size: int, alignment: str) -> pd.DataFrame:
            Severity: Minor
            Found in ucsc_genomes_downloader/utils/tessellate_bed.py - About 35 mins to fix

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in ucsc_genomes_downloader/genome.py - About 35 mins to fix

                Function download_chromosome has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def download_chromosome(assembly: str, chromosome: str, start: int, end: int, path: str):
                Severity: Minor
                Found in ucsc_genomes_downloader/utils/ucsc.py - About 35 mins to fix

                  Function expand_bed_regions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def expand_bed_regions(bed: pd.DataFrame, window_size: int, alignment: str = "center") -> pd.DataFrame:
                      """Return pandas dataframe setting regions to given window size considering given alignment.
                  
                      Parameters
                      -----------------------
                  Severity: Minor
                  Found in ucsc_genomes_downloader/utils/expand_bed_regions.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

                  Function filled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def filled(self,  chromosomes: List[str] = None):
                          """Return dataframe with BED-like columns with informations on the gaps.
                  
                          Parameters
                          ----------
                  Severity: Minor
                  Found in ucsc_genomes_downloader/genome.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

                  Severity
                  Category
                  Status
                  Source
                  Language