forEachMol {ChemmineOB} | R Documentation

## For Each Mol

### Description

Reads in molecules from the given string in the given format and calls function `f` on each molecule. The results are then combinded using the `reduce` function, if given.

### Usage

    forEachMol(inFormat, inString, f, reduce)

### Arguments

`inFormat` | Format of string in `source`. This can be any OpenBabel format such as "SDF" or "SMILES". A full list can be found by executing "obabel -L formats".
`inString` | The compounds to generate fingerprints for. The format should be exactly what would be in a file of the same format. Newlines can be represented with "\n".
`f` | A function taking one OBMol reference and possibly returning a result.
`reduce` | This function will be passed to the `Reduce` function along with the results of all the `f` calls. This can be used to combine the results.

### Value

The result will be a List of return values from the `f` function if not `reduce` function was given. Otherwise it will be the result of the `reduce` function applied to the results of the `f` function.

### Author(s)

Kevin Horan

### Examples

    	molRefs = forEachMol("SMILES","C1CCCCC1\ttest-compound-name",
                            identity,c)

[Package ChemmineOB version 1.22.0 Index]