Repository navigation
Fix read_pdb_from_list for lines without trailing newlines - #165
Open
raashish1601 wants to merge 1 commit into
Open
raashish1601 wants to merge 1 commit into
raashish1601 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code of Conduct
OK
Description
read_pdb_from_list()joined the lines with"", so lines without a trailing newline (for example frompdb_text.split("\n"), as in the issue) gave apdb_textthat is one long line. There was a second, quieter problem:_construct_dfusedline[6:-1]forOTHERSentries to strip the newline, so without it the last real character was dropped. With lines that are not padded to 80 columns, the HEADER entry lost its last character andcodecame back as3eiinstead of3eiy.Changes:
read_pdb_from_list()adds the missing newlines when buildingpdb_textand then parsespdb_text.splitlines(True), the same asread_pdb(). Lists fromreadlines()/splitlines(True)give the same result as before._construct_dfusesline[6:].rstrip(), which still removes the newline but keeps the last character when there is none.Related issues or pull requests
Fixes #130
Pull Request Checklist
./docs/sources/CHANGELOG.mdfile (if applicable)./biopandas/*/testsdirectories (if applicable)biopandas/docs/sources/(if applicable)PYTHONPATH='.' pytest ./biopandas -svand make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g.,PYTHONPATH='.' pytest ./biopandas/classifier/tests/test_stacking_cv_classifier.py -sv)flake8 ./biopandasThe new test
test_read_pdb_from_list_without_newlinesfails onmainand passes with the fix. The fulltests/suite passes locally, and flake8 reports nothing new on the changed lines. The changelog entry is indocs/CHANGELOG.md, which is where the current one lives. No notebook changes were needed.