PageRenderTime 142ms CodeModel.GetById 80ms app.highlight 3ms RepoModel.GetById 58ms app.codeStats 0ms

/rcdk/inst/unitTests/runit.frags.R

http://github.com/rajarshi/cdkr
R | 36 lines | 32 code | 4 blank | 0 comment | 2 complexity | 00071ddf4667596c8b3587efd030b4ce MD5 | raw file
 1test.frag1 <- function() {
 2  m <- parse.smiles("c1(ccc(cc1C)CCC(C(CCC)C2C(C2)CC)C3C=C(C=C3)CC)C")[[1]]
 3  do.aromaticity(m)  
 4  do.typing(m)
 5  f <- get.murcko.fragments(m, as.smiles=TRUE, min.frag.size = 6, single.framework = TRUE)
 6  checkEquals(length(f), 1)
 7  checkEquals(length(f[[1]]$rings), 1)
 8  checkEquals(f[[1]]$rings, "c1ccccc1")
 9  checkEquals(f[[1]]$frameworks, "c1ccc(cc1)CCC(CC2CC2)C3C=CC=C3")
10}
11
12test.frag2 <- function() {
13  ms <- parse.smiles(c('c1(ccc(cc1C)CCC(C(CCC)C2C(C2)CC)C3C=C(C=C3)CC)C',
14                       'c1ccc(cc1)c2c(oc(n2)N(CCO)CCO)c3ccccc3',
15                       'COc1ccc(cc1OCc2ccccc2)C(=S)N3CCOCC3'))
16  lapply(ms, do.aromaticity)  
17  lapply(ms, do.typing)
18  f <- get.murcko.fragments(ms, as.smiles=TRUE, min.frag.size = 6, single.framework = TRUE)
19  checkEquals(length(f), 3)
20
21  fworks <- unlist(lapply(f, function(x) length(x$frameworks)))
22  checkTrue(all(fworks == 1))
23}
24
25test.frag3 <- function() {
26  ms <- parse.smiles(c('c1(ccc(cc1C)CCC(C(CCC)C2C(C2)CC)C3C=C(C=C3)CC)C',
27                       'c1ccc(cc1)c2c(oc(n2)N(CCO)CCO)c3ccccc3',
28                       'COc1ccc(cc1OCc2ccccc2)C(=S)N3CCOCC3'))
29  lapply(ms, do.aromaticity)  
30  lapply(ms, do.typing)
31  f <- get.murcko.fragments(ms, as.smiles=FALSE, min.frag.size = 6, single.framework = TRUE)
32  checkEquals(length(f), 3)
33
34  fworks <- unlist(lapply(f, function(x) unlist(lapply(x$frameworks, .jclass))))
35  checkTrue(all(fworks == "org.openscience.cdk.silent.AtomContainer2"))
36}