Skip to content

Commit 2a02bc3

Browse files
committed
Update README.md, remove unnecessary files and sent env variable for openbabel within processligand
1 parent d982830 commit 2a02bc3

File tree

6 files changed

+43
-16
lines changed

6 files changed

+43
-16
lines changed

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
# CMakeLists.txt
22

33
cmake_minimum_required(VERSION 3.15)
4-
project(processligand_builder C)
4+
project(processligand_builder C CXX)
55

66
include(FetchContent)
77

8+
set(BUILD_STATIC_EXECUTABLE ON CACHE BOOL "Build static executable" FORCE)
9+
set(CMAKE_BUILD_TYPE Release)
10+
811
FetchContent_Declare(
912
processligand_repo
1013
GIT_REPOSITORY https://github.com/NRGlab/Process_Ligand.git
1114
GIT_TAG cmake
1215
)
1316

14-
set(CMAKE_BUILD_TYPE Release)
15-
set(BUILD_STATIC_EXECUTABLE ON)
17+
FetchContent_GetProperties(processligand_repo)
18+
if(NOT processligand_repo_POPULATED)
19+
FetchContent_Populate(processligand_repo)
20+
endif()
1621

17-
FetchContent_MakeAvailable(processligand_repo)
22+
add_subdirectory(${processligand_repo_SOURCE_DIR} ${processligand_repo_BINARY_DIR})
1823

1924
set(PROCESSLIGAND_EXECUTABLE $<TARGET_FILE:ProcessLigand>)
2025

@@ -23,7 +28,7 @@ install(PROGRAMS ${PROCESSLIGAND_EXECUTABLE}
2328
)
2429

2530
install(FILES
26-
${CMAKE_CURRENT_SOURCE_DIR}/processligandpy/__init__.py
27-
${CMAKE_CURRENT_SOURCE_DIR}/processligandpy/processligand_wrapper.py
31+
${CMAKE_CURRENT_SOURCE_DIR}/src/processligandpy/__init__.py
32+
${CMAKE_CURRENT_SOURCE_DIR}/src/processligandpy/processligand_wrapper.py
2833
DESTINATION ${CMAKE_INSTALL_PREFIX}
2934
)

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ A Python package designed to prepare arguments and run `ProcessLigand`.
99
```
1010
from processligandpy import run_processligand
1111
12-
result = run_processligand(f='path/to/target_or_ligand')
12+
# For a ligand
13+
result_ligand = run_processligand(file_path='path/to/target_or_ligand')
14+
15+
# For a target:
16+
# result_target = run_processligand(file_path='path/to/target_or_ligand', target=True)
1317
1418
# Using arguments:
15-
# result = run_processligand(f='path/to/target_or_ligand', target=True, atom_index=1)
19+
# result = run_processligand(file_path='path/to/target_or_ligand', atom_index=1)
1620
17-
# Optional:
18-
output = result.stdout
19-
error = result.stderr
20-
returncode = result.returncode
21+
# Expanding the result:
22+
output = result_ligand.stdout
23+
error = result_ligand.stderr
24+
returncode = result_ligand.returncode
2125
```
2226

2327
---
@@ -26,9 +30,9 @@ returncode = result.returncode
2630

2731
### Required Argument
2832

29-
| Arg | Description |
30-
|:----|:---------------------------------------------------|
31-
| `f` | Input file (not listed in the provided dictionary) |
33+
| Arg | Description |
34+
|:------------|:---------------------------------------------------|
35+
| `file_path` | Input file (not listed in the provided dictionary) |
3236

3337
### Optional Arguments
3438

processligandpy/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ wheel.install-dir = "processligandpy"
3333
wheel.py-api = "py3"
3434
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
3535
cmake.build-type = "Release"
36+
wheel.exclude = ["obabel", "roundtrip", "**/lib", "**/include", "**/share/man"]
3637

3738
[tool.setuptools.packages.find]
3839
include = ["processligandpypy","processligandpypy.*"]

src/processligandpy/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
import sys
3+
4+
if 'BABEL_DATADIR' not in os.environ:
5+
try:
6+
import importlib.resources
7+
data_dir = os.path.join(str(importlib.resources.files('processligandpy')), 'share', 'openbabel', '3.1.1')
8+
if not os.path.isdir(data_dir):
9+
data_dir = os.path.join(str(importlib.resources.files('processligandpy')), 'bin', 'data')
10+
except (ImportError, AttributeError):
11+
import pkg_resources
12+
data_dir = os.path.join(str(pkg_resources.resource_filename('processligandpy', '')), 'share', 'openbabel',
13+
'3.1.1')
14+
if not os.path.isdir(data_dir):
15+
data_dir = os.path.join(str(pkg_resources.resource_filename('processligandpy', '')), 'bin', 'data')
16+
os.environ['BABEL_DATADIR'] = data_dir
17+
18+
from .processligand_wrapper import run_processligand
File renamed without changes.

0 commit comments

Comments
 (0)