forlilab / Meeko

Interfacing RDKit and AutoDock
GNU Lesser General Public License v2.1
171 stars 41 forks source link

exec ./mk_export.py file.dlg -o result.sdf got error print("Option -o/--output_filename incompatible with multiple input files", file=sys.stderr) #45

Closed zhiyixu closed 1 year ago

zhiyixu commented 1 year ago

Hi there,

thanks for all the developers ! when i followed the tutorials from there tutorials, everything is ok until i reach the step 10 mk_copy_coords.py ligand.dlg -o ligand_docked.sdf.

i know that i should run mk_export.py instead of mk_copy_coords.py, but after i run ./mk_export.py file.dlg -o result.sdf , i got an error like this

File "./mk_export.py", line 58 print("Option -o/--output_filename incompatible with multiple input files", file=sys.stderr)

and i have no idea what's wrong and how to handle it.

any suggestions?

diogomart commented 1 year ago

I can't reproduce this error. This error should occur only with multiple ligands, e.g.:

mk_export.py lig01.pdbqt lig02.pdbqt lig03.pdbqt -o lig01.sdf

or

mk_export.py docked/*.pdbqt -o results.sdf

On my end it works fine as long as I pass one input file.

zhiyixu commented 1 year ago

thanks for you reply,

after i run this code

adgpu-v1.5.3_linux_ocl_128wi -L ligand.pdbqt -M rec.maps.fld -T OX=OA

i got a file file.dlg, when i open this file it seems like it has 20 models (or i should say 20 different docking positions) inside this file, it this reason lead to the error?

diogomart commented 1 year ago

Multiple poses in the DLG should be OK - not a cause the this error.

You could omit the -o option to create or overwrite files with the same name as the input files but suffixed with _docked.sdf.

zhiyixu commented 1 year ago

same error as before,

File "./mk_export.py", line 58 print("Option -o/--output_filename incompatible with multiple input files", file=sys.stderr)

i will try it again from the first step of autodock-gpu tutorials to see if i missed anything there

thank you again for your reply.

diogomart commented 1 year ago

No clue what is going on.

Can you add print(args) just before line 58 of mk_export.py and run it again?

Here's what I'm expecting to see: one filename in list docking_results_filename.

$ mk_export.py docked.dlg -o docked.sdf
Namespace(docking_results_filename=['docked.dlg'], template_filename=None, output_filename='docked.sdf', suffix_name='_docked', redirect_stdout=False)
zhiyixu commented 1 year ago

i had modified the file like this:

55 redirect_stdout = args.redirect_stdout
56 
57 if output_filename is not None and len(docking_results_filenames) > 1:
58     print("args in line 58: ",args)
59     print("Option -o/--output_filename incompatible with multiple input files", file=sys.stderr)
60     sys.exit()   

and i got the same error

$ ./mk_export.py -i file.dlg -o file.sdf 
  File "/home/xxxxxx/xxxxxxx/meeko/scripts/mk_export.py", line 59
    print("Option -o/--output_filename incompatible with multiple input files", file=sys.stderr)
                                                                                    ^
SyntaxError: invalid syntax

it even not print the string args in line 58 that put in the print function and the error just like i run ./mk_export.py without any args

diogomart commented 1 year ago

I think you need a newer version of python, like 3.9. Which python version are you using?

zhiyixu commented 1 year ago

it worked ! by exec ./mk_export.py -i file.dlg -o file.sdf in my conda env it run the scripy with python2.7, after i run the script with python3 mk_export.py -i file.dlg -o file.sdf, it works totally fine.

i should check the python version before i run the code, thank you again

diogomart commented 1 year ago

Nice! It's better to share the full output (I could find there problem only because it was a SyntaxError).