PageRenderTime 25ms CodeModel.GetById 19ms RepoModel.GetById 1ms 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
  1. test.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. test.frag2 <- function() {
  12. ms <- parse.smiles(c('c1(ccc(cc1C)CCC(C(CCC)C2C(C2)CC)C3C=C(C=C3)CC)C',
  13. 'c1ccc(cc1)c2c(oc(n2)N(CCO)CCO)c3ccccc3',
  14. 'COc1ccc(cc1OCc2ccccc2)C(=S)N3CCOCC3'))
  15. lapply(ms, do.aromaticity)
  16. lapply(ms, do.typing)
  17. f <- get.murcko.fragments(ms, as.smiles=TRUE, min.frag.size = 6, single.framework = TRUE)
  18. checkEquals(length(f), 3)
  19. fworks <- unlist(lapply(f, function(x) length(x$frameworks)))
  20. checkTrue(all(fworks == 1))
  21. }
  22. test.frag3 <- function() {
  23. ms <- parse.smiles(c('c1(ccc(cc1C)CCC(C(CCC)C2C(C2)CC)C3C=C(C=C3)CC)C',
  24. 'c1ccc(cc1)c2c(oc(n2)N(CCO)CCO)c3ccccc3',
  25. 'COc1ccc(cc1OCc2ccccc2)C(=S)N3CCOCC3'))
  26. lapply(ms, do.aromaticity)
  27. lapply(ms, do.typing)
  28. f <- get.murcko.fragments(ms, as.smiles=FALSE, min.frag.size = 6, single.framework = TRUE)
  29. checkEquals(length(f), 3)
  30. fworks <- unlist(lapply(f, function(x) unlist(lapply(x$frameworks, .jclass))))
  31. checkTrue(all(fworks == "org.openscience.cdk.silent.AtomContainer2"))
  32. }