Skip to content

Commit

Permalink
pymol_align_protein_ca
Browse files Browse the repository at this point in the history
  • Loading branch information
ndonyapour committed Dec 26, 2024
1 parent 92d2d65 commit 2c2b43e
Show file tree
Hide file tree
Showing 22 changed files with 573 additions and 0 deletions.
29 changes: 29 additions & 0 deletions utils/pymol-align-protein-ca-plugin/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[bumpversion]
current_version = 0.1.0
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{dev}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = _
first_value = dev
values =
dev
_

[bumpversion:part:dev]

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:VERSION]

[bumpversion:file:README.md]

[bumpversion:file:plugin.json]

[bumpversion:file:src/polus/mm/utils/pymol_align_protein_ca/__init__.py]
4 changes: 4 additions & 0 deletions utils/pymol-align-protein-ca-plugin/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.venv
out
tests
__pycache__
3 changes: 3 additions & 0 deletions utils/pymol-align-protein-ca-plugin/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.gro filter=lfs diff=lfs merge=lfs -text
*.xyz filter=lfs diff=lfs merge=lfs -text
*.trr filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions utils/pymol-align-protein-ca-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry.lock
5 changes: 5 additions & 0 deletions utils/pymol-align-protein-ca-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

## 0.1.0

Initial release.
30 changes: 30 additions & 0 deletions utils/pymol-align-protein-ca-plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM condaforge/mambaforge

RUN apt-get update && apt-get install libgl1-mesa-glx -y

ENV EXEC_DIR="/opt/executables"
ENV POLUS_LOG="INFO"
RUN mkdir -p ${EXEC_DIR}

# Work directory defined in the base container
# WORKDIR ${EXEC_DIR}

COPY pyproject.toml ${EXEC_DIR}
COPY VERSION ${EXEC_DIR}
COPY README.md ${EXEC_DIR}
COPY CHANGELOG.md ${EXEC_DIR}

# Install needed packages here
# errors installing pymol-open-source from poetry so using conda
COPY environment.yml ${EXEC_DIR}
RUN mamba env create -f ${EXEC_DIR}/environment.yml
RUN echo "source activate project_env" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH

COPY src ${EXEC_DIR}/src

ADD Dockerfile .

RUN conda run -n project_env pip install ${EXEC_DIR} --no-cache-dir

CMD ["--help"]
16 changes: 16 additions & 0 deletions utils/pymol-align-protein-ca-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# pymol_align_protein_ca (0.1.0)

Align Protein and CA atoms for a trajectory using Pymol

## Options

This plugin takes 6 input arguments and 1 output argument:

| Name | Description | I/O | Type | Default |
|---------------|-------------------------|--------|--------|---------|
| input_1_path | Input receptor file path | Input | File | File |
| input_2_path | Input ligand file path | Input | File | File |
| input_3_path | Input structure file path | Input | File | File |
| input_4_path | Input trajectory file path | Input | File | File |
| output_file_path | Path to the output file | Input | string | string |
| output_file_path | Path to the output file | Output | File | File |
1 change: 1 addition & 0 deletions utils/pymol-align-protein-ca-plugin/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
4 changes: 4 additions & 0 deletions utils/pymol-align-protein-ca-plugin/build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

version=$(<VERSION)
docker build . -t polusai/pymol-align-protein-ca-tool:${version}
6 changes: 6 additions & 0 deletions utils/pymol-align-protein-ca-plugin/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: project_env
channels:
- conda-forge
dependencies:
- python==3.10
- pymol-open-source==3.0.0
73 changes: 73 additions & 0 deletions utils/pymol-align-protein-ca-plugin/ict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
specVersion: "0.1.0"
name: pymol_align_protein_ca
version: 0.1.0
container: pymol-align-protein-ca-plugin
entrypoint:
title: pymol_align_protein_ca
description: Align Protein and CA atoms for a trajectory using Pymol
author: Data Scientist
contact: [email protected]
repository:
documentation:
citation:

inputs:
- name: input_1_path
required: true
description: Input receptor file path
type: File
format:
uri: edam:format_1476, edam:format_3877
- name: input_2_path
required: true
description: Input ligand file path
type: File
format:
uri: edam:format_1476, edam:format_3877
- name: input_3_path
required: true
description: Input structure file path
type: File
format:
uri: edam:format_2033
- name: input_4_path
required: true
description: Input trajectory file path
type: File
format:
uri: edam:format_3910
- name: output_file_path
required: true
description: Path to the output file
type: string
defaultValue: system.pdb
format:
uri: edam:format_1476
outputs:
- name: output_file_path
required: true
description: Path to the output file
type: File
format:
uri: edam:format_1476
ui:
- key: inputs.input_1_path
title: "input_1_path: "
description: "Input receptor file path"
type: File
- key: inputs.input_2_path
title: "input_2_path: "
description: "Input ligand file path"
type: File
- key: inputs.input_3_path
title: "input_3_path: "
description: "Input structure file path"
type: File
- key: inputs.input_4_path
title: "input_4_path: "
description: "Input trajectory file path"
type: File
- key: inputs.output_file_path
title: "output_file_path: "
description: "Path to the output file"
type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0

class: CommandLineTool

label: Align Protein and CA atoms for a trajectory using Pymol

doc: |-
Align Protein and CA atoms for a trajectory using Pymol

baseCommand: ["conda", "run", "-n", "project_env", "pymol"]
arguments: ["-rcQ", "/opt/executables/src/polus/mm/utils/pymol_align_protein_ca/__main__.py ", "--"]
# NOTE: Based on the last example here
# See https://pymolwiki.org/index.php/Command_Line_Options

hints:
DockerRequirement:
dockerPull: polusai/pymol-align-protein-ca-tool@sha256:3d51e1e6cd560b64b33159e153b68560b00701ac81307bce259dbf8d454395fd

inputs:
input_1_path:
label: Input receptor file path
doc: |-
Input receptor file path
type: File
format: edam:format_1476, edam:format_3877 # pdb, xyz
inputBinding:
prefix: --input_1_path

input_2_path:
label: Input ligand file path
doc: |-
Input ligand file path
type: File
format: edam:format_1476, edam:format_3877 # pdb, xyz
inputBinding:
prefix: --input_2_path

input_3_path:
label: Input structure file path
doc: |-
Input structure file path
type: File
format: edam:format_2033 # Gromacs structure *.gro
inputBinding:
prefix: --input_3_path

input_4_path:
label: Input trajectory file path
doc: |-
Input trajectory file path
type: File
format: edam:format_3910 # Gromacs trajectory *.trr
inputBinding:
prefix: --input_4_path

output_file_path:
label: Path to the output file
doc: |-
Path to the output file
type: string
format:
- edam:format_1476 # pdb
inputBinding:
prefix: --output_file_path
default: system.pdb


outputs:
output_file_path:
label: Path to the output file
doc: |-
Path to the output file
type: File
format: edam:format_1476 # pdb
outputBinding:
glob: $(inputs.output_file_path)

$namespaces:
edam: https://edamontology.org/

$schemas:
- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl
31 changes: 31 additions & 0 deletions utils/pymol-align-protein-ca-plugin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[tool.poetry]
name = "polus-mm-utils-pymol-align-protein-ca"
version = "0.1.0"
description = "Align Protein and CA atoms for a trajectory using Pymol"
authors = ["Data Scientist <[email protected]>"]
readme = "README.md"
packages = [{include = "polus", from = "src"}]

[tool.poetry.dependencies]
python = ">=3.9,<3.13"
typer = "^0.7.0"
sophios = "0.1.4"
mdanalysis = "2.7.0"

[tool.poetry.group.dev.dependencies]
bump2version = "^1.0.1"
pytest = "^7.4"
pytest-sugar = "^0.9.6"
pre-commit = "^3.2.1"
black = "^23.3.0"
mypy = "^1.1.1"
ruff = "^0.0.270"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
pythonpath = [
"."
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""pymol_align_protein_ca."""

__version__ = "0.1.0"

from polus.mm.utils.pymol_align_protein_ca.pymol_align_protein_ca import ( # noqa # pylint: disable=unused-import
pymol_align_protein_ca,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""Package entrypoint for the pymol_align_protein_ca package."""

# Base packages
import logging
from os import environ

import typer
from polus.mm.utils.pymol_align_protein_ca.pymol_align_protein_ca import (
pymol_align_protein_ca,
)

logging.basicConfig(
format="%(asctime)s - %(name)-8s - %(levelname)-8s - %(message)s",
datefmt="%d-%b-%y %H:%M:%S",
)
POLUS_LOG = getattr(logging, environ.get("POLUS_LOG", "INFO"))
logger = logging.getLogger("polus.mm.utils.pymol_align_protein_ca.")
logger.setLevel(POLUS_LOG)

app = typer.Typer(help="pymol_align_protein_ca.")


@app.command()
def main(
input_1_path: str = typer.Option(
...,
"--input_1_path",
help="Input receptor file path",
),
input_2_path: str = typer.Option(
...,
"--input_2_path",
help="Input ligand file path",
),
input_3_path: str = typer.Option(
...,
"--input_3_path",
help="Input structure file path",
),
input_4_path: str = typer.Option(
...,
"--input_4_path",
help="Input trajectory file path",
),
output_file_path: str = typer.Option(
...,
"--output_file_path",
help="Path to the output file",
),
) -> None:
"""pymol_align_protein_ca."""
logger.info(f"input_1_path: {input_1_path}")
logger.info(f"input_2_path: {input_2_path}")
logger.info(f"input_3_path: {input_3_path}")
logger.info(f"input_4_path: {input_4_path}")
logger.info(f"output_file_path: {output_file_path}")

pymol_align_protein_ca(
input_1_path=input_1_path,
input_2_path=input_2_path,
input_3_path=input_3_path,
input_4_path=input_4_path,
output_file_path=output_file_path,
)


if __name__ == "__main__":
app()
Loading

0 comments on commit 2c2b43e

Please sign in to comment.