KarrLab/datanator

View on GitHub

Showing 376 of 791 total issues

File sabio_rk.py has 1466 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""
:Author: Yosef Roth <yosefdroth@gmail.com>
:Author: Jonathan Karr <jonrkarr@gmail.com>
Severity: Major
Found in datanator/data_source/sabio_rk.py - About 3 days to fix

    Function gen_bpform has a Cognitive Complexity of 163 (exceeds 5 allowed). Consider refactoring.
    Open

        def gen_bpform(self, protein, pro_ids_to_bpform_monomers, monomer_codes,
                       apply_processing=True, apply_modifications=True, include_annotations=True):
            """ Generate BpForm for a modified protein in PRO
    
            Args:
    Severity: Minor
    Found in datanator/data_source/protein_modification/pro.py - About 3 days 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 sabio_rk_nosql.py has 1090 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import datanator.config.core
    from datanator.util import mongo_util
    from datanator.util import file_util, chem_util
    from datanator.util import molecule_util
    import requests
    Severity: Major
    Found in datanator/data_source/sabio_rk_nosql.py - About 2 days to fix

      Function make_doc has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring.
      Open

          def make_doc(self, file_names, file_dict):
      
              os.makedirs(os.path.dirname(
                self.cache_directory + 'docs/'), exist_ok=True)
              null = None
      Severity: Minor
      Found in datanator/data_source/sabio_rk_json_mongo.py - About 2 days 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 77 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, in_obo_filename=None, in_tsv_filename=None, in_monomers_filename=None, max_num_proteins=None,
                  out_tsv_filename=None):
              """ Download PRO ontology, generate proteoforms, and encode with BpForms
      
              Args:
      Severity: Minor
      Found in datanator/data_source/protein_modification/pro.py - About 1 day 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 sabio_rk_json_mongo.py has 652 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      '''Parse SabioRk json files into MongoDB documents
          (json files acquired by running sqlite_to_json.py)
      :Author: Zhouyang Lian <zhouyang.lian@familian.life>
      :Author: Jonathan <jonrkarr@gmail.com>
      :Date: 2019-04-02
      Severity: Major
      Found in datanator/data_source/sabio_rk_json_mongo.py - About 1 day to fix

        Function parse_protein has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_protein(self, protein):
                """ Parse the modification information from a term for a modified protein
        
                Args:
                    protein (:obj:`dict`): term for a modified protein
        Severity: Minor
        Found in datanator/data_source/protein_modification/pro.py - About 1 day 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 build_rna_observation has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_rna_observation(self, obj):
                """Build RNA observation object from rna_haflife_new collection.
        
                Args:
                    obj(:obj:`Obj`): object to be transformed.
        Severity: Minor
        Found in datanator/schema_2/transform.py - About 1 day 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 pro.py has 605 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """ Generate BpForms for all of the proteins in PRO, verify
        them, and calculate their properties
        
        :Author: Jonathan Karr <karr@mssm.edu>
        :Date: 2019-06-24
        Severity: Major
        Found in datanator/data_source/protein_modification/pro.py - About 1 day to fix

          File __main__.py has 593 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """ Command line utilities
          
          :Author: Yosef Roth <yosefdroth@gmail.com>
          :Author: Jonathan Karr <jonrkarr@gmail.com>
          :Author: Saahith Pochiraju <saahith116@gmail.com>
          Severity: Major
          Found in datanator/__main__.py - About 1 day to fix

            Function get_strain_info has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_strain_info(sample):
                """
                Get information about the refernce genome that should be used for a given sample
            
                    Args:
            Severity: Minor
            Found in datanator/data_source/array_express_tools/ensembl_tools.py - About 1 day 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 normalize_parameter_value has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
            Open

                def normalize_parameter_value(self, name, type, value, error, units, enzyme_molecular_weight):
                    """
                    Args:
                        name (:obj:`str`): parameter name
                        type (:obj:`int`) parameter type (SBO term id)
            Severity: Minor
            Found in datanator/data_source/sabio_rk.py - About 1 day 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 normalize_parameter_value has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

                def normalize_parameter_value(self, name, type, value, error, units, enzyme_molecular_weight):
                    """
                    Args:
                        name (:obj:`str`): parameter name
                        type (:obj:`int`) parameter type (SBO term id)
            Severity: Minor
            Found in datanator/data_source/sabio_rk_nosql.py - About 1 day 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_compounds has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

                def load_compounds(self, compounds=None):
                    """ Download information from SABIO-RK about all of the compounds stored in the local sqlite copy of SABIO-RK
            
                    Args:
                        compounds (:obj:`list` of :obj:`Compound`): list of compounds to download
            Severity: Minor
            Found in datanator/data_source/sabio_rk.py - About 1 day 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 data_model.py has 490 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            :Author: Jonathan Karr <jonrkarr@gmail.com>
            :Author: Yosef Roth <yosefdroth@gmail.com>
            :Date: 2017-04-10
            :Copyright: 2017, Karr Lab
            Severity: Minor
            Found in datanator/core/data_model.py - About 7 hrs to fix

              Function parse_content has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_content(self, ec_code, ec_data, type, val):
                      if type == 'PR':
                          match = re.match((
                              r'^#(\d+)#'
                              r'[ \n](.*?)'
              Severity: Minor
              Found in datanator/data_source/brenda/core.py - About 7 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 data_source.py has 480 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """
              :Author: Jonathan Karr <jonrkarr@gmail.com>
              :Date: 2017-05-08
              :Copyright: 2017, Karr Lab
              :License: MIT
              Severity: Minor
              Found in datanator/core/data_source.py - About 7 hrs to fix

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

                    def run(self, raw_filename=None, processed_filename=None, max_entries=None):
                        raw_filename = raw_filename or self.RAW_FILENAME
                        processed_filename = str(Path(processed_filename).expanduser()) or self.PROCESSED_FILENAME
                        max_entries = max_entries or self.MAX_ENTRIES
                
                
                Severity: Minor
                Found in datanator/data_source/brenda/core.py - About 7 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 transform.py has 462 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from datanator_query_python.util import mongo_util
                from datanator_query_python.config import config
                import copy
                import numpy as np
                import re
                Severity: Minor
                Found in datanator/schema_2/transform.py - About 7 hrs to fix

                  Function load_missing_kinetic_law_information_from_tsv_helper has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def load_missing_kinetic_law_information_from_tsv_helper(self, tsv):
                          """ Update the properties of kinetic laws in the local sqlite database based on content downloaded
                          from SABIO in TSV format.
                  
                          Note: this method is necessary because neither of SABIO's SBML and Excel export methods provide
                  Severity: Minor
                  Found in datanator/data_source/sabio_rk.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

                  Severity
                  Category
                  Status
                  Source
                  Language