Coverage for biobb_pdb_tools/pdb_tools/biobb_pdb_tofasta.py: 90%

10 statements  

« prev     ^ index     » next       coverage.py v7.18.0, created at 2026-12-03 15:44 +0000

1#!/usr/bin/env python3 

2 

3"""Module containing the Pdbtofasta class and the command line interface.""" 

4 

5from typing import Optional 

6from biobb_common.generic.biobb_object import launcher 

7from biobb_pdb_tools.pdb_tools.common import PdbToolsBase 

8 

9 

10class Pdbtofasta(PdbToolsBase): 

11 """ 

12 | biobb_pdb_tofasta Pdbtofasta 

13 | Extracts the residue sequence in a PDB file to FASTA format. 

14 | This tool extracts the residue sequence in a PDB file to FASTA format. It can be used to extract the sequence of a PDB file to FASTA format. 

15 

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/1AKI.pdb>`_. Accepted formats: pdb (edam:format_1476). 

18 output_file_path (str): FASTA file containing the aminoacids sequence. File type: output. `Sample file <https://raw.githubusercontent.com/bioexcel/biobb_pdb_tools/master/biobb_pdb_tools/test/reference/pdb_tools/ref_pdb_tofasta.fasta>`_. Accepted formats: fasta (edam:format_1929), fa (edam:format_1929). 

19 properties (dic): 

20 * **multi** (*bool*) - (True) Splits the different chains into different records in the FASTA file. 

21 * **binary_path** (*str*) - ("pdb_tofasta") Path to the pdb_tofasta 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. 

24 

25 Examples: 

26 This is a use example of how to use the building block from Python:: 

27 

28 from biobb_pdb_tools.pdb_tools.biobb_pdb_tofasta import biobb_pdb_tofasta 

29 

30 prop = { 

31 'multi': True 

32 } 

33 biobb_pdb_tofasta(input_file_path='/path/to/input.pdb', 

34 output_file_path='/path/to/output.fasta', 

35 properties=prop) 

36 

37 Info: 

38 * wrapped_software: 

39 * name: pdb_tools 

40 * version: >=2.5.0 

41 * license: Apache-2.0 

42 * ontology: 

43 * name: EDAM 

44 * schema: http://edamontology.org/EDAM.owl 

45 

46 """ 

47 

48 flag_property = "multi" 

49 

50 def __init__( 

51 self, input_file_path: str, output_file_path: str, properties: Optional[dict] = None, **kwargs 

52 ) -> None: 

53 super().__init__(**locals()) 

54 

55 

56biobb_pdb_tofasta = launcher(Pdbtofasta) 

57 

58if __name__ == "__main__": 

59 Pdbtofasta.main()