You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the tool, I find it very helpful for my research. I may have a question though. I tried running the program in parallel using multiprocess in python but it does not work well, I assume because of the tmp files (file_ca_coo.pdb ,file_proba_contact.mat,file_matrix_pu_contact.mtx and file_pu_delineation.mtx ) overwriting themselves and not allowing a single thread to go through. I have not looked into the script deeply yet but how simple would it be to add the option --tmp that would indicate where the tmp files would be created ?
In case my question is unclear, here is the script I submit on a cluster :
import os
import subprocess
from multiprocessing.pool import ThreadPool
path_work = "/home/user/"
path_pdb = f"{path_work}/ficheros_28032023/out_minibatch"
path_out = f"{path_work}/ficheros_28032023/sword2_Minibatch"
def sword2_pred(pdb_file) :
"""
This function makes a sword prediction from a pdb_file.
It takes as an input a pdb file, and outputs swords2 files.
The path_out is to be adjusted to the context.
"""
with open(f"{path_out}/sword2.log" ,"a+") as outfile :
path_sword = "/home/user/software/SWORD2"
name = pdb_file.split("/")[-1].split(".pdb")[0]
sword_command = f" {path_sword}/SWORD2.py -i {pdb_file} -o {path_out}/{name} -x 5"
sword_subprocess = subprocess.Popen (sword_command , shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
hmm_out, hmm_err = sword_subprocess.communicate()
print(hmm_out)
outfile.write(f"{name} is done.")
paths = [f"{path_pdb}/{file}" for file in os.listdir(path_pdb) if os.path.isdir(f"{path_out}/{file.split('.pdb')[0]}")==False]
if __name__ == '__main__':
with ThreadPool(8) as p:
p.map(sword2_pred, paths)
Thanks again !
Best
The text was updated successfully, but these errors were encountered:
Hi all,
Thanks for the tool, I find it very helpful for my research. I may have a question though. I tried running the program in parallel using multiprocess in python but it does not work well, I assume because of the tmp files (file_ca_coo.pdb ,file_proba_contact.mat,file_matrix_pu_contact.mtx and file_pu_delineation.mtx ) overwriting themselves and not allowing a single thread to go through. I have not looked into the script deeply yet but how simple would it be to add the option --tmp that would indicate where the tmp files would be created ?
In case my question is unclear, here is the script I submit on a cluster :
Thanks again !
Best
The text was updated successfully, but these errors were encountered: