Coverage for biobb_mem/gorder/common.py: 89%

9 statements  

« prev     ^ index     » next       coverage.py v7.18.0, created at 2026-11-30 14:15 +0000

1"""Common class of the gorder blocks of package biobb_mem.""" 

2from biobb_common.generic.biobb_object import BiobbObject 

3import gorder 

4 

5 

6class GorderBase(BiobbObject): 

7 """Base class of the gorder blocks: the gorder analysis of the inputs with the analysis type of each block.""" 

8 

9 def analysis_type(self): 

10 """Go from the properties of the block to its gorder analysis type.""" 

11 raise NotImplementedError 

12 

13 def run(self) -> None: 

14 """Go from the structure and trajectory to the order parameters, in the format of the output extension.""" 

15 out = self.sandbox_file("output_order_path") 

16 analysis = gorder.Analysis( 

17 structure=self.sandbox_file("input_top_path"), 

18 trajectory=self.sandbox_file("input_traj_path"), 

19 analysis_type=self.analysis_type(), 

20 output_yaml=out if out.endswith('.yaml') else None, 

21 output_csv=out if out.endswith('.csv') else None, 

22 output_xvg=out if out.endswith('.xvg') else None, 

23 handle_pbc=self.handle_pbc, 

24 ) 

25 analysis.run().write()