Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip whitespaces from atom/element names #44

Open
babaid opened this issue Oct 14, 2023 · 1 comment
Open

Strip whitespaces from atom/element names #44

babaid opened this issue Oct 14, 2023 · 1 comment

Comments

@babaid
Copy link

babaid commented Oct 14, 2023

When looking at an atom record I discovered that the whitespaces do not get stripped from the atom/element names when they are parsed.

An example: Dict{String, AbstractAtom}(" CA " => Atom CA with serial ,.....

As you can see, CA is sorrounded by spaces, which is kind of inconvenient. I suggest changing the function parseatomname in pdb.jl to the following:

function parseatomname(line::String, line_n::Integer=1)
    try
            return strip(line[13:16])
    catch
            throw(PDBParseError("could not read atom name", line_n, line))
    end
end

And the same for parseelement.

@jgreener64
Copy link
Member

atomname and similar functions strip the white space, and you can index into residues without the white space.

It does need to be kept though, since different spacings are used to indicate e.g. C-alpha vs calcium, and this should be preserved on writing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants