forked from dyelar/grid-and-dock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-ligand-list
executable file
·36 lines (28 loc) · 914 Bytes
/
make-ligand-list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
#
# Copyright 2023 - University of Kansas - All rights reserved.
# Written by Matthew Copeland ([email protected])
#
# This file is licensed under the GNU Affero General Public License v3.0.
#
import sys
from pathlib import Path
def usage():
print("Usage: make-ligand-list directory-containing-ligand-files ligand-list.txt")
sys.exit(1)
def main():
argc = len(sys.argv)
if argc != 3 and "--help" not in sys.argv and "-h" not in sys.argv:
usage()
directory = sys.argv[1]
output_file = sys.argv[2]
dirpath = Path(directory)
if dirpath.exists() and dirpath.is_dir():
files = [x for x in dirpath.iterdir() if x.is_file() and not x.is_dir()]
with open(output_file, "w") as output:
for file in files:
output.write(str(file.absolute()) + "\n")
else:
usage()
if __name__ == '__main__':
main()