1#!/usr/bin/env python3
-3"""Module containing the Cpptraj Density class and the command line interface."""
+3"""Module containing the MDAnalysis HOLE class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -258,8 +258,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_22a7e342fe3c2095_test_cpptraj_density_py.html b/coverage/z_22a7e342fe3c2095_test_cpptraj_density_py.html
index 388d8a0..6f0d667 100644
--- a/coverage/z_22a7e342fe3c2095_test_cpptraj_density_py.html
+++ b/coverage/z_22a7e342fe3c2095_test_cpptraj_density_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -135,8 +135,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_71ff1673b421320c___init___py.html b/coverage/z_71ff1673b421320c___init___py.html
index 40bcf24..a037e3e 100644
--- a/coverage/z_71ff1673b421320c___init___py.html
+++ b/coverage/z_71ff1673b421320c___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -81,7 +81,7 @@
1name = "biobb_mem"
- 2__all__ = ["ambertools", "lipyphilic_biobb", "mdanalysis_biobb"]
+ 2__all__ = ["ambertools", "fatslim", "lipyphilic_biobb", "mdanalysis_biobb"]
3__version__ = "5.0.1"
diff --git a/coverage/z_7351c2bb23e1f89d___init___py.html b/coverage/z_7351c2bb23e1f89d___init___py.html
index 42c5a8b..6a38637 100644
--- a/coverage/z_7351c2bb23e1f89d___init___py.html
+++ b/coverage/z_7351c2bb23e1f89d___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -90,8 +90,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
index 4cd1e7d..01ad3fa 100644
--- a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
+++ b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
@@ -62,10 +62,10 @@
« prev
^ index
- » next
+ » next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -274,10 +274,10 @@
« prev
^ index
- » next
+ » next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
index 04565e9..67d19c6 100644
--- a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
+++ b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -106,8 +106,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_ae07420627dba52f___init___py.html b/coverage/z_ae07420627dba52f___init___py.html
index 291468a..a10f228 100644
--- a/coverage/z_ae07420627dba52f___init___py.html
+++ b/coverage/z_ae07420627dba52f___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -88,8 +88,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
index 5d381fd..f8659b4 100644
--- a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
+++ b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -105,8 +105,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev
+ « prev
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -86,12 +86,12 @@
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_71ff1673b421320c___init___py.html b/coverage/z_71ff1673b421320c___init___py.html
index 40bcf24..a037e3e 100644
--- a/coverage/z_71ff1673b421320c___init___py.html
+++ b/coverage/z_71ff1673b421320c___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -81,7 +81,7 @@
1name = "biobb_mem"
- 2__all__ = ["ambertools", "lipyphilic_biobb", "mdanalysis_biobb"]
+ 2__all__ = ["ambertools", "fatslim", "lipyphilic_biobb", "mdanalysis_biobb"]
3__version__ = "5.0.1"
diff --git a/coverage/z_7351c2bb23e1f89d___init___py.html b/coverage/z_7351c2bb23e1f89d___init___py.html
index 42c5a8b..6a38637 100644
--- a/coverage/z_7351c2bb23e1f89d___init___py.html
+++ b/coverage/z_7351c2bb23e1f89d___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -90,8 +90,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
index 4cd1e7d..01ad3fa 100644
--- a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
+++ b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
@@ -62,10 +62,10 @@
« prev
^ index
- » next
+ » next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -274,10 +274,10 @@
« prev
^ index
- » next
+ » next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
index 04565e9..67d19c6 100644
--- a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
+++ b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -106,8 +106,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_ae07420627dba52f___init___py.html b/coverage/z_ae07420627dba52f___init___py.html
index 291468a..a10f228 100644
--- a/coverage/z_ae07420627dba52f___init___py.html
+++ b/coverage/z_ae07420627dba52f___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -88,8 +88,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
index 5d381fd..f8659b4 100644
--- a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
+++ b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -105,8 +105,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev
+ « prev
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -86,12 +86,12 @@
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
1name = "biobb_mem"
- 2__all__ = ["ambertools", "lipyphilic_biobb", "mdanalysis_biobb"]
+ 2__all__ = ["ambertools", "fatslim", "lipyphilic_biobb", "mdanalysis_biobb"]
3__version__ = "5.0.1"
diff --git a/coverage/z_7351c2bb23e1f89d___init___py.html b/coverage/z_7351c2bb23e1f89d___init___py.html
index 42c5a8b..6a38637 100644
--- a/coverage/z_7351c2bb23e1f89d___init___py.html
+++ b/coverage/z_7351c2bb23e1f89d___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -90,8 +90,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
index 4cd1e7d..01ad3fa 100644
--- a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
+++ b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
@@ -62,10 +62,10 @@
« prev
^ index
- » next
+ » next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -274,10 +274,10 @@
« prev
^ index
- » next
+ » next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
index 04565e9..67d19c6 100644
--- a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
+++ b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -106,8 +106,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_ae07420627dba52f___init___py.html b/coverage/z_ae07420627dba52f___init___py.html
index 291468a..a10f228 100644
--- a/coverage/z_ae07420627dba52f___init___py.html
+++ b/coverage/z_ae07420627dba52f___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -88,8 +88,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
index 5d381fd..f8659b4 100644
--- a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
+++ b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -105,8 +105,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev
+ « prev
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -86,12 +86,12 @@
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
1name = "biobb_mem"
-2__all__ = ["ambertools", "lipyphilic_biobb", "mdanalysis_biobb"]
+2__all__ = ["ambertools", "fatslim", "lipyphilic_biobb", "mdanalysis_biobb"]
3__version__ = "5.0.1"
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
index 4cd1e7d..01ad3fa 100644
--- a/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
+++ b/coverage/z_7351c2bb23e1f89d_cpptraj_density_py.html
@@ -62,10 +62,10 @@
« prev ^ index - » next + » next - coverage.py v7.6.5, - created at 2024-11-15 08:50 +0000 + coverage.py v7.6.7, + created at 2024-11-21 09:44 +0000
« prev ^ index - » next + » next - coverage.py v7.6.5, - created at 2024-11-15 08:50 +0000 + coverage.py v7.6.7, + created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html index 04565e9..67d19c6 100644 --- a/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html +++ b/coverage/z_855b547dbe724bd1_test_mdanalays_biobb_py.html @@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -106,8 +106,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_ae07420627dba52f___init___py.html b/coverage/z_ae07420627dba52f___init___py.html
index 291468a..a10f228 100644
--- a/coverage/z_ae07420627dba52f___init___py.html
+++ b/coverage/z_ae07420627dba52f___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -88,8 +88,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
index 5d381fd..f8659b4 100644
--- a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
+++ b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -105,8 +105,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev
+ « prev
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -86,12 +86,12 @@
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_ae07420627dba52f___init___py.html b/coverage/z_ae07420627dba52f___init___py.html
index 291468a..a10f228 100644
--- a/coverage/z_ae07420627dba52f___init___py.html
+++ b/coverage/z_ae07420627dba52f___init___py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -88,8 +88,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
index 5d381fd..f8659b4 100644
--- a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
+++ b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -105,8 +105,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev
+ « prev
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -86,12 +86,12 @@
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
index 5d381fd..f8659b4 100644
--- a/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
+++ b/coverage/z_dc747c50d4561ddb_test_lipyphilic_biobb_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -105,8 +105,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev
+ « prev
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -86,12 +86,12 @@
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa___init___py.html b/coverage/z_f1bdb0332341bffa___init___py.html
index b321992..363eee4 100644
--- a/coverage/z_f1bdb0332341bffa___init___py.html
+++ b/coverage/z_f1bdb0332341bffa___init___py.html
@@ -60,12 +60,12 @@
- « prev + « prev ^ index » next - coverage.py v7.6.5, - created at 2024-11-15 08:50 +0000 + coverage.py v7.6.7, + created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
index 845cefd..8ba8ecd 100644
--- a/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
+++ b/coverage/z_f1bdb0332341bffa_lpp_assign_leaflets_py.html
@@ -64,8 +64,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
@@ -82,7 +82,7 @@
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
1#!/usr/bin/env python3
- 3"""Module containing the Cpptraj Density class and the command line interface."""
+ 3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html
+
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html
v4.1.1
Environment
@@ -108,7 +108,7 @@ Summary
1#!/usr/bin/env python3
-3"""Module containing the Cpptraj Density class and the command line interface."""
+3"""Module containing the Lipyphilic AssignLeaflets class and the command line interface."""
4import argparse
5from biobb_common.generic.biobb_object import BiobbObject
6from biobb_common.configuration import settings
@@ -281,8 +281,8 @@
^ index
» next
- coverage.py v7.6.5,
- created at 2024-11-15 08:50 +0000
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
diff --git a/coverage/z_f8ed34ce462c6f56___init___py.html b/coverage/z_f8ed34ce462c6f56___init___py.html
new file mode 100644
index 0000000..d026bc6
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56___init___py.html
@@ -0,0 +1,99 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/__init__.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 2 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1name = "fatslim"
+ 2__all__ = ["fatslim_membranes"]
+
+
+
+
diff --git a/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
new file mode 100644
index 0000000..722e469
--- /dev/null
+++ b/coverage/z_f8ed34ce462c6f56_fatslim_membranes_py.html
@@ -0,0 +1,291 @@
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py: 0%
+
+
+
+
+
+
+
+
+ Coverage for biobb_mem/fatslim/fatslim_membranes.py:
+ 0%
+
+
+
+
+
+ Shortcuts on this page
+
+
+ r
+ m
+ x
+ toggle line displays
+
+
+ j
+ k
+ next/prev highlighted chunk
+
+
+ 0 (zero) top of page
+
+
+ 1 (one) first highlighted chunk
+
+
+ [
+ ]
+ prev/next file
+
+
+ u up to the index
+
+
+ ? show/hide this help
+
+
+
+
+
+ 69 statements
+
+
+
+
+
+ « prev
+ ^ index
+ » next
+
+ coverage.py v7.6.7,
+ created at 2024-11-21 09:44 +0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1#!/usr/bin/env python3
+
+ 3"""Module containing the FATSLiM Membranes class and the command line interface."""
+ 4import argparse
+ 5from pathlib import PurePath
+ 6from biobb_common.generic.biobb_object import BiobbObject
+ 7from biobb_common.configuration import settings
+ 8from biobb_common.tools.file_utils import launchlogger
+ 9from biobb_common.tools import file_utils as fu
+ 10import MDAnalysis as mda
+ 11import os
+
+
+ 14class FatslimMembranes(BiobbObject):
+ 15 """
+ 16 | biobb_mem FatslimMembranes
+ 17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+ 18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+
+ 20 Args:
+ 21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+ 22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+ 23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+ 24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+ 25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+ 26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+ 27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+ 28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+ 29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+ 30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+
+ 32 Examples:
+ 33 This is a use example of how to use the building block from Python::
+
+ 35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+ 36 prop = {
+ 37 'selection': '(resname DPPC and name P8)',
+ 38 'cutoff': 2.2
+ 39 }
+ 40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+ 41 input_traj_path='/path/to/myTrajectory.xtc',
+ 42 output_ndx_path='/path/to/newIndex.ndx',
+ 43 properties=prop)
+
+ 45 Info:
+ 46 * wrapped_software:
+ 47 * name: FATSLiM
+ 48 * version: 0.2.2
+ 49 * license: GNU
+ 50 * ontology:
+ 51 * name: EDAM
+ 52 * schema: http://edamontology.org/EDAM.owl
+
+ 54 """
+
+ 56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+ 57 properties = properties or {}
+
+ 59 # Call parent class constructor
+ 60 super().__init__(properties)
+ 61 self.locals_var_dict = locals().copy()
+
+ 63 # Input/Output files
+ 64 self.io_dict = {
+ 65 "in": {"input_top_path": input_top_path,
+ 66 "input_traj_path": input_traj_path},
+ 67 "out": {"output_ndx_path": output_ndx_path}
+ 68 }
+
+ 70 # Properties specific for BB
+ 71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+ 72 self.cutoff = properties.get('cutoff', 2.2)
+ 73 self.binary_path = properties.get('binary_path', 'fatslim')
+ 74 self.properties = properties
+
+ 76 # Check the properties
+ 77 self.check_properties(properties)
+ 78 self.check_arguments()
+
+ 80 @launchlogger
+ 81 def launch(self) -> int:
+ 82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+
+ 84 # Setup Biobb
+ 85 if self.check_restart():
+ 86 return 0
+ 87 self.stage_files()
+
+ 89 # Create index file using MDAnalysis
+ 90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+ 91 self.stage_io_dict["in"]["input_traj_path"])
+ 92 # Build the index to select the atoms from the membrane
+ 93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+ 94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+ 95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+ 96 # Convert topology .gro and add box dimensions if not available in the topology
+ 97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+ 98 self.cmd = ['gmx', 'editconf',
+ 99 '-f', self.stage_io_dict["in"]["input_top_path"],
+ 100 '-o ', self.tmp_cfg,
+ 101 '-box', ' '.join(map(str, u.dimensions[:3]))
+ 102 ]
+ 103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+ 104 # Build command
+ 105 self.cmd.extend([
+ 106 ';',
+ 107 self.binary_path, "membranes",
+ 108 "-c", self.tmp_cfg,
+ 109 "-n", self.tmp_ndx,
+ 110 "--output-index", self.tmp_out,
+ 111 "--cutoff", str(self.cutoff)
+ 112 ])
+
+ 114 # Run Biobb block
+ 115 self.run_biobb()
+ 116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+ 117 # Copy files to host
+ 118 self.copy_to_host()
+
+ 120 # Remove temporary files
+ 121 self.tmp_files.extend([
+ 122 self.stage_io_dict.get("unique_dir"),
+ 123 PurePath(self.tmp_ndx).parent,
+ 124 PurePath(self.tmp_cfg).parent,
+ 125 PurePath(self.tmp_out).parent
+ 126 ])
+ 127 self.remove_tmp_files()
+
+ 129 self.check_arguments(output_files_created=True, raise_exception=False)
+
+ 131 return self.return_code
+
+ 133 @staticmethod
+ 134 def parse_index(ndx):
+ 135 """
+ 136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+ 137 Args:
+ 138 ndx (str): Path to the GROMACS index file (.ndx).
+ 139 Returns:
+ 140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+ 141 """
+
+ 143 # Read the leaflet.ndx file
+ 144 with open(ndx, 'r') as file:
+ 145 leaflet_data = file.readlines()
+
+ 147 # Initialize dictionaries to store leaflet groups
+ 148 leaflet_groups = {}
+ 149 current_group = None
+
+ 151 # Parse the leaflet.ndx file
+ 152 for line in leaflet_data:
+ 153 line = line.strip()
+ 154 if line.startswith('[') and line.endswith(']'):
+ 155 current_group = line[1:-1].strip()
+ 156 leaflet_groups[current_group] = []
+ 157 elif current_group is not None:
+ 158 leaflet_groups[current_group].extend(map(int, line.split()))
+ 159 return leaflet_groups
+
+
+ 162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+ 163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+ 164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+
+ 166 return FatslimMembranes(input_top_path=input_top_path,
+ 167 input_traj_path=input_traj_path,
+ 168 output_ndx_path=output_ndx_path,
+ 169 properties=properties, **kwargs).launch()
+
+
+ 172def main():
+ 173 """Command line execution of this building block. Please check the command line documentation."""
+ 174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+ 175 parser.add_argument('--config', required=False, help='Configuration file')
+
+ 177 # Specific args of each building block
+ 178 required_args = parser.add_argument_group('required arguments')
+ 179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+ 180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+ 181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+
+ 183 args = parser.parse_args()
+ 184 args.config = args.config or "{}"
+ 185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+
+ 187 # Specific call of each building block
+ 188 fatslim_membranes(input_top_path=args.input_top_path,
+ 189 output_ndx_path=args.output_ndx_path,
+ 190 properties=properties)
+
+
+ 193if __name__ == '__main__':
+ 194 main()
+
+
+
+
diff --git a/flake8/index.html b/flake8/index.html
index e85992a..1b8b306 100644
--- a/flake8/index.html
+++ b/flake8/index.html
@@ -9,7 +9,7 @@
flake8 violations
- Generated on 2024-11-15 08:49
+
Generated on 2024-11-21 09:44
with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
@@ -20,7 +20,7 @@ flake8 violations
✓
All good!
- No flake8 errors found in 15 files scanned.
+ No flake8 errors found in 17 files scanned.
diff --git a/junit/junit.xml b/junit/junit.xml
index f4c92fd..02dbd40 100644
--- a/junit/junit.xml
+++ b/junit/junit.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/junit/report.html b/junit/report.html
index 2842eb1..01b26ae 100644
--- a/junit/report.html
+++ b/junit/report.html
@@ -7,7 +7,7 @@
report.html
-
+ Coverage for biobb_mem/fatslim/__init__.py: + 0% +
+Shortcuts on this page
++ r + m + x + toggle line displays +
++ j + k + next/prev highlighted chunk +
++ 0 (zero) top of page +
++ 1 (one) first highlighted chunk +
++ [ + ] + prev/next file +
++ u up to the index +
++ ? show/hide this help +
++ 2 statements + + + +
++ « prev + ^ index + » next + + coverage.py v7.6.7, + created at 2024-11-21 09:44 +0000 +
+1name = "fatslim"
+2__all__ = ["fatslim_membranes"]
++ Coverage for biobb_mem/fatslim/fatslim_membranes.py: + 0% +
+Shortcuts on this page
++ r + m + x + toggle line displays +
++ j + k + next/prev highlighted chunk +
++ 0 (zero) top of page +
++ 1 (one) first highlighted chunk +
++ [ + ] + prev/next file +
++ u up to the index +
++ ? show/hide this help +
++ 69 statements + + + +
++ « prev + ^ index + » next + + coverage.py v7.6.7, + created at 2024-11-21 09:44 +0000 +
+1#!/usr/bin/env python3
+ +3"""Module containing the FATSLiM Membranes class and the command line interface."""
+4import argparse
+5from pathlib import PurePath
+6from biobb_common.generic.biobb_object import BiobbObject
+7from biobb_common.configuration import settings
+8from biobb_common.tools.file_utils import launchlogger
+9from biobb_common.tools import file_utils as fu
+10import MDAnalysis as mda
+11import os
+ + +14class FatslimMembranes(BiobbObject):
+15 """
+16 | biobb_mem FatslimMembranes
+17 | Wrapper of the `FATSLiM membranes <https://pythonhosted.org/fatslim/documentation/leaflets.html>`_ module for leaflet and membrane identification.
+18 | FATSLiM is designed to provide efficient and robust analysis of physical parameters from MD trajectories, with a focus on processing large trajectory files quickly.
+ +20 Args:
+21 input_top_path (str): Path to the input topology file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.pdb>`_. Accepted formats: tpr (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), brk (edam:format_2033), ent (edam:format_1476).
+22 input_traj_path (str): Path to the GROMACS trajectory file. File type: input. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.xtc>`_. Accepted formats: xtc (edam:format_3875), trr (edam:format_3910), cpt (edam:format_2333), gro (edam:format_2033), g96 (edam:format_2033), pdb (edam:format_1476), tng (edam:format_3876).
+23 output_ndx_path (str): Path to the output index NDX file. File type: output. `Sample file <https://github.com/bioexcel/biobb_mem/raw/master/biobb_mem/test/data/A01JD/A01JD.ndx>`_. Accepted formats: ndx (edam:format_2033).
+24 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
+25 * **selection** (*str*) - ("resname DPPC and element P") Molecules used in the identification using MDAnalysis selection language.
+26 * **cutoff** (*float*) - (2) Cutoff distance (in nm) to be used when leaflet identification is performed.
+27 * **binary_path** (*str*) - ("fatslim") Path to the fatslim executable binary.
+28 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
+29 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
+30 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
+ +32 Examples:
+33 This is a use example of how to use the building block from Python::
+ +35 from biobb_mem.fatslim.fatslim_membranes import fatslim_membranes
+36 prop = {
+37 'selection': '(resname DPPC and name P8)',
+38 'cutoff': 2.2
+39 }
+40 fatslim_membranes(input_top_path='/path/to/myTopology.tpr',
+41 input_traj_path='/path/to/myTrajectory.xtc',
+42 output_ndx_path='/path/to/newIndex.ndx',
+43 properties=prop)
+ +45 Info:
+46 * wrapped_software:
+47 * name: FATSLiM
+48 * version: 0.2.2
+49 * license: GNU
+50 * ontology:
+51 * name: EDAM
+52 * schema: http://edamontology.org/EDAM.owl
+ +54 """
+ +56 def __init__(self, input_top_path, input_traj_path, output_ndx_path, properties=None, **kwargs) -> None:
+57 properties = properties or {}
+ +59 # Call parent class constructor
+60 super().__init__(properties)
+61 self.locals_var_dict = locals().copy()
+ +63 # Input/Output files
+64 self.io_dict = {
+65 "in": {"input_top_path": input_top_path,
+66 "input_traj_path": input_traj_path},
+67 "out": {"output_ndx_path": output_ndx_path}
+68 }
+ +70 # Properties specific for BB
+71 self.selection = properties.get('selection', "resname DPPC or resname POPC) and element P")
+72 self.cutoff = properties.get('cutoff', 2.2)
+73 self.binary_path = properties.get('binary_path', 'fatslim')
+74 self.properties = properties
+ +76 # Check the properties
+77 self.check_properties(properties)
+78 self.check_arguments()
+ +80 @launchlogger
+81 def launch(self) -> int:
+82 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` fatslim.fatslim_membranes.FatslimMembranes object."""
+ +84 # Setup Biobb
+85 if self.check_restart():
+86 return 0
+87 self.stage_files()
+ +89 # Create index file using MDAnalysis
+90 u = mda.Universe(self.stage_io_dict["in"]["input_top_path"],
+91 self.stage_io_dict["in"]["input_traj_path"])
+92 # Build the index to select the atoms from the membrane
+93 self.tmp_ndx = str(PurePath(fu.create_unique_dir()).joinpath('headgroups.ndx'))
+94 with mda.selections.gromacs.SelectionWriter(self.tmp_ndx, mode='w') as ndx:
+95 ndx.write(u.select_atoms(self.selection), name='headgroups')
+96 # Convert topology .gro and add box dimensions if not available in the topology
+97 self.tmp_cfg = str(PurePath(fu.create_unique_dir()).joinpath('output.gro'))
+98 self.cmd = ['gmx', 'editconf',
+99 '-f', self.stage_io_dict["in"]["input_top_path"],
+100 '-o ', self.tmp_cfg,
+101 '-box', ' '.join(map(str, u.dimensions[:3]))
+102 ]
+103 self.tmp_out = str(PurePath(fu.create_unique_dir()).joinpath('output.ndx'))
+104 # Build command
+105 self.cmd.extend([
+106 ';',
+107 self.binary_path, "membranes",
+108 "-c", self.tmp_cfg,
+109 "-n", self.tmp_ndx,
+110 "--output-index", self.tmp_out,
+111 "--cutoff", str(self.cutoff)
+112 ])
+ +114 # Run Biobb block
+115 self.run_biobb()
+116 os.rename(self.tmp_out[:-4]+'_0000.ndx', self.stage_io_dict["out"]["output_ndx_path"])
+117 # Copy files to host
+118 self.copy_to_host()
+ +120 # Remove temporary files
+121 self.tmp_files.extend([
+122 self.stage_io_dict.get("unique_dir"),
+123 PurePath(self.tmp_ndx).parent,
+124 PurePath(self.tmp_cfg).parent,
+125 PurePath(self.tmp_out).parent
+126 ])
+127 self.remove_tmp_files()
+ +129 self.check_arguments(output_files_created=True, raise_exception=False)
+ +131 return self.return_code
+ +133 @staticmethod
+134 def parse_index(ndx):
+135 """
+136 Parses a GROMACS index file (.ndx) to extract leaflet groups.
+137 Args:
+138 ndx (str): Path to the GROMACS index file (.ndx).
+139 Returns:
+140 dict: A dictionary where keys are group names and values are lists of integers representing atom indices.
+141 """
+ +143 # Read the leaflet.ndx file
+144 with open(ndx, 'r') as file:
+145 leaflet_data = file.readlines()
+ +147 # Initialize dictionaries to store leaflet groups
+148 leaflet_groups = {}
+149 current_group = None
+ +151 # Parse the leaflet.ndx file
+152 for line in leaflet_data:
+153 line = line.strip()
+154 if line.startswith('[') and line.endswith(']'):
+155 current_group = line[1:-1].strip()
+156 leaflet_groups[current_group] = []
+157 elif current_group is not None:
+158 leaflet_groups[current_group].extend(map(int, line.split()))
+159 return leaflet_groups
+ + +162def fatslim_membranes(input_top_path: str, input_traj_path: str, output_ndx_path: str, properties: dict = None, **kwargs) -> int:
+163 """Execute the :class:`FatslimMembranes <fatslim.fatslim_membranes.FatslimMembranes>` class and
+164 execute the :meth:`launch() <fatslim.fatslim_membranes.FatslimMembranes.launch>` method."""
+ +166 return FatslimMembranes(input_top_path=input_top_path,
+167 input_traj_path=input_traj_path,
+168 output_ndx_path=output_ndx_path,
+169 properties=properties, **kwargs).launch()
+ + +172def main():
+173 """Command line execution of this building block. Please check the command line documentation."""
+174 parser = argparse.ArgumentParser(description="Calculates the density along an axis of a given cpptraj compatible trajectory.", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999))
+175 parser.add_argument('--config', required=False, help='Configuration file')
+ +177 # Specific args of each building block
+178 required_args = parser.add_argument_group('required arguments')
+179 required_args.add_argument('--input_top_path', required=True, help='Path to the input structure or topology file. Accepted formats: ent, gro, pdb, tpr.')
+180 required_args.add_argument('--input_traj_path', required=True, help='Path to the input trajectory to be processed. Accepted formats: gro, pdb, tng, trr, xtc.')
+181 required_args.add_argument('--output_ndx_path', required=True, help='Path to the GROMACS index file. Accepted formats: ndx')
+ +183 args = parser.parse_args()
+184 args.config = args.config or "{}"
+185 properties = settings.ConfReader(config=args.config).get_prop_dic()
+ +187 # Specific call of each building block
+188 fatslim_membranes(input_top_path=args.input_top_path,
+189 output_ndx_path=args.output_ndx_path,
+190 properties=properties)
+ + +193if __name__ == '__main__':
+194 main()
+flake8 violations
-Generated on 2024-11-15 08:49 +
Generated on 2024-11-21 09:44 with Installed plugins: flake8-html: 0.4.3, mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0
-
@@ -20,7 +20,7 @@
flake8 violations
✓All good!
-No flake8 errors found in 15 files scanned.
+No flake8 errors found in 17 files scanned.
Report generated on 15-Nov-2024 at 08:50:15 by pytest-html +
Report generated on 21-Nov-2024 at 09:44:16 by pytest-html v4.1.1