getCompoundFeatures: Get Compound Features

Description Usage Arguments Value Author(s) Examples

View source: R/compound_db.R

Description

Get feature values for specific compounds.

Usage

1
getCompoundFeatures(conn, compoundIds, featureNames, filename = NA, keepOrder = FALSE, allowMissing = FALSE, batchSize = 1e+05)

Arguments

conn

A database connection object, such as is returned by initDb.

compoundIds

A vector of compound_id numbers from this database. These are not compound names. Features will be fetched for each compound given here.

featureNames

A vector of features to fetch the value for, for each given compound.

filename

If given, dump the results into a comma seperated values (CSV) file instead of returning a data frame. This can avoid some potential memory limits when fetching large sets of data.

keepOrder

Ensure that the output order of values matches the order in which the compound ids where given. This will make things a little slower, so should only be used where required.

allowMissing

If false, raise an exception if a compound cannot be found, otherwise just silently ignore it and return data for whatever compound were found.

batchSize

The number of compounds to fetch in a single query. If you find your running out of memory you can try reducing this values, as well as try writing the result to a file using the filename parameter.

Value

If filename is not given, returns a data frame with the compound_id and any given feature names. Each row represents one compound. If filename is given a filename then no value is returned, but the given file is created.

Author(s)

Kevin Horan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
	#create and initialize a new SQLite database
   conn = initDb("test1.db")

	data(sdfsample)

	#load data 
	ids=loadSdf(conn,sdfsample,
			  function(sdfset) 
					data.frame(MW = MW(sdfset),  rings(sdfset,type="count",upper=6, arom=TRUE))
			 )

	f = getCompoundFeatures(conn,ids,c("mw","rings"))

	unlink("test1.db")

ChemmineR documentation built on Feb. 28, 2021, 2:02 a.m.