write.pdb print segment left-justified

Issue #402 resolved
Former user created an issue

Dear developers

We noticed a bug in the write.pdb function when the flag print.segid is TRUE. According to the PDB format guide the segments should be left justified, but in the original function they are right justified.

We fixed the problem by copying the write.pdb function and replacing the following lines (128 to 131):

    format <- "%-6s%5s  %-3s%1s%-4s%1s%4s%1s%3s%8.3f%8.3f%8.3f%6.2f%6.2f%6s%4s%2s%2s"
    if (nchar(elety) > 3) {
        format <- "%-6s%5s %-4s%1s%-4s%1s%4s%1s%3s%8.3f%8.3f%8.3f%6.2f%6.2f%6s%4s%2s%2s"
    }

by:

    format <- "%-6s%5s  %-3s%1s%-4s%1s%4s%1s%3s%8.3f%8.3f%8.3f%6.2f%6.2f%6s%-4s%2s%2s"
    if (nchar(elety) > 3) {
        format <- "%-6s%5s %-4s%1s%-4s%1s%4s%1s%3s%8.3f%8.3f%8.3f%6.2f%6.2f%6s%-4s%2s%2s"
    }

We believe this could be easily changed in the next version of bio3d.

cheers

Mauricio Costa and Leo Bastos

Comments (3)

  1. Xinqiu Yao

    Hi Mauricio and Leo,

    Thanks for reporting this! We will update the development version soon and include the bugfix in next patched release.

  2. Log in to comment