/rcdk/inst/unitTests/runit.props.R

http://github.com/rajarshi/cdkr · R · 25 lines · 15 code · 2 blank · 8 comment · 1 complexity · dc6a130b7131b6ac1aadfeb047bae785 MD5 · raw file

  1. test.set.props <- function() {
  2. m <- parse.smiles("CCCC")[[1]]
  3. set.property(m, "foo", "bar")
  4. checkEquals(get.property(m,"foo"), "bar")
  5. }
  6. test.get.properties <- function() {
  7. m <- parse.smiles("CCCC")[[1]]
  8. set.property(m, "foo", "bar")
  9. set.property(m, "baz", 1.23)
  10. props <- get.properties(m)
  11. checkEquals(length(props), 3)
  12. checkTrue(all(sort(names(props)) == c('baz','cdk:Title','foo')))
  13. checkEquals(props$foo,'bar')
  14. checkEquals(props$baz,1.23)
  15. }
  16. ## test.props.from.file <- function() {
  17. ## print(getwd())
  18. ## kegg_file <- system.file("molfiles/kegg.sdf", packge="rcdk")
  19. ## f <- load.molecules(kegg_file)
  20. ## checkEquals(length(f), 10)
  21. ## proplens <- unlist(lapply(lapply(f, get.properties), length))
  22. ## checkEquals(proplens, c(5,5,5,5,5,5,5,3,5,5))
  23. ## }