setPriorities {ChemmineR} | R Documentation

## Set Priorities

### Description

This function should be run after loading a complete set of data. It will find each group of compounds which share the same descriptor and call the given function, `priorityFn`, with the compound_id numbers of the group. This function should then assign priorities to each compound-descriptor pair, however it wishes. Priorities are integer values with lower values being used in preference of higher values.

It is important that this function be called after all data is loaded. It may be that a compound loaded at the beginning of a data set shares a descriptor with a compound loaded near the end of the data set. If the priorities were set at some point in between these then it would not see all the compounds for that one descriptor.

If a SNOW cluster and connection source function are given, it will run in parallel.

Some pre-defined functions that can be use for `priorityFn` are:

`randomPriorities`: Set the priorities of compounds within a descriptor group randomly.

`forestSizePriorities`: Set the priority based on the number of disconnected components (trees) within the compound. Compounds with fewer trees will have a higher priority (lower numerical value) than compounds with more trees.

### Usage

    setPriorities(conn,priorityFn,descriptorIds=c(),cl=NULL,connSource=NULL)
    forestSizePriorities(conn,compIds)
    randomPriorities(conn,compIds)

### Arguments

`conn` | A database connection object.
`priorityFn` | This function will be called with the compound_id numbers associated with the same descriptor. It should use the id numbers to lookup whatever data it wants to assign a priority to each compound. These priority values will be used to pick a compound to represent the group in cases where only one compound is needed for each descriptor. The function should return a data.frame with the fields "compound_id" and "priority". The order of the rows is not important.
`descriptorIds` | If given then only re-compute priorities for groups involving descriptors in this list. This is useful for updating priorities after adding new compounds to an existing database.
`cl` | A SNOW cluster on which to run jobs on.
`connSource` | A function to create a new database connection with. This will be run once for each new job created. It must return a newly created connection, not a reference to an existing connection.
`compIds` | The compound_id values for each group.

### Value

For `setPriorities`, no value is returned. `randomPriorities` and `forestSizePriorities` return a data.frame with columns "compound_id" and "priority".

### Author(s)

Kevin Horan

### Examples

    	## Not run:
    		data(sdfsample)
    		conn = initDb("sample.db")
    		sdfLoad(conn,sdfsample)
    		setPriorities(conn,forestSizePriorities)

    ## End(Not run)

[Package ChemmineR version 3.46.0 Index]