|
2 | 2 |
|
3 | 3 | """Module containing the MDDB class and the command line interface.""" |
4 | 4 |
|
5 | | -import argparse |
6 | 5 | from typing import Optional |
7 | | - |
8 | | -from biobb_common.configuration import settings |
9 | 6 | from biobb_common.generic.biobb_object import BiobbObject |
10 | 7 | from biobb_common.tools.file_utils import launchlogger |
11 | 8 |
|
@@ -165,50 +162,11 @@ def launch(self) -> int: |
165 | 162 | def mddb(output_top_path: str, output_trj_path: str, properties: Optional[dict] = None, **kwargs) -> int: |
166 | 163 | """Execute the :class:`MDDB <api.mddb.MDDB>` class and |
167 | 164 | execute the :meth:`launch() <api.mddb.MDDB.launch>` method.""" |
168 | | - |
169 | | - return MDDB( |
170 | | - output_top_path=output_top_path, output_trj_path=output_trj_path, properties=properties, **kwargs |
171 | | - ).launch() |
| 165 | + return MDDB(**dict(locals())).launch() |
172 | 166 |
|
173 | 167 |
|
174 | 168 | mddb.__doc__ = MDDB.__doc__ |
175 | | - |
176 | | - |
177 | | -def main(): |
178 | | - """Command line execution of this building block. Please check the command line documentation.""" |
179 | | - parser = argparse.ArgumentParser( |
180 | | - description="This class is a wrapper for downloading a trajectory / topology pair from the MDDB Database.", |
181 | | - formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999), |
182 | | - ) |
183 | | - parser.add_argument( |
184 | | - "-c", |
185 | | - "--config", |
186 | | - required=False, |
187 | | - help="This file can be a YAML file, JSON file or JSON string", |
188 | | - ) |
189 | | - |
190 | | - # Specific args of each building block |
191 | | - required_args = parser.add_argument_group("required arguments") |
192 | | - required_args.add_argument( |
193 | | - "-o", |
194 | | - "--output_top_path", |
195 | | - required=True, |
196 | | - help="Path to the output toplogy file. Accepted formats: pdb.", |
197 | | - ) |
198 | | - required_args.add_argument( |
199 | | - "-t", |
200 | | - "--output_trj_path", |
201 | | - required=True, |
202 | | - help="Path to the output trajectory file. Accepted formats: mdcrd, trr, xtc.", |
203 | | - ) |
204 | | - |
205 | | - args = parser.parse_args() |
206 | | - config = args.config if args.config else None |
207 | | - properties = settings.ConfReader(config=config).get_prop_dic() |
208 | | - |
209 | | - # Specific call of each building block |
210 | | - mddb(output_top_path=args.output_top_path, output_trj_path=args.output_trj_path, properties=properties) |
211 | | - |
| 169 | +main = MDDB.get_main(mddb, "This class is a wrapper for downloading a trajectory / topology pair from the MDDB Database.") |
212 | 170 |
|
213 | 171 | if __name__ == "__main__": |
214 | 172 | main() |
0 commit comments