PageRenderTime 10ms CodeModel.GetById 5ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1test.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
12test.get.hcount <- function() {
13  m <- parse.smiles('c1ccccc1')[[1]]
14  x <- unlist(lapply(get.atoms(m), get.hydrogen.count))
15  checkEquals(1, unique(x))
16}
17
18
19test.charges <- function() {
20  m <- parse.smiles("CCC")[[1]]
21  a <- get.atoms(m)
22  for (atom in a) {
23    checkTrue(is.null(get.charge(atom)))
24  }
25
26  m <- parse.smiles("[O-]CC")[[1]]
27  a <- get.atoms(m)
28  checkTrue(is.null(get.charge(a[[1]])))
29
30  checkEquals(-1, get.formal.charge(a[[1]]))
31  checkEquals(0, get.formal.charge(a[[2]]))
32  checkEquals(0, get.formal.charge(a[[3]]))  
33}