/rcdk/inst/unitTests/runit.atoms.R

http://github.com/rajarshi/cdkr · R · 33 lines · 28 code · 5 blank · 0 comment · 1 complexity · 5d1789dc0f3424cb569ed67eb695aa58 MD5 · raw file

  1. test.is.aromatic <- function()
  2. {
  3. m <- parse.smiles('c1ccccc1CC')[[1]]
  4. x <- unlist(lapply(get.atoms(m), is.aromatic))
  5. checkEquals(6, length(which(x)))
  6. do.typing(m)
  7. do.aromaticity(m)
  8. x <- unlist(lapply(get.atoms(m), is.aromatic))
  9. checkEquals(6, length(which(x)))
  10. }
  11. test.get.hcount <- function() {
  12. m <- parse.smiles('c1ccccc1')[[1]]
  13. x <- unlist(lapply(get.atoms(m), get.hydrogen.count))
  14. checkEquals(1, unique(x))
  15. }
  16. test.charges <- function() {
  17. m <- parse.smiles("CCC")[[1]]
  18. a <- get.atoms(m)
  19. for (atom in a) {
  20. checkTrue(is.null(get.charge(atom)))
  21. }
  22. m <- parse.smiles("[O-]CC")[[1]]
  23. a <- get.atoms(m)
  24. checkTrue(is.null(get.charge(a[[1]])))
  25. checkEquals(-1, get.formal.charge(a[[1]]))
  26. checkEquals(0, get.formal.charge(a[[2]]))
  27. checkEquals(0, get.formal.charge(a[[3]]))
  28. }