bgruening / galaxytools

:microscope::books: Galaxy Tool wrappers
MIT License
116 stars 227 forks source link

openbabel convert #582

Open bernt-matthias opened 7 years ago

bernt-matthias commented 7 years ago

I'm wondering why the list of input file types is limited to SDF, MOL, MOL2, CML, InChI and SMILES? I would like to convert pdb to sdf which is possible on the commandline.

bgruening commented 7 years ago

Most probably, I just missed it. You could add it here: https://github.com/bgruening/galaxytools/blob/master/chemicaltoolbox/openbabel/macros.xml#L16

But please note that this macro is also used in other tools and we need to make sure other tools can consume pdb as well.

bernt-matthias commented 7 years ago

I looked around a bit:

So I think extending the informats by pdb should be fine (then the common formats are covered, the alternative to allow everything from pybel.informats would be not a good idea even if this would be handy for convert). How about ob_filter: restrict to sdf or extend the python script to allow everything?

bernt-matthias commented 7 years ago

One more thing. If I got the xml file for convert correctly then for some output formats special options are set. Is the same done also for the infiles? Maybe I missed it. I have seen that babel can list the possible options:

babel -L pdb   
One of the formats
pdb -- Protein Data Bank format
Read Options e.g. -as
  s  Output single bonds only
  b  Disable bonding entirely
  c  Ignore CONECT records

I just stubled over CONECT, since autodock_fina gives an error when CONECT records are in the files.

babel -L sdf
One of the formats
sdf -- MDL MOL format
Reads and writes V2000 and V3000 versions

Open Babel supports an extension to the MOL file standard
that allows cis/trans and tetrahedral stereochemistry to be
stored in 0D MOL files. The tetrahedral stereochemistry is
stored as the atom parity, while the cis/trans stereochemistry
is stored using Up and Down bonds similar to how it is
represented in a SMILES string. Use the ``S`` option
when reading or writing if you want to avoid storing
or interpreting stereochemistry in 0D MOL files.

Read Options, e.g. -as
 s  determine chirality from atom parity flags
       The default setting for 2D and 3D is to ignore atom parity and
       work out the chirality based on the bond
       stereochemistry (2D) or coordinates (3D).
       For 0D the default is already to determine the chirality
       from the atom parity.
 S  do not read stereochemistry from 0D MOL files
       Open Babel supports reading and writing cis/trans
       and tetrahedral stereochemistry to 0D MOL files.
       This is an extension to the standard which you can
       turn off using this option.
 T  read title only
 P  read title and properties only
       When filtering an sdf file on title or properties
       only, avoid lengthy chemical interpretation by
       using the ``T`` or ``P`` option together with the
       :ref:`copy format <Copy_raw_text>`.

Write Options, e.g. -x3
 3  output V3000 not V2000 (used for >999 atoms/bonds) 
 m  write no properties
 w  use wedge and hash bonds from input (2D only)
 S  do not store cis/trans stereochemistry in 0D MOL files
 A  output in Alias form, e.g. Ph, if present
bgruening commented 7 years ago

Thanks for looking into it. I'm currently on a workshop so sorry for being slow to reply. Currently, we do not support the different options for inputs. But this would be easy to implement I guess.

bgruening commented 6 years ago

@egeogretmen can you maybe look at this?