Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Ligand file in a folder causes exception #11

Open
schackartk opened this issue Mar 9, 2022 · 2 comments
Open

Bug: Ligand file in a folder causes exception #11

schackartk opened this issue Mar 9, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@schackartk
Copy link
Contributor

If the ligand pdb file is in a folder instead of the root of the repo, an exception occurs:

$ ls ligands/
my_ligand.pdb

$ python main.py --run_num=1 --mode='full dock' --aptamerSeq='GCGCGCGCGATATATAT' --ligand='ligands/my_ligand.pdb' --ligandType='other' --ligandSeq=''
Starting Fresh Run 1
Traceback (most recent call last):
  File "main.py", line 229, in <module>
    opendna = opendna(params)  # instantiate the class
  File "/home/ken/personal/E2EDNA2/opendna.py", line 53, in __init__
    self.setup()  # if we don't need a workdir & MMB files (eg, give a 3D structure), don't make one.
  File "/home/ken/personal/E2EDNA2/opendna.py", line 179, in setup
    copyfile(self.targetPDB, self.workDir + '/' + self.targetPDB)
  File "/home/ken/personal/E2EDNA2/env/lib/python3.7/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/ken/personal/E2EDNA2/localruns/run1/ligands/my_ligand.pdb'

I don't see any reason that the ligand file should not be in a folder, so this should not fail.

@taoliu032
Copy link
Collaborator

This is because the pipeline will copy the provided file specified by --ligand into the workdir. Here there is a folder named "ligands" in your code directory but there isn't a "ligands" folder in the workdir. So the copyfile commands runs into problem.

@taoliu032
Copy link
Collaborator

taoliu032 commented Mar 14, 2022

To resolve this, either extract the filename from --ligand and store it as self.targetPDB or explicitly create a folder in workdir. I think the former option is better. A quick and dirty way can be like this: splitting the string by /, and copying the pdb file from its folder to the code directory:

# args.ligand is 'ligands/my_ligand.pdb'
params['target ligand'] = args.ligand.split('/')[-1]  # params['target ligand'] is 'my_ligand.pdb'
copyfile(args.ligand, params['target ligand']) 

@taoliu032 taoliu032 added the bug Something isn't working label Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants