Skip to content

Commit de08861

Browse files
committed
Update README.md and add verification to make sure input file exists
1 parent d07dbec commit de08861

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,15 @@ pip install vcon-py
2424
from vconpy import run_vcon
2525

2626
# Run Vcontacts
27-
result_surfaces = run_vcon(
28-
"/path/to/receptor.pdb",
29-
vcon_type="surfaces"
30-
)
27+
result = run_vcon("/path/to/protein.pdb")
3128

3229
# Run Vcontacts and return a dictionary instead of outputting a file
33-
result_nrgten = run_vcon(
34-
"/path/to/receptor.pdb",
35-
as_dictionary=True
36-
)
30+
result_with_dictionary = run_vcon("/path/to/protein.pdb", as_dictionary=True)
3731

3832
# NRGTEN requires setting showbonded as True
39-
result_nrgten = run_vcon(
40-
"/path/to/receptor.pdb",
41-
as_dictionary=True,
42-
showbonded=True
43-
)
33+
result_nrgten = run_vcon("/path/to/protein.pdb", as_dictionary=True, showbonded=True)
4434

45-
print(result_nrgten.surface_dictionary) # dict of atom-atom contact areas
35+
print(result_with_dictionary.surface_dictionary)
4636
```
4737

4838
---

src/vconpy/vcontacts_wrapper.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ def run_vcon(pdb_filename, showbonded=False, normalize=False, planedef=None, as_
6363
executable_path += '.exe'
6464
if not os.path.isfile(executable_path) or not os.access(executable_path, os.X_OK):
6565
raise VconError(f"Error: Executable '{executable_path}' not found or not executable.")
66+
if not os.path.isfile(pdb_filename):
67+
raise VconError(f"Error: Input file '{pdb_filename}' not found.")
68+
if not pdb_filename.endswith('.pdb'):
69+
raise VconError(f"Warning: Input file '{pdb_filename}' does not have a '.pdb' extension. "
70+
f"Vcontacts is designed to work with PDB files only.")
6671
cmd = [executable_path]
6772
cmd.extend([pdb_filename])
6873
if showbonded:
@@ -72,7 +77,6 @@ def run_vcon(pdb_filename, showbonded=False, normalize=False, planedef=None, as_
7277
if planedef:
7378
cmd.extend(["-planedef", planedef.upper()])
7479
try:
75-
print(cmd)
7680
result = subprocess.run(
7781
cmd,
7882
check=True,

0 commit comments

Comments
 (0)