File: runit.atoms.R

package info (click to toggle)
r-cran-rcdk 3.5.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 824 kB
  • sloc: makefile: 14; sh: 13
file content (33 lines) | stat: -rw-r--r-- 818 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
test.is.aromatic <- function()
{
  m <- parse.smiles('c1ccccc1CC')[[1]]
  x <- unlist(lapply(get.atoms(m), is.aromatic))
  checkEquals(6, length(which(x)))
  do.typing(m)
  do.aromaticity(m)
  x <- unlist(lapply(get.atoms(m), is.aromatic))
  checkEquals(6, length(which(x)))  
}

test.get.hcount <- function() {
  m <- parse.smiles('c1ccccc1')[[1]]
  x <- unlist(lapply(get.atoms(m), get.hydrogen.count))
  checkEquals(1, unique(x))
}


test.charges <- function() {
  m <- parse.smiles("CCC")[[1]]
  a <- get.atoms(m)
  for (atom in a) {
    checkTrue(is.null(get.charge(atom)))
  }

  m <- parse.smiles("[O-]CC")[[1]]
  a <- get.atoms(m)
  checkTrue(is.null(get.charge(a[[1]])))

  checkEquals(-1, get.formal.charge(a[[1]]))
  checkEquals(0, get.formal.charge(a[[2]]))
  checkEquals(0, get.formal.charge(a[[3]]))  
}