Defines functions is.subgraph get.mcs

Documented in get.mcs is.subgraph

get.mcs <- function(mol1, mol2, as.molecule = TRUE) {
  if (as.molecule) {
           "getMcsAsNewContainer", mol1, mol2))
  } else {
    arr <- .jcall("org.guha.rcdk.util.Misc",
           "getMcsAsAtomIndexMapping", mol1, mol2)
    do.call('rbind', lapply(arr, .jevalArray, rawJNIRefSignature = "[I"))

is.subgraph <- function(query, target) {
  if (class(query) == 'character') {
    query <- parse.smiles(query)

  if (!is.list(target)) target <- list(target)
  if (!all(unlist(lapply(target, class)) == 'jobjRef'))
    stop("targets must be a list of IAtomContainer objects or a single IAtomContainer object")
  method <- 'TurboSubStructure'
  isoType <- .jcall("org.openscience.cdk.smsd.interfaces.Algorithm",
                    "valueOf", method)
  iso <- .jnew("org.openscience.cdk.smsd.Isomorphism",
               isoType, TRUE);
  unlist(lapply(target, function(x) {
    .jcall(iso, "V", "init", query, x, TRUE, TRUE)
    .jcall(iso, "V", "setChemFilters", FALSE, FALSE, FALSE)
    .jcall(iso, "Z", "isSubgraph")

Try the rcdk package in your browser

Any scripts or data that you put into this service are public.

rcdk documentation built on April 30, 2018, 5:03 p.m.