choderalab/yank

View on GitHub
Yank/pipeline.py

Summary

Maintainability
F
1 wk
Test Coverage

File pipeline.py has 1832 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# =============================================================================================
# MODULE DOCSTRING
# =============================================================================================
Severity: Major
Found in Yank/pipeline.py - About 5 days to fix

    Function _setup_molecules has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
    Open

        def _setup_molecules(self, *args):
            """Set up the files needed to generate the system for all the molecules.
    
            If OpenEye tools are installed, this generate the molecules when the source is
            not a file. If two (or more) molecules generated by OpenEye have overlapping
    Severity: Minor
    Found in Yank/pipeline.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 _setup_system has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

        def _setup_system(self, system_file_path, pack, alchemical_charge,
                          system_parameters, solvent_id, *molecule_ids, **kwargs):
            """Setup a system and create its prmtop/inpcrd files.
    
            IMPORTANT: This function does not check if it's about to overwrite
    Severity: Minor
    Found in Yank/pipeline.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 apply_pdbfixer has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    def apply_pdbfixer(input_file_path, output_file_path, directives):
        """
        Apply PDBFixer to make changes to the specified molecule.
    
        Single mutants are supported in the form "T315I"
    Severity: Minor
    Found in Yank/pipeline.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 is_molecule_setup has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def is_molecule_setup(self, molecule_id):
            """Check whether the molecule has been processed previously.
    
            The molecule must be set up if it needs to be parametrize by antechamber
            (and the gaff.mol2 and frcmod files do not exist), if the molecule must be
    Severity: Minor
    Found in Yank/pipeline.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 create_system has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_system(parameters_file, box_vectors, create_system_args, system_options):
        """Create and return an OpenMM system.
    
        Parameters
        ----------
    Severity: Minor
    Found in Yank/pipeline.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 read_system_files has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def read_system_files(positions_file_path, parameters_file_path, system_options,
                          gromacs_include_dir=None, charmm_parameter_files=None):
        """Create a Yank arguments for a phase from system files.
    
        Parameters
    Severity: Minor
    Found in Yank/pipeline.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 apply_modeller has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def apply_modeller(input_file_path, output_file_path, directives):
        """
        Apply Salilab Modeller to make changes to the specified molecule.
    
        Single mutants are supported in the form "T315I"
    Severity: Minor
    Found in Yank/pipeline.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 run_thermodynamic_trailblazing has 14 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def run_thermodynamic_trailblazing(
    Severity: Major
    Found in Yank/pipeline.py - About 1 hr to fix

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

          def _setup_system(self, system_file_path, pack, alchemical_charge,
                            system_parameters, solvent_id, *molecule_ids, **kwargs):
              """Setup a system and create its prmtop/inpcrd files.
      
              IMPORTANT: This function does not check if it's about to overwrite
      Severity: Minor
      Found in Yank/pipeline.py - About 1 hr to fix

        Function compute_net_charge has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def compute_net_charge(system, atom_indices):
            """Compute the total net charge of a subset of atoms in the system.
        
            Parameters
            ----------
        Severity: Minor
        Found in Yank/pipeline.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 pull_close has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def pull_close(fixed_mol_pos, translated_mol_pos, min_bound, max_bound):
            """Heuristic algorithm to quickly translate the ligand close to the receptor.
        
            The distance of the ligand from the receptor here is defined as the shortest
            Euclidean distance between an atom of the ligand and one of the receptor.
        Severity: Minor
        Found in Yank/pipeline.py - About 55 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 _setup_system has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _setup_system(self, system_file_path, pack, alchemical_charge,
        Severity: Major
        Found in Yank/pipeline.py - About 50 mins to fix

          Function get_system_files_paths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_system_files_paths(self, system_id):
                  """Return the paths to the systems files.
          
                  Parameters
                  ----------
          Severity: Minor
          Found in Yank/pipeline.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                              if previous_thermo_state is not None:
                                  computed_thermo_states.append(previous_thermo_state)
                          else:
          Severity: Major
          Found in Yank/pipeline.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if len(line_fields) > 1:
                                        smiles_str = line_fields[1].strip()
                                    else:
                                        smiles_str = line_fields[0].strip()
            
            
            Severity: Major
            Found in Yank/pipeline.py - About 45 mins to fix

              Function find_alchemical_counterions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def find_alchemical_counterions(system, topography, region_name):
                  """Return the atom indices of the ligand or solute counter ions.
              
                  In periodic systems, the solvation box needs to be neutral, and
                  if the decoupled molecule is charged, it will cause trouble. This
              Severity: Minor
              Found in Yank/pipeline.py - About 45 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 process_tool_directive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def process_tool_directive(directives, option, dispatch, allowed_values, yields_value=False):
                  """Process a directive.
              
                  Parameters
                  ----------
              Severity: Minor
              Found in Yank/pipeline.py - About 45 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 _cache_trailblaze_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _cache_trailblaze_data(checkpoint_dir_path, optimal_protocol, states_stds,
              Severity: Minor
              Found in Yank/pipeline.py - About 35 mins to fix

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

                def process_tool_directive(directives, option, dispatch, allowed_values, yields_value=False):
                Severity: Minor
                Found in Yank/pipeline.py - About 35 mins to fix

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

                  def read_system_files(positions_file_path, parameters_file_path, system_options,
                  Severity: Minor
                  Found in Yank/pipeline.py - About 35 mins to fix

                    Function pack_transformation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def pack_transformation(mol1_pos, mol2_pos, min_distance, max_distance):
                        """Compute an affine transformation that solve clashes and fit mol2 in the box.
                    
                        The method randomly shifts and rotates mol2 until all its atoms are within
                        min_distance and max_distance from mol1. The position of mol1 is kept fixed.
                    Severity: Minor
                    Found in Yank/pipeline.py - About 35 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 setup_all_systems has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def setup_all_systems(self):
                            """Setup all molecules and systems in the database.
                    
                            The method supports parallelization through MPI.
                    
                    
                    Severity: Minor
                    Found in Yank/pipeline.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 _resume_thermodynamic_trailblazing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _resume_thermodynamic_trailblazing(checkpoint_dir_path, initial_protocol):
                        """Resume a previously-run trailblaze execution.
                    
                        Parameters
                        ----------
                    Severity: Minor
                    Found in Yank/pipeline.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