KarrLab/datanator

View on GitHub

Showing 376 of 791 total issues

Function build_obs has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def build_obs(self, data):
        """Build observation objects from obj.
        Go into observations collection.
        Args:
            data (:obj:`Obj`): source object.

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_missing_kinetic_law_information_from_tsv_helper has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def load_missing_kinetic_law_information_from_tsv_helper(self, tsv, start=0):
        """ Update the properties of kinetic laws in the mongodb 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_nosql.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

Function inchi_to_inchikey has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def inchi_to_inchikey(self, szINCHISource):
        '''
            fork from git@github.com:mnowotka/chembl_ikey.git
        '''
        flagstd = 'S'
Severity: Minor
Found in datanator/util/chem_util.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

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

    def fill_rna_half_life(self, df, column, species, quantification_method='Illumina GA-II'):
        """Load df into rna_halflife collection
        
        Args:
            df (:obj:`pandas.DataFrame`): dataframe to be loaded
Severity: Minor
Found in datanator/data_source/rna_halflife/doi_10_1186_gb_2012_13_4_r30.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 load_compounds has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def load_compounds(self, compounds=None):
        """ Download information from SABIO-RK about all of the compounds stored sabio_compounds
                collection
        Args:
            compounds (:obj:`list` of :obj:`obj`): list of compounds to download
Severity: Minor
Found in datanator/data_source/sabio_rk_nosql.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 upload_backups has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def upload_backups(self):
        """ Backup the local sqlite database to Quilt """

        # create temporary directory to checkout package
        tmp_dirname = tempfile.mkdtemp()
Severity: Minor
Found in datanator/core/data_source.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

File core.py has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Machinery for parsing k_cats and K_ms from `BRENDA <https://www.brenda-enzymes.org/>`_.

#. Download BRENDA text file from https://www.brenda-enzymes.org/download_brenda_without_registration.php.
#. Extract brenda_download.txt from zip archive and save to `./brenda_download.txt`
#. Run the parser in this module::
Severity: Minor
Found in datanator/data_source/brenda/core.py - About 4 hrs to fix

    Function _run_rrna has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def _run_rrna(self, session, modomics_short_code_to_monomer, monomer_codes, out_filename):
            response = session.get(self.ENDPOINT, params={
                'RNA_type': 'rRNA',
                'RNA_subtype': 'all',
                'organism': 'all species',
    Severity: Minor
    Found in datanator/data_source/modomics.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 fill_helper has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def fill_helper(self, doi, field_name, start=0, species=None):
            """Method to fill new collection across different dois.
            
            Args:
                doi (:obj:`str`): DOI of publications.
    Severity: Minor
    Found in datanator/data_source/rna_halflife/order_by_ko.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

    File victoria_parse_proteome_half_lives.py has 354 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import pandas as pd
    from pymongo import MongoClient
    from datanator_query_python.util import mongo_util
    from datanator_query_python.config import config
    
    

      Function create_kinetic_law_from_sbml has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_kinetic_law_from_sbml(self, id, sbml, specie_properties, functions, units):
              """ Add a kinetic law to the local sqlite database
      
              Args:
                  id (:obj:`int`): identifier
      Severity: Minor
      Found in datanator/data_source/sabio_rk.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

      File doi_10_1038_nchembio_2077.py has 347 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import pandas as pd
      import datetime
      from datanator_query_python.query import query_metabolites_meta
      from collections import deque
      import datanator.config.core

        Function infer_compound_structures_from_names has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def infer_compound_structures_from_names(self, compounds):
                """ Try to use PubChem to infer the structure of compounds from their names
        
                Notes: we don't try look up structures from their cross references because SABIO has already gathered
                all structures from their cross references to ChEBI, KEGG, and PubChem
        Severity: Minor
        Found in datanator/data_source/sabio_rk.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 add_inchi_hash has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_inchi_hash(self, ids=None):
                '''
                    Add inchi key values of _value_inchi in sabio_rk collection
                '''
                
        Severity: Minor
        Found in datanator/data_source/sabio_rk_json_mongo.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 build_obs has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_obs(self, obj):
                """Build observation objects from obj.
                Go into observations collection.
        
                Args:
        Severity: Minor
        Found in datanator/schema_2/transform_metabolites_meta.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 _run_trna has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            def _run_trna(self, session, modomics_short_code_to_monomer, monomer_codes, out_filename):
                response = session.get(self.ENDPOINT, params={
                    'RNA_type': 'tRNA',
                    'RNA_subtype': 'all',
                    'organism': 'all species',
        Severity: Minor
        Found in datanator/data_source/modomics.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 parse_html has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_html(self, soup):
                """Parse out gene_orthologs from HTML 
                (https://www.kegg.jp/ssdb-bin/ssdb_best?org_gene=aly:ARALYDRAFT_486312).
                
                Args:
        Severity: Minor
        Found in datanator/data_source/gene_ortholog.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 parse_complex_subunit_structure has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_complex_subunit_structure(self, text):
                """ Parse the subunit structure of complex into a dictionary of subunit coefficients
        
                Args:
                    text (:obj:`str`): subunit structure described with nested parentheses
        Severity: Minor
        Found in datanator/data_source/sabio_rk_nosql.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_complex_subunit_structure has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_complex_subunit_structure(self, text):
                """ Parse the subunit structure of complex into a dictionary of subunit coefficients
        
                Args:
                    text (:obj:`str`): subunit structure described with nested parentheses
        Severity: Minor
        Found in datanator/data_source/sabio_rk.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 write_to_json has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_to_json(self):
        
                if self.verbose:
                    print('Download list of all compounds: ...')
        
        
        Severity: Minor
        Found in datanator/data_source/metabolite_nosql.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

        Severity
        Category
        Status
        Source
        Language