Skip to content

Commit

Permalink
force set output filename in command line script
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxayheee committed Dec 12, 2024
1 parent abf7a3a commit 1895fb8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions meeko/cli/mk_prepare_ligand.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,13 +921,21 @@ def process_covlig(index_pair, monomer_string, residue_connect_idx, attractors_p
pdbqt_string = PDBQTWriterLegacy.adapt_pdbqt_for_autodock4_flexres(
pdbqt_string, res, chain, num
)
name = molsetup.name
if not name:
ligand_input_basepath = os.path.splitext(os.path.basename(input_molecule_filename))[0]
name =ligand_input_basepath

if output.output_filename:
if output.output_filename.endswith(".pdbqt"):
output_basepath = output.output_filename[:-len(".pdbqt")]
else:
output_basepath = output.output_filename
elif molsetup.name:
output_basepath = f"{molsetup.name}{suffix}_{ligand_connect_pattern}_{monomer_label}_{residue_connect_idx}.pdbqt"
else:
output_basepath = os.path.splitext(input_molecule_filename)[0]

monomer_label = "_".join(monomer_string.split(":"))
output.output_filename = f"{name}{suffix}_{ligand_connect_pattern}_{monomer_label}_{residue_connect_idx}.pdbqt"
output.output_filename = f"{output_basepath}{suffix}_{ligand_connect_pattern}_{monomer_label}_{residue_connect_idx}.pdbqt"
output(pdbqt_string, name, (suffix,)) # in the call of output, name and suffix do not directly contribute to output filename

except ValueError as error_msg:
nr_failures += 1
this_mol_had_failure = True
Expand Down

0 comments on commit 1895fb8

Please sign in to comment.