write.pdb(pdb, chain="D")

Issue #123 resolved
Lars Skjærven created an issue

agree that this should work?

library(bio3d)
pdb = read.pdb("1etl")
write.pdb(pdb, chain="D")

looks like it only assigns the first atom to chain D, and the rest is NA.

Comments (4)

  1. Barry Grant

    I agree. Early versions used to work like but had trouble with input vectors whose length did not match the the number of atoms so it got changed to its current form. Regardless, this is a bug as NA should not be the default recycle value for these types of cases.

  2. Xinqiu Yao

    What about this: if length(chain)==1, we assign all atoms chainid to "chain". Otherwise, if length(chain)>1, we check the length and give an error if length(chain) != nrow(pdb$atom).

    In addition, default chainid should be " " (one space) in output and "NA" in memory. What do you think?

  3. Log in to comment