Learn R Programming

RMassBank (version 2.0.0)

createMolfile: Create MOL file for a chemical structure

Description

Creates a MOL file (in memory or on disk) for a compound specified by the compound ID or by a SMILES code.

Usage

createMolfile(id_or_smiles, fileName = FALSE)

Arguments

id_or_smiles
The compound ID or a SMILES code.
fileName
If the filename is set, the file is written directly to disk using the specified filename. Otherwise, it is returned as a text array.

Value

A character array containing the MOL/SDF format file, ready to be written to disk.

Details

The function invokes OpenBabel (and therefore needs a correctly set OpenBabel path in the RMassBank settings), using the SMILES code retrieved with findSmiles or using the SMILES code directly. The current implementation of the workflow uses the latter version, reading the SMILES code directly from the MassBank record itself.

References

OpenBabel: http://openbabel.org

See Also

findSmiles

Examples

Run this code

# Benzene:
## Not run: 
# createMolfile("C1=CC=CC=C1")
# ## End(Not run)

Run the code above in your browser using DataLab