openmolecules.org

 
Home » DataWarrior » Cheminformatics » Batch conversion of dwar files (DWAR to SDF/CSV)
Batch conversion of dwar files [message #1091] Wed, 21 October 2020 17:19 Go to next message
jeremy is currently offline  jeremy
Messages: 1
Registered: October 2020
Junior Member
Hello,
I have to convert a bunch of dwar files into csv (or SDF) files.
I can open them one at a time and export; but I would prefer a more automated way. I can read the dwar file as tab delimited files (ignoring top lines), but I don't know how to convert the structure string into a molecule. Is there a way to convert the structure string into a molecule outside DW?
Thank you
Re: Batch conversion of dwar files [message #1093 is a reply to message #1091] Thu, 22 October 2020 17:47 Go to previous message
thomas is currently offline  thomas
Messages: 706
Registered: June 2014
Senior Member
Hello,

with the current development patch you can run a macro loop over all files within a given directory. You can also create a new macro from a text macro representation as the following. If you copy the following macro text without any empty lines and select the 'Paste Macro' in the DataWarrior 'Macro' menu, and then select 'Run Macro->convertAllFilesToSDF', then DataWarrior asks you to select a directory and then writes an SD-File from every dwar file it finds in the directory.

(the needed DataWarrior files can be downloaded on the download page after selecting the 'Read and understood' checkbox. Look carefully, the download link is in the fineprint!Wink

<macro name="convertAllFilesToSDF">
<task name="repeatNextTasks">
dir=#ask#
filetype=datawarrior
all=true
</task>
<task name="openFile">
fileName=$FILENAME
</task>
<task name="saveSDFile">
version=v3
idColumn=<idColumn>
structureColumn=Structure
coordinates=2D
fileName=$FILENAME.sdf
</task>
<task name="closeWindow">
</task>
</macro>
Previous Topic: Non-aromatic Het Rings
Next Topic: translation of the idcodes
Goto Forum:
  


Current Time: Wed Oct 30 21:03:06 CET 2024

Total time taken to generate the page: 0.00648 seconds