trim.pdb() with 'inverse' argument

Issue #176 resolved
Lars Skjærven created an issue

I made a small revision of the trim.pdb() function to enable trimming of the inverse selection. Usage could e.g. be to select everything else than the protein:

pdb <- read.pdb("1BPX")
sele <- atom.select(pdb, "protein")
np <- trim.pdb(pdb, sele, invese=TRUE) 

Only a small revision is needed in the function.

  if(inverse) {
    sele.all <- atom.select(pdb, "all", verbose=verbose)
    tmp <- NULL
    tmp$atom <- which(!(sele.all$atom %in% inds$atom))
    tmp$xyz <- atom2xyz(tmp$atom)
    class(tmp) <- "select"
    inds <- tmp
    rm(tmp)

    if(verbose) {
      cat("\n Selection inverted. Summary of new indices follows: \n")
      print(inds)
    }
  }

Comments (4)

  1. Lars Skjærven reporter

    I have a version in trim.pdb, but perhaps it makes more sense to put it in atom.select. I will try

  2. Log in to comment