openmolecules.org

 
Home » DataWarrior » Cheminformatics » running a DW macro in batch (How to run a macro over multiple .dwar files to generate new .sdf files containing 3D conformers)
running a DW macro in batch [message #2039] Thu, 30 November 2023 16:36 Go to next message
SM2020
Messages: 14
Registered: June 2020
Location: UK
Junior Member
Hi,
I would like some help with running a DW macro over multiple .dwar files in a folder, please.
I am running DW version 5.5.0.

Aim: To generate 3D conformers for each molecule represented in a list of individual .dwar files in a specified directory

Intended result: an output of multiple .sdf files of molecule conformers from each original .dwar input file.

I tried to use a previous post describing looping a macro over multiple dwar files to get started (see below) but I am getting stuck.
https://openmolecules.org/forum/index.php?t=msg&goto=109 3&&srch=loop#msg_1093

My macro attempt is given below.

<macro name="batch-conformers">
<task name>="repeatNextTasks"
dir=C:\PATH #path is specified when run
filetype=datawarrior
all=true
<task>
<task name="openFile">
fileName=$FILENAME
<task>
<task name="generate2DAtomCoordinates">
scaffoldMode=centralRing
structureColumn=Structure
automatic=true
colorizeScaffolds=false
</task>
<task name="generateConformers">
poolConformers=false
neutralize=false
fileName=$FILENAME_conf.dwar
torsionSource=crystallDB
largestFragment=true
stereoIsomerLimit=16
minimize=mmff94+
algorithm=lowEnergyRandom
maxConformers=16
structureColumn=Structure
fileType=dwar
<task>
<task name="closeWindow">
</task>
</macro>

When I try to run the macro, I get the following error-
“macro ‘batch conformers’ does not have any tasks”

If someone can help, it would be very much appreciated.

Thanks.
Re: running a DW macro in batch [message #2044 is a reply to message #2039] Wed, 06 December 2023 17:31 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 737
Registered: June 2014
Senior Member
Hi SM2020,

It seems that your macro has some syntax errors, e.g. '<task>' are task end tags and should always look be '</task>'. The second line should end with '>'.

A working macro should be the following:

<macro name="batch-conformers">
<task name="repeatNextTasks">
dir=#ask#
filetype=datawarrior
all=true
</task>
<task name="openFile">
fileName=$FILENAME
</task>
<task name="generateConformers">
neutralize=false
fileName=$FILENAME_conf.sdf
torsionSource=crystallDB
largestFragment=true
stereoIsomerLimit=16
minimize=mmff94+
algorithm=lowEnergyRandom
maxConformers=16
structureColumn=Structure
fileType=sdf2
</task>
<task name="closeWindow">
saveChanges=no
</task>
</macro>
icon14.gif  Re: running a DW macro in batch [message #2059 is a reply to message #2044] Thu, 28 December 2023 13:27 Go to previous messageGo to next message
SM2020
Messages: 14
Registered: June 2020
Location: UK
Junior Member
Thank you for helping with the Syntax - seems to work now.
Re: running a DW macro in batch [message #2443 is a reply to message #2039] Tue, 18 November 2025 15:40 Go to previous message
SM2020
Messages: 14
Registered: June 2020
Location: UK
Junior Member
Hi,
This is a follow up to a previous forum support request.

I would like some help with running a DW macro over multiple .sdf files in a folder, please.
I am running DW version [6.05.02] on Windows 11 – the macro (see below) used to work in earlier versions of DW, but which I now can’t reproduce.

Aim: To generate 3D conformers for each molecule represented in a list of individual .sdf files in a specified directory

Intended result: an output of multiple .sdf files of molecule conformers from each original .sdf input file.

The previous working macro is given below.

<macro name="batch-conformers">
<task name="repeatNextTasks">
dir=#ask#
filetype=sd
all=true
</task>
<task name="openFile">
fileName=$FILENAME
</task>
<task name="generateConformers">
neutralize=false
fileName=$FILENAME_conf.sdf
torsionSource=crystallDB
largestFragment=true
stereoIsomerLimit=16
minimize=mmff94s+
algorithm=lowEnergyRandom
maxConformers=16
structureColumn=Structure
fileType=sdf3
</task>
<task name="closeWindow">
saveChanges=no
</task>
</macro>

Result when running the macro: When I try to run the macro, it seems to run but displays transient error/dialog messages (which are not left on the screen long enough to read) and the require output files are not created in the output directory.

When I have tried to re-run the macro on an older version of DW (on ubuntu), the macro will run but need to manually 'hit a key' type of operation to move onto the next conformer generation...

If someone can help – and suggest where the syntax in the macro is at fault - it would be very much appreciated.

Thanks.
Previous Topic: Video tutorials on using Datawarrior
Goto Forum:
  


Current Time: Sat Nov 22 10:21:40 CET 2025

Total time taken to generate the page: 0.28226 seconds