Skip to content

Commit bbc0b6e

Browse files
committed
Update common
1 parent 1bcc2b4 commit bbc0b6e

19 files changed

Lines changed: 103 additions & 845 deletions

.github/env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ channels:
44
- bioconda
55
- anaconda
66
dependencies:
7-
- biobb_common ==5.1.0
7+
- biobb_common ==5.1.1
88
- biobb_structure_checking >=3.15.6

biobb_structure_utils/docs/source/command_line.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Command:
1313
```python
1414
cat_pdb -h
1515
```
16-
usage: cat_pdb [-h] [-c CONFIG] -i1 INPUT_STRUCTURE1 -i2 INPUT_STRUCTURE2 -o OUTPUT_STRUCTURE_PATH
16+
usage: cat_pdb [-h] [-c CONFIG] --input_structure1 INPUT_STRUCTURE1 --input_structure2 INPUT_STRUCTURE2 -o OUTPUT_STRUCTURE_PATH
1717

1818
Concat two PDB structures in a single PDB file.
1919

@@ -23,12 +23,12 @@ cat_pdb -h
2323
This file can be a YAML file, JSON file or JSON string
2424

2525
required arguments:
26-
-i1 INPUT_STRUCTURE1, --input_structure1 INPUT_STRUCTURE1
27-
Input structure 1 file path. Accepted formats: pdb.
28-
-i2 INPUT_STRUCTURE2, --input_structure2 INPUT_STRUCTURE2
29-
Input structure 2 file path. Accepted formats: pdb.
26+
--input_structure1 INPUT_STRUCTURE1
27+
Input structure 1 file path. Accepted formats: pdb, pdbqt.
28+
--input_structure2 INPUT_STRUCTURE2
29+
Input structure 2 file path. Accepted formats: pdb, pdbqt.
3030
-o OUTPUT_STRUCTURE_PATH, --output_structure_path OUTPUT_STRUCTURE_PATH
31-
Output structure file path. Accepted formats: pdb.
31+
Output protein file path. Accepted formats: pdb, pdbqt.
3232
### I / O Arguments
3333
Syntax: input_argument (datatype) : Definition
3434

@@ -86,9 +86,9 @@ closest_residues -h
8686

8787
required arguments:
8888
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
89-
Input structure file path. Accepted formats: pdb.
89+
Input structure file path. Accepted formats: pdb, pdbqt.
9090
-o OUTPUT_RESIDUES_PATH, --output_residues_path OUTPUT_RESIDUES_PATH
91-
Output residues file path. Accepted formats: pdb.
91+
Output molcules file path. Accepted formats: pdb, pdbqt.
9292
### I / O Arguments
9393
Syntax: input_argument (datatype) : Definition
9494

@@ -161,9 +161,9 @@ extract_atoms -h
161161

162162
required arguments:
163163
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
164-
Input structure file name
164+
Input structure file path. Accepted formats: pdb, gro.
165165
-o OUTPUT_STRUCTURE_PATH, --output_structure_path OUTPUT_STRUCTURE_PATH
166-
Output structure file name
166+
Output structure file path. Accepted formats: pdb, gro.
167167
### I / O Arguments
168168
Syntax: input_argument (datatype) : Definition
169169

@@ -221,9 +221,9 @@ extract_chain -h
221221

222222
required arguments:
223223
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
224-
Input structure file path. Accepted formats: pdb.
224+
Input structure file path. Accepted formats: pdb, pdbqt.
225225
-o OUTPUT_STRUCTURE_PATH, --output_structure_path OUTPUT_STRUCTURE_PATH
226-
Output structure file path. Accepted formats: pdb.
226+
Output structure file path. Accepted formats: pdb, pdbqt.
227227
### I / O Arguments
228228
Syntax: input_argument (datatype) : Definition
229229

@@ -290,9 +290,9 @@ extract_heteroatoms -h
290290

291291
required arguments:
292292
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
293-
Input structure file path. Accepted formats: pdb.
293+
Input structure file path. Accepted formats: pdb, pdbqt.
294294
-o OUTPUT_HETEROATOM_PATH, --output_heteroatom_path OUTPUT_HETEROATOM_PATH
295-
Output heteroatom file path. Accepted formats: pdb.
295+
Output heteroatom file path. Accepted formats: pdb, pdbqt.
296296
### I / O Arguments
297297
Syntax: input_argument (datatype) : Definition
298298

@@ -362,9 +362,9 @@ extract_model -h
362362

363363
required arguments:
364364
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
365-
Input structure file path. Accepted formats: pdb.
365+
Input structure file path. Accepted formats: pdb, pdbqt.
366366
-o OUTPUT_STRUCTURE_PATH, --output_structure_path OUTPUT_STRUCTURE_PATH
367-
Output structure file path. Accepted formats: pdb.
367+
Output structure file path. Accepted formats: pdb, pdbqt.
368368
### I / O Arguments
369369
Syntax: input_argument (datatype) : Definition
370370

@@ -428,9 +428,9 @@ extract_molecule -h
428428

429429
required arguments:
430430
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
431-
Input structure file path. Accepted formats: pdb.
431+
Input structure file path. Accepted formats: pdb, pdbqt.
432432
-o OUTPUT_MOLECULE_PATH, --output_molecule_path OUTPUT_MOLECULE_PATH
433-
Output heteroatom file path. Accepted formats: pdb.
433+
Output molecule file path. Accepted formats: pdb, pdbqt.
434434
### I / O Arguments
435435
Syntax: input_argument (datatype) : Definition
436436

@@ -490,9 +490,9 @@ extract_residues -h
490490

491491
required arguments:
492492
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
493-
Input structure file path. Accepted formats: pdb.
493+
Input structure file path. Accepted formats: pdb, pdbqt.
494494
-o OUTPUT_RESIDUES_PATH, --output_residues_path OUTPUT_RESIDUES_PATH
495-
Output residues file path. Accepted formats: pdb.
495+
Output residues file path. Accepted formats: pdb, pdbqt.
496496
### I / O Arguments
497497
Syntax: input_argument (datatype) : Definition
498498

@@ -559,9 +559,9 @@ remove_ligand -h
559559

560560
required arguments:
561561
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
562-
Input structure file name
562+
Input structure file path. Accepted formats: pdb, gro.
563563
-o OUTPUT_STRUCTURE_PATH, --output_structure_path OUTPUT_STRUCTURE_PATH
564-
Output structure file name
564+
Output structure file path. Accepted formats: pdb, gro.
565565
### I / O Arguments
566566
Syntax: input_argument (datatype) : Definition
567567

@@ -619,9 +619,9 @@ remove_molecules -h
619619

620620
required arguments:
621621
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
622-
Input structure file path. Accepted formats: pdb.
622+
Input structure file path. Accepted formats: pdb, pdbqt.
623623
-o OUTPUT_MOLECULES_PATH, --output_molecules_path OUTPUT_MOLECULES_PATH
624-
Output molecules file path. Accepted formats: pdb.
624+
Output molcules file path. Accepted formats: pdb, pdbqt.
625625
### I / O Arguments
626626
Syntax: input_argument (datatype) : Definition
627627

@@ -688,9 +688,9 @@ remove_pdb_water -h
688688

689689
required arguments:
690690
-i INPUT_PDB_PATH, --input_pdb_path INPUT_PDB_PATH
691-
Input pdb file name
691+
Input PDB file path. Accepted formats: pdb.
692692
-o OUTPUT_PDB_PATH, --output_pdb_path OUTPUT_PDB_PATH
693-
Output pdb file name
693+
Output PDB file path. Accepted formats: pdb.
694694
### I / O Arguments
695695
Syntax: input_argument (datatype) : Definition
696696

@@ -737,7 +737,7 @@ Command:
737737
```python
738738
renumber_structure -h
739739
```
740-
usage: renumber_structure [-h] [-c CONFIG] -i INPUT_STRUCTURE_PATH -o OUTPUT_STRUCTURE_PATH -j OUTPUT_MAPPING_JSON_PATH
740+
usage: renumber_structure [-h] [-c CONFIG] -i INPUT_STRUCTURE_PATH --output_structure_path OUTPUT_STRUCTURE_PATH --output_mapping_json_path OUTPUT_MAPPING_JSON_PATH
741741

742742
Renumber atoms and residues from a 3D structure.
743743

@@ -748,11 +748,11 @@ renumber_structure -h
748748

749749
required arguments:
750750
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
751-
Input structure file name
752-
-o OUTPUT_STRUCTURE_PATH, --output_structure_path OUTPUT_STRUCTURE_PATH
753-
Output structure file name
754-
-j OUTPUT_MAPPING_JSON_PATH, --output_mapping_json_path OUTPUT_MAPPING_JSON_PATH
755-
Output mapping json file name
751+
Input structure file path. Accepted formats: pdb, gro.
752+
--output_structure_path OUTPUT_STRUCTURE_PATH
753+
Output structure file path. Accepted formats: pdb, gro.
754+
--output_mapping_json_path OUTPUT_MAPPING_JSON_PATH
755+
Output mapping json file path. Accepted formats: json.
756756
### I / O Arguments
757757
Syntax: input_argument (datatype) : Definition
758758

@@ -812,9 +812,9 @@ sort_gro_residues -h
812812

813813
required arguments:
814814
-i INPUT_GRO_PATH, --input_gro_path INPUT_GRO_PATH
815-
Input GRO file name
815+
Input GRO file path. Accepted formats: gro.
816816
-o OUTPUT_GRO_PATH, --output_gro_path OUTPUT_GRO_PATH
817-
Output sorted GRO file name
817+
Output sorted GRO file path. Accepted formats: gro.
818818
### I / O Arguments
819819
Syntax: input_argument (datatype) : Definition
820820

@@ -948,7 +948,7 @@ structure_check -h
948948

949949
required arguments:
950950
-i INPUT_STRUCTURE_PATH, --input_structure_path INPUT_STRUCTURE_PATH
951-
Input structure file path. Accepted formats: pdb.
951+
Input structure file path. Accepted formats: pdb, pdbqt.
952952
-o OUTPUT_SUMMARY_PATH, --output_summary_path OUTPUT_SUMMARY_PATH
953953
Output summary checking results. Accepted formats: json.
954954
### I / O Arguments

biobb_structure_utils/json_schemas/biobb_structure_utils.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@
131131
}
132132
],
133133
"dep_pypi": [
134-
"install_requires=['biobb_common==5.1.0', 'biobb_structure_checking>=3.15.6']",
134+
"install_requires=['biobb_common==5.1.1', 'biobb_structure_checking>=3.15.6']",
135135
"python_requires='>=3.9'"
136136
],
137137
"dep_conda": [
138138
"python >=3.9",
139-
"biobb_common ==5.1.0",
139+
"biobb_common ==5.1.1",
140140
"biobb_structure_checking >=3.15.6"
141141
],
142142
"dep_conda_extra": [],

biobb_structure_utils/utils/cat_pdb.py

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
#!/usr/bin/env python3
2-
31
"""Module containing the CatPDB class and the command line interface."""
4-
5-
import argparse
62
from typing import Optional
7-
8-
from biobb_common.configuration import settings
93
from biobb_common.generic.biobb_object import BiobbObject
104
from biobb_common.tools.file_utils import launchlogger
115

@@ -131,7 +125,6 @@ def launch(self) -> int:
131125
self.copy_to_host()
132126

133127
# Remove temporal files
134-
# self.tmp_files.append(self.stage_io_dict.get("unique_dir", ""))
135128
self.remove_tmp_files()
136129

137130
self.check_arguments(output_files_created=True, raise_exception=False)
@@ -146,66 +139,13 @@ def cat_pdb(
146139
properties: Optional[dict] = None,
147140
**kwargs,
148141
) -> int:
149-
"""Execute the :class:`CatPDB <utils.cat_pdb.CatPDB>` class and
142+
"""Create the :class:`CatPDB <utils.cat_pdb.CatPDB>` class and
150143
execute the :meth:`launch() <utils.cat_pdb.CatPDB.launch>` method."""
144+
return CatPDB(**dict(locals())).launch()
151145

152-
return CatPDB(
153-
input_structure1=input_structure1,
154-
input_structure2=input_structure2,
155-
output_structure_path=output_structure_path,
156-
properties=properties,
157-
**kwargs,
158-
).launch()
159-
160-
cat_pdb.__doc__ = CatPDB.__doc__
161-
162-
163-
def main():
164-
"""Command line execution of this building block. Please check the command line documentation."""
165-
parser = argparse.ArgumentParser(
166-
description="Concat two PDB structures in a single PDB file.",
167-
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
168-
)
169-
parser.add_argument(
170-
"-c",
171-
"--config",
172-
required=False,
173-
help="This file can be a YAML file, JSON file or JSON string",
174-
)
175-
176-
# Specific args of each building block
177-
required_args = parser.add_argument_group("required arguments")
178-
required_args.add_argument(
179-
"-i1",
180-
"--input_structure1",
181-
required=True,
182-
help="Input structure 1 file path. Accepted formats: pdb.",
183-
)
184-
required_args.add_argument(
185-
"-i2",
186-
"--input_structure2",
187-
required=True,
188-
help="Input structure 2 file path. Accepted formats: pdb.",
189-
)
190-
required_args.add_argument(
191-
"-o",
192-
"--output_structure_path",
193-
required=True,
194-
help="Output structure file path. Accepted formats: pdb.",
195-
)
196-
197-
args = parser.parse_args()
198-
config = args.config if args.config else None
199-
properties = settings.ConfReader(config=config).get_prop_dic()
200-
201-
# Specific call of each building block
202-
cat_pdb(
203-
input_structure1=args.input_structure1,
204-
input_structure2=args.input_structure2,
205-
output_structure_path=args.output_structure_path,
206-
properties=properties,
207-
)
208146

147+
cat_pdb.__doc__ = CatPDB.__doc__
148+
main = CatPDB.get_main(cat_pdb, "Concat two PDB structures in a single PDB file.")
209149

210150
if __name__ == "__main__":
211151
main()

biobb_structure_utils/utils/closest_residues.py

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
#!/usr/bin/env python3
22

33
"""Module containing the ClosestResidues class and the command line interface."""
4-
5-
import argparse
64
from typing import Optional
7-
85
import Bio.PDB
9-
from biobb_common.configuration import settings
106
from biobb_common.generic.biobb_object import BiobbObject
117
from biobb_common.tools import file_utils as fu
128
from biobb_common.tools.file_utils import launchlogger
@@ -208,7 +204,6 @@ def launch(self) -> int:
208204
self.copy_to_host()
209205

210206
# Remove temporal files
211-
# self.tmp_files.append(self.stage_io_dict.get("unique_dir", ""))
212207
self.remove_tmp_files()
213208

214209
self.check_arguments(output_files_created=True, raise_exception=False)
@@ -222,58 +217,13 @@ def closest_residues(
222217
properties: Optional[dict] = None,
223218
**kwargs,
224219
) -> int:
225-
"""Execute the :class:`ClosestResidues <utils.closest_residues.ClosestResidues>` class and
220+
"""Create the :class:`ClosestResidues <utils.closest_residues.ClosestResidues>` class and
226221
execute the :meth:`launch() <utils.closest_residues.ClosestResidues.launch>` method."""
222+
return ClosestResidues(**dict(locals())).launch()
227223

228-
return ClosestResidues(
229-
input_structure_path=input_structure_path,
230-
output_residues_path=output_residues_path,
231-
properties=properties,
232-
**kwargs,
233-
).launch()
234-
235-
closest_residues.__doc__ = ClosestResidues.__doc__
236-
237-
238-
def main():
239-
"""Command line execution of this building block. Please check the command line documentation."""
240-
parser = argparse.ArgumentParser(
241-
description="Search closest residues to a list of given residues.",
242-
formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999),
243-
)
244-
parser.add_argument(
245-
"-c",
246-
"--config",
247-
required=False,
248-
help="This file can be a YAML file, JSON file or JSON string",
249-
)
250-
251-
# Specific args of each building block
252-
required_args = parser.add_argument_group("required arguments")
253-
required_args.add_argument(
254-
"-i",
255-
"--input_structure_path",
256-
required=True,
257-
help="Input structure file path. Accepted formats: pdb.",
258-
)
259-
required_args.add_argument(
260-
"-o",
261-
"--output_residues_path",
262-
required=True,
263-
help="Output residues file path. Accepted formats: pdb.",
264-
)
265-
266-
args = parser.parse_args()
267-
config = args.config if args.config else None
268-
properties = settings.ConfReader(config=config).get_prop_dic()
269-
270-
# Specific call of each building block
271-
closest_residues(
272-
input_structure_path=args.input_structure_path,
273-
output_residues_path=args.output_residues_path,
274-
properties=properties,
275-
)
276224

225+
closest_residues.__doc__ = ClosestResidues.__doc__
226+
main = ClosestResidues.get_main(closest_residues, "Search closest residues to a list of given residues.")
277227

278228
if __name__ == "__main__":
279229
main()

0 commit comments

Comments
 (0)