choderalab/protons

View on GitHub

Showing 288 of 347 total issues

Function patch_cooh has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

def patch_cooh(source: str, residue_name: str, oh_type="oh", ho_type="ho") -> str:
    """Add COOH statements to protons ffxml templates and fix hydroxy atom types.

    Parameters
    ----------
Severity: Minor
Found in protons/app/template_patches.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 amber.py has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Adapted from openmoltools: https://github.com/choderalab/openmoltools.

Original license and copyright:
Copyright 2017 Kyle A. Beauchamp, John D. Chodera, David L. Mobley

Severity: Minor
Found in protons/app/amber.py - About 7 hrs to fix

    Function register_tautomers has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        def register_tautomers(self, mol_graphs):
    
            # generate union mol graph
            # and register the atom_types, bonds, angles and torsions for the different mol_graphs (tautomers)
            superset_graph = nx.Graph()
    Severity: Minor
    Found in protons/app/ligands.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

    Function generate_simulation_and_driver has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_simulation_and_driver(settings):
    
        ofolder = settings['output']['dir']
        input_pdbx_file = settings['input']['dir'] + '/' + settings['name'] +  '.cif'
        custom_xml = settings['input']['dir'] + '/' + settings['name'] + '.ffxml'
    Severity: Minor
    Found in examples/tautomers/tautomer_utils.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

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

        def from_serialized_xml(cls, state_element):
            """
            Deserialize a _TitrationState from a previously serialized xml tree
    
            Parameters
    Severity: Minor
    Found in protons/app/driver.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 _register_tautomers has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

    def _register_tautomers(isomers, isomer_index, oemolecule, pdb_file_path, residue_name):
        ffxml = isomers[isomer_index]["ffxml"]
    
        name_type_mapping = {}
        name_charge_mapping = {}
    Severity: Minor
    Found in protons/app/ligands.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 build_mixture_prmtop has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    def build_mixture_prmtop(
        mol2_filenames,
        frcmod_filenames,
        box_filename,
        prmtop_filename,
    Severity: Minor
    Found in protons/app/amber.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 _retrieve_parameters has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def _retrieve_parameters(self, **kwargs):
            """ Look through FFXML files and find all parameters pertaining to the supplied atom type.
            Looks either for atom, bond, angle or torsion parameters depending on the number of arguments provided.
            Returns
            -------
    Severity: Minor
    Found in protons/app/ligands.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

    File _version.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # This file helps to compute a version number in source trees obtained from
    # git-archive tarball (such as those provided by githubs download-from-tag
    # feature). Distribution tarballs (built by setup.py sdist) and build
    # directories (produced by setup.py build) will contain a much shorter file
    # that just contains the computed version number.
    Severity: Minor
    Found in protons/_version.py - About 5 hrs to fix

      NCMCProtonDrive has 43 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class NCMCProtonDrive(_BaseDrive):
          """
          The NCMCProtonDrive is a base class Monte Carlo driver for protonation state changes and tautomerism in OpenMM.
      
          Protonation state changes, and additionally, tautomers are treated using the constant-pH dynamics method of Mongan, Case and McCammon [Mongan2004]_, or Stern [Stern2007]_ and NCMC methods from Nilmeier [Nilmeier2011]_.
      Severity: Minor
      Found in protons/app/driver.py - About 5 hrs to fix

        Function run_main has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

        def run_main(jsonfile):
            """Main simulation loop."""
        
            # TODO Validate yaml/json input with json schema?
            settings = yaml.load(open(jsonfile, "r"))
        Severity: Minor
        Found in protons/scripts/run_simulation.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 _add_xml_titration_groups has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            def _add_xml_titration_groups(
                self, topology, forcefield, ffxml_residues, selected_residue_indices
            ):
                """
                Create tautomer groups for the selected residues in the topology, using ffxml information gathered earlier.
        Severity: Minor
        Found in protons/app/driver.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 _cache_force has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            def _cache_force(self, titration_group_index, titration_state_index):
                """
                Cache the force parameters for a single titration state.
        
                Parameters
        Severity: Minor
        Found in protons/app/driver.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 _log_forces has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

        def _log_forces(forces, atom_index_to_atom_name):
        
            """
            Helper function that outputs all forces defined in a system and displays
            atom names using a mapping dictionary.
        Severity: Minor
        Found in protons/app/ligands.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 _retrieve_atom_type_parameters has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def _retrieve_atom_type_parameters(self, atom_type_name):
                """ Look through FFXML files and find all parameters pertaining to the supplied atom type.
                Returns
                -------
                params : dict(atomtypes=[], bonds=[], angles=[], propers=[], impropers=[], nonbonds=[])
        Severity: Minor
        Found in protons/app/ligands.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 _perform_attempt has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def _perform_attempt(
                self, attempt_data: _TitrationAttemptData, reject_on_nan: bool = False
            ):
                """
                Attempt a single Monte Carlo protonation state change.
        Severity: Minor
        Found in protons/app/driver.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 update has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def update(
                self,
                proposal: _StateProposal,
                residue_pool: Optional[str] = None,
                nattempts: int = 1,
        Severity: Minor
        Found in protons/app/driver.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 _append_extra_gaff_types has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            def _append_extra_gaff_types(self):
                """
                Add additional parameters generated by antechamber/parmchk for the individual isomers
                """
        
        
        Severity: Minor
        Found in protons/app/ligands.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 __init__ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                temperature,
                topology,
                system,
        Severity: Minor
        Found in protons/app/driver.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 process_library_file has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_library_file(self, inputfile):
                """Process an AMBER .lib file.
        
                Parameters
                ----------
        Severity: Minor
        Found in protons/app/amber_parser.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

        Severity
        Category
        Status
        Source
        Language