From 109c6c1a641bc110d99522bcc7055392b9802a75 Mon Sep 17 00:00:00 2001 From: Pau Andrio Date: Tue, 19 Nov 2024 15:40:53 +0100 Subject: [PATCH] 2024.2 --- README.md | 14 +- biobb_godmd/__init__.py | 1 + biobb_godmd/docs/source/change_log.md | 14 + biobb_godmd/docs/source/conf.py | 190 ++++++------ biobb_godmd/docs/source/readme.md | 14 +- biobb_godmd/docs/source/schema.html | 4 +- biobb_godmd/godmd/godmd_run.py | 349 ++++++++++++++++------ biobb_godmd/json_schemas/biobb_godmd.json | 56 ++-- setup.py | 18 +- 9 files changed, 416 insertions(+), 244 deletions(-) diff --git a/README.md b/README.md index 2e2db0d..e21537b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![](https://img.shields.io/conda/vn/bioconda/biobb_godmd?label=Conda)](https://anaconda.org/bioconda/biobb_godmd) [![](https://img.shields.io/conda/dn/bioconda/biobb_godmd?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_godmd) [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_godmd?tab=tags) -[![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_godmd:4.2.0--pyhdfd78af_0) +[![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_godmd:5.0.0--pyhdfd78af_0) [![](https://img.shields.io/badge/OS-Unix%20%7C%20MacOS-blue)](https://github.com/bioexcel/biobb_godmd) [![](https://img.shields.io/pypi/pyversions/biobb-godmd.svg?label=Python%20Versions)](https://pypi.org/project/biobb-godmd/) @@ -41,7 +41,7 @@ The latest documentation of this package can be found in our readthedocs site: [latest API documentation](http://biobb-godmd.readthedocs.io/en/latest/). ### Version -v4.2.0 2024.1 +v5.0.0 2024.1 ### Installation Using PIP: @@ -51,7 +51,7 @@ Using PIP: * Installation: - pip install "biobb_godmd>=4.2.0" + pip install "biobb_godmd>=5.0.0" * Usage: [Python API documentation](https://biobb-godmd.readthedocs.io/en/latest/modules.html) @@ -61,7 +61,7 @@ Using ANACONDA: * Installation: - conda install -c bioconda "biobb_godmd>=4.2.0" + conda install -c bioconda "biobb_godmd>=5.0.0" * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb-godmd.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb-godmd.readthedocs.io/en/latest/command_line.html) @@ -71,13 +71,13 @@ Using DOCKER: * Installation: - docker pull quay.io/biocontainers/biobb_godmd:4.2.0--pyhdfd78af_0 + docker pull quay.io/biocontainers/biobb_godmd:5.0.0--pyhdfd78af_0 * Usage: - docker run quay.io/biocontainers/biobb_godmd:4.2.0--pyhdfd78af_0 + docker run quay.io/biocontainers/biobb_godmd:5.0.0--pyhdfd78af_0 Using SINGULARITY: @@ -87,7 +87,7 @@ Using SINGULARITY: * Installation: - singularity pull --name biobb_godmd.sif https://depot.galaxyproject.org/singularity/biobb_godmd:4.2.0--pyhdfd78af_0 + singularity pull --name biobb_godmd.sif https://depot.galaxyproject.org/singularity/biobb_godmd:5.0.0--pyhdfd78af_0 * Usage: diff --git a/biobb_godmd/__init__.py b/biobb_godmd/__init__.py index 0b216b2..e7e4c35 100644 --- a/biobb_godmd/__init__.py +++ b/biobb_godmd/__init__.py @@ -1,4 +1,5 @@ from . import godmd + name = "biobb_godmd" __all__ = ["godmd"] __version__ = "4.2.0" diff --git a/biobb_godmd/docs/source/change_log.md b/biobb_godmd/docs/source/change_log.md index e9778eb..e8743f5 100644 --- a/biobb_godmd/docs/source/change_log.md +++ b/biobb_godmd/docs/source/change_log.md @@ -1,5 +1,19 @@ # Biobb GOdMD changelog +## What's new in version [5.0.0](https://github.com/bioexcel/biobb_godmd/releases/tag/v5.0.0)? + +### Changes + +* [CI/CD](env.yaml): Update biobb_common version. +* [CI/CD](linting_and_testing.yml): Update set-up micromamba. +* [Typing](ALL): Update typing from python 3.8 style to python 3.9 +* [CI/CD](linting_and_testing): Update GA test workflow to Python >3.9 +* [TYPING](ALL): Fix typing errors +* [DOCS](.readthedocs.yaml): Updating to Python 3.9 +* [FEATURE](__init__): Importing submodules when a module is loaded +* [CI/CD](godmd): Adapting conf.yml to the new confReader + + ## What's new in version [4.2.0](https://github.com/bioexcel/biobb_godmd/releases/tag/v4.2.0)? In version 4.2.0 the dependency biobb_common has been updated to 4.2.0 version. diff --git a/biobb_godmd/docs/source/conf.py b/biobb_godmd/docs/source/conf.py index 6372610..b9edeab 100644 --- a/biobb_godmd/docs/source/conf.py +++ b/biobb_godmd/docs/source/conf.py @@ -18,24 +18,24 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, str(Path('../../').resolve())) +sys.path.insert(0, str(Path("../../").resolve())) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.coverage', - 'sphinx.ext.mathjax', - 'sphinx.ext.ifconfig', - 'sphinx.ext.viewcode', - 'sphinx.ext.napoleon', - 'recommonmark' + "sphinx.ext.autodoc", + "sphinx.ext.coverage", + "sphinx.ext.mathjax", + "sphinx.ext.ifconfig", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "recommonmark", ] # Using Google docstring style @@ -43,45 +43,44 @@ napoleon_google_docstring = True - # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] # -- Integrate markdown --------------------------------------------------- -#source_parsers = { +# source_parsers = { # '.md': 'recommonmark.parser.CommonMarkParser', -#} +# } -source_suffix = ['.rst', '.md'] +source_suffix = [".rst", ".md"] -#source_suffix = { +# source_suffix = { # '.rst': 'restructuredtext', # '.md': 'markdown', -#} +# } # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'biobb_godmd' -copyright = u'2024, Bioexcel Project' -author = u'Bioexcel Project' +project = "biobb_godmd" +copyright = "2024, Bioexcel Project" +author = "Bioexcel Project" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'4.2.0' +version = "5.0.0" # The full version, including alpha/beta/rc tags. -release = u'4.2.0' +release = "5.0.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -92,37 +91,37 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = [] +exclude_patterns: list = [] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -130,163 +129,162 @@ # -- Options for HTML output ---------------------------------------------- def setup(app): - #app.add_stylesheet('theme_overrides.css') - app.add_css_file('theme_overrides.css') - app.add_js_file('theme_overrides.js') + # app.add_stylesheet('theme_overrides.css') + app.add_css_file("theme_overrides.css") + app.add_js_file("theme_overrides.js") # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' +# html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} +# html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' +# html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'biobb_godmd_doc' +htmlhelp_basename = "biobb_godmd_doc" # -- Options for LaTeX output --------------------------------------------- -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', - -# Latex figure (float) alignment -#'figure_align': 'htbp', +latex_elements: dict = { + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + #'preamble': '', + # Latex figure (float) alignment + #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'biobb_godmd.tex', u'biobb_godmd Documentation', - u'Bioexcel Project', 'manual'), + ( + master_doc, + "biobb_godmd.tex", + "biobb_godmd Documentation", + "Bioexcel Project", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'biobb_godmd', u'biobb_godmd Documentation', - [author], 1) -] +man_pages = [(master_doc, "biobb_godmd", "biobb_godmd Documentation", [author], 1)] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -295,19 +293,25 @@ def setup(app): # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'biobb_godmd', u'biobb_godmd Documentation', - author, 'biobb_godmd', 'biobb_godmd template building block', - 'Miscellaneous'), + ( + master_doc, + "biobb_godmd", + "biobb_godmd Documentation", + author, + "biobb_godmd", + "biobb_godmd template building block", + "Miscellaneous", + ), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False diff --git a/biobb_godmd/docs/source/readme.md b/biobb_godmd/docs/source/readme.md index 2e2db0d..e21537b 100644 --- a/biobb_godmd/docs/source/readme.md +++ b/biobb_godmd/docs/source/readme.md @@ -3,7 +3,7 @@ [![](https://img.shields.io/conda/vn/bioconda/biobb_godmd?label=Conda)](https://anaconda.org/bioconda/biobb_godmd) [![](https://img.shields.io/conda/dn/bioconda/biobb_godmd?label=Conda%20Downloads)](https://anaconda.org/bioconda/biobb_godmd) [![](https://img.shields.io/badge/Docker-Quay.io-blue)](https://quay.io/repository/biocontainers/biobb_godmd?tab=tags) -[![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_godmd:4.2.0--pyhdfd78af_0) +[![](https://img.shields.io/badge/Singularity-GalaxyProject-blue)](https://depot.galaxyproject.org/singularity/biobb_godmd:5.0.0--pyhdfd78af_0) [![](https://img.shields.io/badge/OS-Unix%20%7C%20MacOS-blue)](https://github.com/bioexcel/biobb_godmd) [![](https://img.shields.io/pypi/pyversions/biobb-godmd.svg?label=Python%20Versions)](https://pypi.org/project/biobb-godmd/) @@ -41,7 +41,7 @@ The latest documentation of this package can be found in our readthedocs site: [latest API documentation](http://biobb-godmd.readthedocs.io/en/latest/). ### Version -v4.2.0 2024.1 +v5.0.0 2024.1 ### Installation Using PIP: @@ -51,7 +51,7 @@ Using PIP: * Installation: - pip install "biobb_godmd>=4.2.0" + pip install "biobb_godmd>=5.0.0" * Usage: [Python API documentation](https://biobb-godmd.readthedocs.io/en/latest/modules.html) @@ -61,7 +61,7 @@ Using ANACONDA: * Installation: - conda install -c bioconda "biobb_godmd>=4.2.0" + conda install -c bioconda "biobb_godmd>=5.0.0" * Usage: With conda installation BioBBs can be used with the [Python API documentation](https://biobb-godmd.readthedocs.io/en/latest/modules.html) and the [Command Line documentation](https://biobb-godmd.readthedocs.io/en/latest/command_line.html) @@ -71,13 +71,13 @@ Using DOCKER: * Installation: - docker pull quay.io/biocontainers/biobb_godmd:4.2.0--pyhdfd78af_0 + docker pull quay.io/biocontainers/biobb_godmd:5.0.0--pyhdfd78af_0 * Usage: - docker run quay.io/biocontainers/biobb_godmd:4.2.0--pyhdfd78af_0 + docker run quay.io/biocontainers/biobb_godmd:5.0.0--pyhdfd78af_0 Using SINGULARITY: @@ -87,7 +87,7 @@ Using SINGULARITY: * Installation: - singularity pull --name biobb_godmd.sif https://depot.galaxyproject.org/singularity/biobb_godmd:4.2.0--pyhdfd78af_0 + singularity pull --name biobb_godmd.sif https://depot.galaxyproject.org/singularity/biobb_godmd:5.0.0--pyhdfd78af_0 * Usage: diff --git a/biobb_godmd/docs/source/schema.html b/biobb_godmd/docs/source/schema.html index 75d4942..e79d857 100644 --- a/biobb_godmd/docs/source/schema.html +++ b/biobb_godmd/docs/source/schema.html @@ -10,7 +10,7 @@ "applicationSubCategory": "http://www.edamontology.org/topic_3892", "citation": "https://www.nature.com/articles/s41597-019-0177-4", "license": "https://www.apache.org/licenses/LICENSE-2.0", - "softwareVersion": "4.2.0", + "softwareVersion": "5.0.0", "applicationSuite": "BioBB BioExcel Building Blocks", "codeRepository": "https://github.com/bioexcel/biobb_godmd", "isAccessibleForFree": "True", @@ -22,4 +22,4 @@ "priceCurrency":"EUR" } } - + \ No newline at end of file diff --git a/biobb_godmd/godmd/godmd_run.py b/biobb_godmd/godmd/godmd_run.py index e9a18c5..2deb588 100755 --- a/biobb_godmd/godmd/godmd_run.py +++ b/biobb_godmd/godmd/godmd_run.py @@ -1,14 +1,16 @@ #!/usr/bin/env python3 """Module containing the GOdMDRun class and the command line interface.""" + import argparse -from typing import Optional import shutil -from pathlib import Path -from pathlib import PurePath -from biobb_common.generic.biobb_object import BiobbObject +from pathlib import Path, PurePath +from typing import Optional + from biobb_common.configuration import settings +from biobb_common.generic.biobb_object import BiobbObject from biobb_common.tools.file_utils import launchlogger + from biobb_godmd.godmd.common import check_input_path, check_output_path @@ -63,11 +65,20 @@ class GOdMDRun(BiobbObject): """ - def __init__(self, input_pdb_orig_path: str, input_pdb_target_path: str, - input_aln_orig_path: str, input_aln_target_path: str, input_config_path: str, - output_log_path: str, output_ene_path: str, output_trj_path: str, output_pdb_path: str, - properties: Optional[dict] = None, **kwargs) -> None: - + def __init__( + self, + input_pdb_orig_path: str, + input_pdb_target_path: str, + input_aln_orig_path: str, + input_aln_target_path: str, + input_config_path: Optional[str], + output_log_path: str, + output_ene_path: str, + output_trj_path: str, + output_pdb_path: str, + properties: Optional[dict] = None, + **kwargs, + ) -> None: properties = properties or {} # Call parent class constructor @@ -76,53 +87,111 @@ def __init__(self, input_pdb_orig_path: str, input_pdb_target_path: str, # Input/Output files self.io_dict = { - 'in': {'input_pdb_orig_path': input_pdb_orig_path, - 'input_pdb_target_path': input_pdb_target_path, - 'input_aln_orig_path': input_aln_orig_path, - 'input_aln_target_path': input_aln_target_path, - 'input_config_path': input_config_path}, - 'out': {'output_log_path': output_log_path, - 'output_ene_path': output_ene_path, - 'output_trj_path': output_trj_path, - 'output_pdb_path': output_pdb_path} + "in": { + "input_pdb_orig_path": input_pdb_orig_path, + "input_pdb_target_path": input_pdb_target_path, + "input_aln_orig_path": input_aln_orig_path, + "input_aln_target_path": input_aln_target_path, + "input_config_path": input_config_path, + }, + "out": { + "output_log_path": output_log_path, + "output_ene_path": output_ene_path, + "output_trj_path": output_trj_path, + "output_pdb_path": output_pdb_path, + }, } # Properties specific for BB self.properties = properties - self.godmdin = {k: str(v) for k, v in properties.get('godmdin', dict()).items()} - self.binary_path = properties.get('binary_path', "discrete") + self.godmdin = {k: str(v) for k, v in properties.get("godmdin", dict()).items()} + self.binary_path = properties.get("binary_path", "discrete") # Check the properties self.check_properties(properties) # self.check_arguments() def check_data_params(self, out_log, out_err): - """ Checks input/output paths correctness """ + """Checks input/output paths correctness""" # Check input(s) - self.io_dict["in"]["input_pdb_orig_path"] = check_input_path(self.io_dict["in"]["input_pdb_orig_path"], "input_pdb_orig_path", False, out_log, self.__class__.__name__) - self.io_dict["in"]["input_pdb_target_path"] = check_input_path(self.io_dict["in"]["input_pdb_target_path"], "input_pdb_target_path", False, out_log, self.__class__.__name__) - self.io_dict["in"]["input_aln_orig_path"] = check_input_path(self.io_dict["in"]["input_aln_orig_path"], "input_aln_orig_path", False, out_log, self.__class__.__name__) - self.io_dict["in"]["input_aln_target_path"] = check_input_path(self.io_dict["in"]["input_aln_target_path"], "input_aln_target_path", False, out_log, self.__class__.__name__) - self.io_dict["in"]["input_config_path"] = check_input_path(self.io_dict["in"]["input_config_path"], "input_config_path", True, out_log, self.__class__.__name__) + self.io_dict["in"]["input_pdb_orig_path"] = check_input_path( + self.io_dict["in"]["input_pdb_orig_path"], + "input_pdb_orig_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["in"]["input_pdb_target_path"] = check_input_path( + self.io_dict["in"]["input_pdb_target_path"], + "input_pdb_target_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["in"]["input_aln_orig_path"] = check_input_path( + self.io_dict["in"]["input_aln_orig_path"], + "input_aln_orig_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["in"]["input_aln_target_path"] = check_input_path( + self.io_dict["in"]["input_aln_target_path"], + "input_aln_target_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["in"]["input_config_path"] = check_input_path( + self.io_dict["in"]["input_config_path"], + "input_config_path", + True, + out_log, + self.__class__.__name__, + ) # Check output(s) - self.io_dict["out"]["output_log_path"] = check_output_path(self.io_dict["out"]["output_log_path"], "output_log_path", False, out_log, self.__class__.__name__) - self.io_dict["out"]["output_ene_path"] = check_output_path(self.io_dict["out"]["output_ene_path"], "output_ene_path", False, out_log, self.__class__.__name__) - self.io_dict["out"]["output_trj_path"] = check_output_path(self.io_dict["out"]["output_trj_path"], "output_trj_path", False, out_log, self.__class__.__name__) - self.io_dict["out"]["output_pdb_path"] = check_output_path(self.io_dict["out"]["output_pdb_path"], "output_pdb_path", False, out_log, self.__class__.__name__) - - def create_godmdin(self, path: str = None) -> str: + self.io_dict["out"]["output_log_path"] = check_output_path( + self.io_dict["out"]["output_log_path"], + "output_log_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["out"]["output_ene_path"] = check_output_path( + self.io_dict["out"]["output_ene_path"], + "output_ene_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["out"]["output_trj_path"] = check_output_path( + self.io_dict["out"]["output_trj_path"], + "output_trj_path", + False, + out_log, + self.__class__.__name__, + ) + self.io_dict["out"]["output_pdb_path"] = check_output_path( + self.io_dict["out"]["output_pdb_path"], + "output_pdb_path", + False, + out_log, + self.__class__.__name__, + ) + + def create_godmdin(self, path: Optional[str] = None) -> str: """Creates a GOdMD configuration file (godmdin) using the properties file settings""" godmdin_list = [] self.output_godmdin_path = path - if self.io_dict['in']['input_config_path']: + if self.io_dict["in"]["input_config_path"]: # GOdMD input parameters read from an input godmdin file - with open(self.io_dict['in']['input_config_path']) as input_params: + with open(self.io_dict["in"]["input_config_path"]) as input_params: for line in input_params: - if '=' in line: + if "=" in line: godmdin_list.append(line.upper()) else: # Pre-configured simulation type parameters @@ -131,23 +200,38 @@ def create_godmdin(self, path: str = None) -> str: godmdin_list.append(" SEED = 2525 ! BioBB GOdMD default params \n") godmdin_list.append(" ENER_EVO_SIZE = 20 ! BioBB GOdMD default params \n") godmdin_list.append(" NBLOC = 10000 ! BioBB GOdMD default params \n") - godmdin_list.append(" ERRORACCEPTABLE = 1.5 ! BioBB GOdMD default params \n") + godmdin_list.append( + " ERRORACCEPTABLE = 1.5 ! BioBB GOdMD default params \n" + ) # Adding the rest of parameters in the config file to the mdin file # if the parameter has already been added replace the value - parameter_keys = [parameter.split('=')[0].strip() for parameter in godmdin_list] + parameter_keys = [parameter.split("=")[0].strip() for parameter in godmdin_list] for k, v in self.godmdin.items(): config_parameter_key = str(k).strip().upper() if config_parameter_key in parameter_keys: - godmdin_list[parameter_keys.index(config_parameter_key)] = '\t' + config_parameter_key + ' = ' + str(v) + ' ! BioBB property \n' + godmdin_list[parameter_keys.index(config_parameter_key)] = ( + "\t" + + config_parameter_key + + " = " + + str(v) + + " ! BioBB property \n" + ) else: - godmdin_list.append('\t' + config_parameter_key + ' = '+str(v) + ' ! BioBB property \n') + godmdin_list.append( + "\t" + + config_parameter_key + + " = " + + str(v) + + " ! BioBB property \n" + ) # Writing MD configuration file (mdin) - with open(self.output_godmdin_path, 'w') as godmdin: - + with open(str(self.output_godmdin_path), "w") as godmdin: # GOdMDIN parameters added by the biobb_godmd module - godmdin.write("!This godmdin file has been created by the biobb_godmd module from the BioBB library \n\n") + godmdin.write( + "!This godmdin file has been created by the biobb_godmd module from the BioBB library \n\n" + ) godmdin.write("&INPUT\n") @@ -157,7 +241,7 @@ def create_godmdin(self, path: str = None) -> str: godmdin.write("&END\n") - return self.output_godmdin_path + return str(self.output_godmdin_path) @launchlogger def launch(self): @@ -172,34 +256,53 @@ def launch(self): self.stage_files() # Creating GOdMD input file - self.output_godmdin_path = self.create_godmdin(path=str(Path(self.stage_io_dict["unique_dir"]).joinpath("godmd.in"))) + self.output_godmdin_path = self.create_godmdin( + path=str(Path(self.stage_io_dict["unique_dir"]).joinpath("godmd.in")) + ) # Command line # discrete -i $fileName.in -pdbin $pdbch1 -pdbtarg $pdbch2 -ener $fileName.ene -trj $fileName.crd -p1 $alignFile1 -p2 $alignFile2 -o $fileName.log >& $fileName.out - self.cmd = ['cd', self.stage_io_dict["unique_dir"], ';', self.binary_path, - '-i', "godmd.in", - '-pdbin', PurePath(self.stage_io_dict["in"]["input_pdb_orig_path"]).name, - '-pdbtarg', PurePath(self.stage_io_dict["in"]["input_pdb_target_path"]).name, - '-p1', PurePath(self.stage_io_dict["in"]["input_aln_orig_path"]).name, - '-p2', PurePath(self.stage_io_dict["in"]["input_aln_target_path"]).name, - '-o', PurePath(self.stage_io_dict["out"]["output_log_path"]).name, - '-ener', PurePath(self.stage_io_dict["out"]["output_ene_path"]).name, - '-trj', PurePath(self.stage_io_dict["out"]["output_trj_path"]).name - ] + self.cmd = [ + "cd", + self.stage_io_dict["unique_dir"], + ";", + self.binary_path, + "-i", + "godmd.in", + "-pdbin", + PurePath(self.stage_io_dict["in"]["input_pdb_orig_path"]).name, + "-pdbtarg", + PurePath(self.stage_io_dict["in"]["input_pdb_target_path"]).name, + "-p1", + PurePath(self.stage_io_dict["in"]["input_aln_orig_path"]).name, + "-p2", + PurePath(self.stage_io_dict["in"]["input_aln_target_path"]).name, + "-o", + PurePath(self.stage_io_dict["out"]["output_log_path"]).name, + "-ener", + PurePath(self.stage_io_dict["out"]["output_ene_path"]).name, + "-trj", + PurePath(self.stage_io_dict["out"]["output_trj_path"]).name, + ] # Run Biobb block self.run_biobb() # Copy outputs from temporary folder to output path - shutil.copy2(str(Path(self.stage_io_dict["unique_dir"]).joinpath("reference.pdb")), PurePath(self.io_dict["out"]["output_pdb_path"])) + shutil.copy2( + str(Path(self.stage_io_dict["unique_dir"]).joinpath("reference.pdb")), + PurePath(self.io_dict["out"]["output_pdb_path"]), + ) # Copy files to host self.copy_to_host() # remove temporary folder(s) - self.tmp_files.extend([ - self.stage_io_dict.get("unique_dir", ""), - ]) + self.tmp_files.extend( + [ + self.stage_io_dict.get("unique_dir", ""), + ] + ) self.remove_tmp_files() self.check_arguments(output_files_created=True, raise_exception=False) @@ -207,40 +310,90 @@ def launch(self): return self.return_code -def godmd_run(input_pdb_orig_path: str, input_pdb_target_path: str, - input_aln_orig_path: str, input_aln_target_path: str, - output_log_path: str, output_ene_path: str, output_trj_path: str, output_pdb_path: str, - input_config_path: Optional[str] = None, properties: Optional[dict] = None, **kwargs) -> int: +def godmd_run( + input_pdb_orig_path: str, + input_pdb_target_path: str, + input_aln_orig_path: str, + input_aln_target_path: str, + output_log_path: str, + output_ene_path: str, + output_trj_path: str, + output_pdb_path: str, + input_config_path: Optional[str] = None, + properties: Optional[dict] = None, + **kwargs, +) -> int: """Create :class:`GOdMDRun `godmd.godmd_run.GOdMDRun class and execute :meth:`launch() ` method""" - return GOdMDRun(input_pdb_orig_path=input_pdb_orig_path, - input_pdb_target_path=input_pdb_target_path, - input_aln_orig_path=input_aln_orig_path, - input_aln_target_path=input_aln_target_path, - input_config_path=input_config_path, - output_log_path=output_log_path, - output_ene_path=output_ene_path, - output_trj_path=output_trj_path, - output_pdb_path=output_pdb_path, - properties=properties).launch() + return GOdMDRun( + input_pdb_orig_path=input_pdb_orig_path, + input_pdb_target_path=input_pdb_target_path, + input_aln_orig_path=input_aln_orig_path, + input_aln_target_path=input_aln_target_path, + input_config_path=input_config_path, + output_log_path=output_log_path, + output_ene_path=output_ene_path, + output_trj_path=output_trj_path, + output_pdb_path=output_pdb_path, + properties=properties, + ).launch() def main(): - parser = argparse.ArgumentParser(description='Computing conformational transition trajectories for proteins using GOdMD tool.', formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999)) - parser.add_argument('--config', required=False, help='Configuration file') + parser = argparse.ArgumentParser( + description="Computing conformational transition trajectories for proteins using GOdMD tool.", + formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=99999), + ) + parser.add_argument("--config", required=False, help="Configuration file") # Specific args - required_args = parser.add_argument_group('required arguments') - required_args.add_argument('--input_pdb_orig_path', required=True, help='Input PDB file to be used as origin in the conformational transition. Accepted formats: pdb.') - required_args.add_argument('--input_pdb_target_path', required=True, help='Input PDB file to be used as target in the conformational transition. Accepted formats: pdb.') - required_args.add_argument('--input_aln_orig_path', required=True, help='Input GOdMD alignment file corresponding to the origin structure of the conformational transition. Accepted formats: aln, txt.') - required_args.add_argument('--input_aln_target_path', required=True, help='Input GOdMD alignment file corresponding to the target structure of the conformational transition. Accepted formats: aln, txt.') - required_args.add_argument('--input_config_path', required=False, help='Input configuration file (GOdMD run options). Accepted formats: in, txt.') - required_args.add_argument('--output_log_path', required=True, help='Output log file. Accepted formats: log, out, txt.') - required_args.add_argument('--output_ene_path', required=True, help='Output energy file. Accepted formats: log, out, txt.') - required_args.add_argument('--output_trj_path', required=True, help='Output trajectory file. Accepted formats: mdcrd.') - required_args.add_argument('--output_pdb_path', required=True, help='Output structure file. Accepted formats: pdb.') + required_args = parser.add_argument_group("required arguments") + required_args.add_argument( + "--input_pdb_orig_path", + required=True, + help="Input PDB file to be used as origin in the conformational transition. Accepted formats: pdb.", + ) + required_args.add_argument( + "--input_pdb_target_path", + required=True, + help="Input PDB file to be used as target in the conformational transition. Accepted formats: pdb.", + ) + required_args.add_argument( + "--input_aln_orig_path", + required=True, + help="Input GOdMD alignment file corresponding to the origin structure of the conformational transition. Accepted formats: aln, txt.", + ) + required_args.add_argument( + "--input_aln_target_path", + required=True, + help="Input GOdMD alignment file corresponding to the target structure of the conformational transition. Accepted formats: aln, txt.", + ) + required_args.add_argument( + "--input_config_path", + required=False, + help="Input configuration file (GOdMD run options). Accepted formats: in, txt.", + ) + required_args.add_argument( + "--output_log_path", + required=True, + help="Output log file. Accepted formats: log, out, txt.", + ) + required_args.add_argument( + "--output_ene_path", + required=True, + help="Output energy file. Accepted formats: log, out, txt.", + ) + required_args.add_argument( + "--output_trj_path", + required=True, + help="Output trajectory file. Accepted formats: mdcrd.", + ) + required_args.add_argument( + "--output_pdb_path", + required=True, + help="Output structure file. Accepted formats: pdb.", + ) args = parser.parse_args() # config = args.config if args.config else None @@ -249,17 +402,19 @@ def main(): properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call - godmd_run(input_pdb_orig_path=args.input_pdb_orig_path, - input_pdb_target_path=args.input_pdb_target_path, - input_aln_orig_path=args.input_aln_orig_path, - input_aln_target_path=args.input_aln_target_path, - input_config_path=args.input_config_path, - output_log_path=args.output_log_path, - output_ene_path=args.output_ene_path, - output_trj_path=args.output_trj_path, - output_pdb_path=args.output_pdb_path, - properties=properties) - - -if __name__ == '__main__': + godmd_run( + input_pdb_orig_path=args.input_pdb_orig_path, + input_pdb_target_path=args.input_pdb_target_path, + input_aln_orig_path=args.input_aln_orig_path, + input_aln_target_path=args.input_aln_target_path, + input_config_path=args.input_config_path, + output_log_path=args.output_log_path, + output_ene_path=args.output_ene_path, + output_trj_path=args.output_trj_path, + output_pdb_path=args.output_pdb_path, + properties=properties, + ) + + +if __name__ == "__main__": main() diff --git a/biobb_godmd/json_schemas/biobb_godmd.json b/biobb_godmd/json_schemas/biobb_godmd.json index 8043b84..3c7ec2d 100644 --- a/biobb_godmd/json_schemas/biobb_godmd.json +++ b/biobb_godmd/json_schemas/biobb_godmd.json @@ -1,45 +1,45 @@ { "_id": "biobb_godmd", - "desc" : "Biobb_godmd is the Biobb module collection to compute protein conformational transitions with the GOdMD method.", - "github" : "https://github.com/bioexcel/biobb_godmd", - "readthedocs" : "https://biobb-godmd.readthedocs.io/en/latest/", - "conda" : "https://anaconda.org/bioconda/biobb_godmd", - "docker" : "https://quay.io/biocontainers/biobb_godmd:4.2.0--pyhdfd78af_0", - "singularity" : "https://depot.galaxyproject.org/singularity/biobb_godmd:4.2.0--pyhdfd78af_0", - "version" : "4.2.0", + "desc": "Biobb_godmd is the Biobb module collection to compute protein conformational transitions with the GOdMD method.", + "github": "https://github.com/bioexcel/biobb_godmd", + "readthedocs": "https://biobb-godmd.readthedocs.io/en/latest/", + "conda": "https://anaconda.org/bioconda/biobb_godmd", + "docker": "https://quay.io/biocontainers/biobb_godmd:5.0.0--pyhdfd78af_0", + "singularity": "https://depot.galaxyproject.org/singularity/biobb_godmd:5.0.0--pyhdfd78af_0", + "version": "5.0.0", "rest": false, - "tools" : [ + "tools": [ { - "block" : "GoDMD_prep", - "tool" : "GOdMD", - "desc" : "Helper BioBB to prepare inputs for the GOdMD tool (protein conformational transitions).", - "exec" : "godmd_prep", + "block": "GoDMD_prep", + "tool": "GOdMD", + "desc": "Helper BioBB to prepare inputs for the GOdMD tool (protein conformational transitions).", + "exec": "godmd_prep", "docs": "https://biobb-godmd.readthedocs.io/en/latest/godmd.html#module-godmd.godmd_prep", "rest": false - }, + }, { - "block" : "GoDMD_run", - "tool" : "GOdMD", - "desc" : "Wrapper of the GOdMD tool to compute protein conformational transitions.", - "exec" : "godmd_run", + "block": "GoDMD_run", + "tool": "GOdMD", + "desc": "Wrapper of the GOdMD tool to compute protein conformational transitions.", + "exec": "godmd_run", "docs": "https://biobb-godmd.readthedocs.io/en/latest/godmd.html#module-godmd.godmd_run", "rest": false } ], - "dep_pypi" : [ - "install_requires=['biobb_common==4.2.0']", - "python_requires='>=3.8'" - ], - "dep_conda" : [ - "python >=3.8", - "biobb_common ==4.2.0", + "dep_pypi": [ + "install_requires=['biobb_common==5.0.0']", + "python_requires='>=3.9'" + ], + "dep_conda": [ + "python >=3.9", + "biobb_common ==5.0.0", "godmd ==1.0.0", "emboss" ], - "keywords" : [ - "godmd", - "dmd", - "conformations", + "keywords": [ + "godmd", + "dmd", + "conformations", "ensemble", "transitions" ] diff --git a/setup.py b/setup.py index 79af5bf..3822d32 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="biobb_godmd", - version="4.2.0", + version="5.0.0", author="Biobb developers", author_email="adam.hospital@irbbarcelona.org", description="Biobb_godmd is a BioBB category for GOdMD tool (protein conformational transitions).", @@ -15,26 +15,24 @@ url="https://github.com/bioexcel/biobb_godmd", project_urls={ "Documentation": "http://biobb-godmd.readthedocs.io/en/latest/", - "Bioexcel": "https://bioexcel.eu/" + "Bioexcel": "https://bioexcel.eu/", }, - packages=setuptools.find_packages(exclude=['docs', 'test']), - package_data={'biobb_godmd': ['py.typed']}, - install_requires=['biobb_common==4.2.0'], - python_requires='>=3.8', + packages=setuptools.find_packages(exclude=["docs", "test"]), + package_data={"biobb_godmd": ["py.typed"]}, + install_requires=["biobb_common==5.0.0"], + python_requires=">=3.9", entry_points={ "console_scripts": [ "godmd_prep = biobb_godmd.godmd.godmd_prep:main", - "godmd_run = biobb_godmd.godmd.godmd_run:main" + "godmd_run = biobb_godmd.godmd.godmd_run:main", ] }, classifiers=[ "Development Status :: 5 - Production/Stable", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", - "Operating System :: Unix" + "Operating System :: Unix", ], )