File: runit.props.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 (25 lines) | stat: -rw-r--r-- 788 bytes parent folder | download | duplicates (3)
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
test.set.props <- function() {
  m <- parse.smiles("CCCC")[[1]]
  set.property(m, "foo", "bar")
  checkEquals(get.property(m,"foo"), "bar")
}

test.get.properties <- function() {
  m <- parse.smiles("CCCC")[[1]]
  set.property(m, "foo", "bar")
  set.property(m, "baz", 1.23)  
  props <- get.properties(m)
  checkEquals(length(props), 3)
  checkTrue(all(sort(names(props)) == c('baz','cdk:Title','foo')))
  checkEquals(props$foo,'bar')
  checkEquals(props$baz,1.23)  
}

## test.props.from.file <- function() {
##   print(getwd())
##   kegg_file <- system.file("molfiles/kegg.sdf", packge="rcdk")
##   f <- load.molecules(kegg_file)
##   checkEquals(length(f), 10)
##   proplens <- unlist(lapply(lapply(f, get.properties), length))
##   checkEquals(proplens, c(5,5,5,5,5,5,5,3,5,5))
## }