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
Raise error if file format is incorrect #73
Raise error if file format is incorrect #73
Conversation
Thanks for the PR! Right now, the unit tests are based on nosetest which is why importing pytest failed the unit tests. I moved another project to pytest and like it overall, however, for biopandas, this is best done in a separate PR (in the future). So, I made some adjustments to the unittests here.
Huh, yeah, that was a weird one! It took me a bit to figure it out but then I remembered that I implemented split_multimol2 as a generator. So,
I generally think that's a good idea. Maybe raising a warning would be a good compromise to notify users but allow them to investigate PDB files that don't have atom entries (but only hetatm/anisou entries etc). |
Thanks, excellent!! |
I appreciate the PR, and no worries at all! |
Hello @dominiquesydow! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-10-30 14:30:40 UTC |
Agreed! I added the warning (only checking for missing ATOM entries). Is there anything else I should address in this PR that I might have missed? |
This looks great. Thanks a lot. It's good to merge! |
…e-error Raise error if file format is incorrect
Code of Conduct
Description
Raise
ValueError
if an incorrect file format is loaded using themol2
orpdb
modules.Two checks per
mol2
/pdb
module would be optimal:This PR suggests the following changes:
ValueError
inPandasPdb._read_pdb
if file extension not .pdb/.pdb.gzlen(dfs['ATOM'] == 0
to check if any atomic data was loaded? However, I am not sure if you wantValueError
inPandasPdb._get_atomsection
if format is not mol2 (@<TRIPOS>ATOM
not found)this behaviour in general.
mol2.mol2_io.split_multimol2
. I tried to add:However, the error is not thrown, which I don't understand right now.
Related issues or pull requests
Suggests changes for #71.
Pull Request Checklist
./docs/sources/CHANGELOG.md
file (if applicable)./biopandas/*/tests
directories (if applicable)biopandas/docs/sources/
(if applicable)PYTHONPATH='.' pytest ./biopandas -sv
and 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 ./biopandas