Skip to content

Commit e26022b

Browse files
authored
Update setup.py
wanted: zinc servers.
1 parent d1f8e82 commit e26022b

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

docking/setup.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,23 @@ def download_ligands_from_file(wget_file_path, LIGANDS_DIR):
5757
with open(wget_file_path, 'r') as file:
5858
for command in file:
5959
command = command.strip()
60-
if not command:
61-
continue
62-
63-
# Set common wget options (all timeouts in seconds)
64-
wget_opts = "--timeout=60 --read-timeout=60 --tries=2 --waitretry=2"
65-
66-
if '-O' in command:
67-
parts = command.split('-O')
68-
url = parts[0].strip()
69-
filename = parts[1].strip()
70-
full_output_path = os.path.join(LIGANDS_DIR, filename)
71-
final_command = f"wget {wget_opts} {url} -O {full_output_path}"
72-
else:
73-
final_command = f"{command} {wget_opts} -P {LIGANDS_DIR}"
74-
75-
print(f"Executing: {final_command}")
76-
try:
60+
if command:
61+
if '-O' in command:
62+
wget_options = '--timeout=2 --tries=3 '
63+
parts = command.split('-O')
64+
url = parts[0].strip()
65+
filename = parts[1].strip()
66+
full_output_path = os.path.join(LIGANDS_DIR, filename)
67+
final_command = f"{url} -O {full_output_path} {wget_options}"
68+
else:
69+
final_command = f"{command} -P {LIGANDS_DIR}"
70+
71+
print(f"Executing: {final_command}")
7772
subprocess.run(final_command, shell=True, check=True)
78-
except subprocess.CalledProcessError:
79-
print(f"Warning: Failed to download with command: {final_command}")
8073

81-
print(f"All downloads attempted. Ligands stored in {LIGANDS_DIR}")
82-
except Exception as e:
83-
print(f"Error during .wget file processing: {e}")
74+
print(f"All downloads completed and stored in {LIGANDS_DIR}")
75+
except subprocess.CalledProcessError as e:
76+
print(f"Error during command execution: {e}")
8477

8578

8679
def main():

0 commit comments

Comments
 (0)