main

Perform functions related to _main_ execution of PDB2PQR.

This module is intended for functions that directly touch arguments provided at the invocation of PDB2PQR. It was created to avoid cluttering the __init__.py file.

Code author: Nathan Baker (et al.)

pdb2pqr.main.build_main_parser()[source]

Build an argument parser.

Todo

Need separate argparse groups for PDB2PKA and PROPKA. These exist but need real options.

Returns:argument parser
Return type:argparse.ArgumentParser
pdb2pqr.main.check_files(args)[source]

Check for other necessary files.

Parameters:

args (argparse.Namespace) – command-line arguments

Raises:
pdb2pqr.main.check_options(args)[source]

Sanity check options.

Parameters:args (argparse.Namespace) – command-line arguments
Raises:RuntimeError – silly option combinations were encountered.
pdb2pqr.main.drop_water(pdblist)[source]

Drop waters from a list of PDB records.

Todo

this module is already too long but this function fits better here. Other possible place would be utilities.

Parameters:pdb_list ([str]) – list of PDB records as returned by io.get_molecule
Returns:new list of PDB records with waters removed.
Return type:[str]
pdb2pqr.main.dx_to_cube()[source]

Convert DX file format to Cube file format.

The OpenDX file format is defined at <https://www.idvbook.com/wp-content/uploads/2010/12/opendx.pdf` and the Cube file format is defined at <https://docs.chemaxon.com/display/Gaussian_Cube_format.html>.

Todo

This function should be moved into the APBS code base.

pdb2pqr.main.is_repairable(biomolecule, has_ligand)[source]

Determine if the biomolecule can be (or needs to be) repaired.

Parameters:
  • biomolecule (biomol.Biomolecule) – biomolecule object
  • has_ligand (bool) – does the system contain a ligand?
Returns:

indication of whether biomolecule can be repaired

Return type:

bool

Raises:

ValueError – if there are insufficient heavy atoms or a significant part of the biomolecule is missing

pdb2pqr.main.main()[source]

Hook for command-line usage.

pdb2pqr.main.main_driver(args)[source]

Main driver for running program from the command line.

Validate inputs, launch PDB2PQR, handle output.

Parameters:args (argparse.Namespace) – command-line arguments
pdb2pqr.main.non_trivial(args, biomolecule, ligand, definition, is_cif)[source]

Perform a non-trivial PDB2PQR run.

Todo

These routines should be generalized to biomolecules; none of them are specific to biomolecules.

Parameters:
Raises:

ValueError – for missing atoms that prevent debumping

Returns:

dictionary with results

Return type:

dict

pdb2pqr.main.print_pdb(args, pdb_lines, header_lines, missing_lines, is_cif)[source]

Print PDB-format output to specified file

Todo

Move this to another module (io)

Parameters:
  • args (argparse.Namespace) – command-line arguments
  • pdb_lines ([str]]) – output lines (records)
  • header_lines ([str]) – header lines
  • missing_lines ([str]) – lines describing missing atoms (should go in header)
  • is_cif (bool) – flag indicating CIF format
pdb2pqr.main.print_pqr(args, pqr_lines, header_lines, missing_lines, is_cif)[source]

Print PQR-format output to specified file

Todo

Move this to another module (io)

Parameters:
  • args (argparse.Namespace) – command-line arguments
  • pqr_lines ([str]) – output lines (records)
  • header_lines ([str]) – header lines
  • missing_lines ([str]) – lines describing missing atoms (should go in header)
  • is_cif (bool) – flag indicating CIF format
pdb2pqr.main.print_splash_screen(args)[source]

Print argument overview and citation information.

Parameters:args (argparse.Namespace) – command-line arguments
pdb2pqr.main.run_propka(args, biomolecule)[source]

Run a PROPKA calculation.

Parameters:
Returns:

(DataFrame-convertible table of assigned pKa values, pKa information from PROPKA)

Return type:

(list, str)

pdb2pqr.main.setup_molecule(pdblist, definition, ligand_path)[source]

Set up the molecular system.

Parameters:
  • pdblist (list) – list of PDB records
  • definition (Definition) – topology definition
  • ligand_path (str) – path to ligand (may be None)
Returns:

(biomolecule object, definition object–revised if ligand was parsed, ligand object–may be None)

Return type:

(Biomolecule, Definition, Ligand)

pdb2pqr.main.transform_arguments(args)[source]

Transform arguments with logic not provided by argparse.

Todo

I wish this could be done with argparse.

Parameters:args (argparse.Namespace) – command-line arguments
Returns:modified arguments
Return type:argparse.Namespace