Coverage for biobb_pdb_tools/pdb_tools/biobb_pdb_selaltloc.py: 90%
10 statements
« prev ^ index » next coverage.py v7.18.0, created at 2026-12-03 15:44 +0000
« prev ^ index » next coverage.py v7.18.0, created at 2026-12-03 15:44 +0000
1#!/usr/bin/env python3
3"""Module containing the Pdbselaltloc class and the command line interface."""
5from typing import Optional
6from biobb_common.generic.biobb_object import launcher
7from biobb_pdb_tools.pdb_tools.common import PdbToolsBase
10class Pdbselaltloc(PdbToolsBase):
11 """
12 | biobb_pdb_tools Pdbselaltloc
13 | Selects alternative locations from a PDB file.
14 | By default, selects the label with the highest occupancy value for each atom, but the user can define a specific altloc label to select. Selecting by highest occupancy removes all altloc labels for all atoms. If the user provides an option (e.g. -A), only atoms with conformers with an altloc A are processed by the script.
16 Args:
17 input_file_path (str): Input PDB file. File type: input. `Sample file <https://raw.githubusercontent.com/bioexcel/biobb_pdb_tools/master/biobb_pdb_tools/test/data/pdb_tools/9INS.pdb>`_. Accepted formats: pdb (edam:format_1476).
18 output_file_path (str): PDB file with selected alternative locations. File type: output. `Sample file <https://raw.githubusercontent.com/bioexcel/biobb_pdb_tools/master/biobb_pdb_tools/test/reference/pdb_tools/ref_pdb_selaltloc.pdb>`_. Accepted formats: pdb (edam:format_1476).
19 properties (dic):
20 * **altloc** (*string*) - (None) Specific alternative location label to select (e.g. "A").
21 * **binary_path** (*str*) - ("pdb_selaltloc") Path to the pdb_selaltloc executable binary.
22 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
23 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
25 Examples:
26 This is a use example of how to use the building block from Python::
28 from biobb_pdb_tools.pdb_tools.biobb_pdb_selaltloc import biobb_pdb_selaltloc
30 # Select the highest occupancy alternative locations
31 biobb_pdb_selaltloc(input_file_path='/path/to/input.pdb',
32 output_file_path='/path/to/output.pdb')
34 # Select a specific alternative location label
35 prop = {
36 'altloc': 'A'
37 }
38 biobb_pdb_selaltloc(input_file_path='/path/to/input.pdb',
39 output_file_path='/path/to/output.pdb',
40 properties=prop)
42 Info:
43 * wrapped_software:
44 * name: pdb_tools
45 * version: >=2.5.0
46 * license: Apache-2.0
47 * ontology:
48 * name: EDAM
49 * schema: http://edamontology.org/EDAM.owl
51 """
53 option_property = "altloc"
55 def __init__(
56 self, input_file_path: str, output_file_path: str, properties: Optional[dict] = None, **kwargs
57 ) -> None:
58 super().__init__(**locals())
61biobb_pdb_selaltloc = launcher(Pdbselaltloc)
63if __name__ == "__main__":
64 Pdbselaltloc.main()