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

Add inline and Tutorial documentation for internal_coords; change edr… #3898

Merged
merged 35 commits into from Jan 24, 2023

Conversation

rob-miller
Copy link
Contributor

Herewith added tutorial, in-line documentation, and NEWS entry for the internal-coords module work in #3774.

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run pre-commit
    locally, and understand that continuous integration checks will be used to
    confirm the Biopython unit tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

The tutorial examples are mostly as doctest code. Also some IMHO minor code changes:

  • Change the .aks attribute of class edra (and thus children hedron and dihedron) to .atomkeys as discussed in codespell blocking documentation commit on attribute name #3888. I'm going to punt here, request forgiveness later, and claim the attribute was not well documented enough / code not used enough for this to affect anyone, because it is the right thing to do and avoids tweaking the codespell parameters.
  • make the ic_rebuild.structure_rebuild_test results with the -quick option better match the results without that flag (in particular for structures in the Tests/PDB directory).

@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Base: 0.00% // Head: 0.00% // No change to project coverage 👍

Coverage data is based on head (cccede9) compared to base (e1902d1).
Patch has no changes to coverable lines.

❗ Current head cccede9 differs from pull request most recent head bcab729. Consider uploading reports for the commit bcab729 to get more accurate results

Additional details and impacted files
@@      Coverage Diff       @@
##   master   #3898   +/-   ##
==============================
==============================

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rob-miller
Copy link
Contributor Author

Unable to work out the issue running the tutorial tests on linux. Saw same problem on MacOS and solved by wrapping some evaluations in print() statements, but my Ubuntu 18.04 linux does not show any issues for run_tests.py --offline test_Tutorial.py with python 3.7 and/or 3.8.

@peterjc any insights?

@rob-miller rob-miller marked this pull request as draft April 7, 2022 12:11
@rob-miller rob-miller marked this pull request as ready for review April 7, 2022 12:15
@rob-miller rob-miller marked this pull request as draft April 7, 2022 12:16
@rob-miller
Copy link
Contributor Author

Had issues with the following doctests under linux:

>>> myChain.atom_to_internal_coordinates(verbose=True)
chain break at THR  186  due to MaxPeptideBond (1.4 angstroms) exceeded
chain break at THR  216  due to MaxPeptideBond (1.4 angstroms) exceeded

The 'chain break' messages are print()ed by a subroutine a few calls down the stack. Windows and Mac see them, but Linux environment does not. The subroutine appears to work because various results are checked in the subsequent code.

>>> resultDict = structure_rebuild_test(myChain)
>>> resultDict["pass"]
True

On Mac and Windows the result is True as expected, but on Linux it is False. Same code in unittest (test_1a8o) passes fine in all three environments.

>>> myChain2.internal_to_atom_coordinates()
>>> ## confirm result atomArray matches original structure:
>>> np.allclose(cic2.atomArray, myCic.atomArray)
True

Same again - Linux returns False, but the same code in unittest test_1a8o passes fine.

Conclusion: some math is broken in Linux doctest environment?

@rob-miller rob-miller marked this pull request as ready for review April 8, 2022 00:58
@rob-miller rob-miller mentioned this pull request Apr 8, 2022
3 tasks
@@ -18,6 +18,159 @@
description of a structure for 3D printing, and reading/writing structures as
internal coordinate data files.

**Usage:**
::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This next block of code is just an RST literal.

Were there complications using Python syntax highlighting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problems, the code is pretty much identical to what's in the Tutorial (except better annotated there). I'm just cynical and expect no one will look past the API docs so wanted the sample code there at the top of the main internal coords file.

@peterjc
Copy link
Member

peterjc commented Apr 16, 2022

As to the oddity with Linux from this:

% print(chain break message) from subroutine not seen in linux doctest
%xcont-doctest
\begin{minted}{pycon}
>>> # compute bond lengths, angles, dihedral angles
>>> myChain.atom_to_internal_coordinates(verbose=True)
chain break at THR  186  due to MaxPeptideBond (1.4 angstroms) exceeded
chain break at THR  216  due to MaxPeptideBond (1.4 angstroms) exceeded
\end{minted}

That's all via https://github.com/biopython/biopython/blob/master/Tests/test_Tutorial.py which is my glorious hack combining LaTeX with doctests. Without digging into it, my guess might be some code is not using the print(...) function but messing about with sys.stdout instead?

I'm happy with the workaround (skipping that part as a doctest).

@rob-miller
Copy link
Contributor Author

That's all via https://github.com/biopython/biopython/blob/master/Tests/test_Tutorial.py which is my glorious hack combining LaTeX with doctests. Without digging into it, my guess might be some code is not using the print(...) function but messing about with sys.stdout instead?

And fine and much valued work that (LaTeX + doctests) is!

I tried working on that specific message without improvement, and now hitting the _aligners import issue raised in #3876.

@peterjc
Copy link
Member

peterjc commented Apr 22, 2022

Can I leave this to you please @JoaoRodrigues since you handled #3774?

@JoaoRodrigues
Copy link
Member

Hi @peterjc, sure. On it.

@rob-miller
Copy link
Contributor Author

Thank you @JoaoRodrigues!!! You are a star and hero for making it so the rest of us can submit pull requests, well done on the investigation and solution.

@rob-miller
Copy link
Contributor Author

@peterjc have you noticed this problem on the ci tests?

Traceback (most recent call last):
  File "D:\a\biopython\biopython\Tests\test_PhyloXML.py", line 574, in test_phylo
    self._rewrite_and_call(
  File "D:\a\biopython\biopython\Tests\test_PhyloXML.py", line 512, in _rewrite_and_call
    getattr(inst, test)()
  File "D:\a\biopython\biopython\Tests\test_PhyloXML.py", line 287, in test_Distribution
    self.assertEqual(dist.desc, desc)
AssertionError: 'ETH Zürich' != 'ETH Z�rich'
- ETH Zürich
?      ^^
+ ETH Z�rich
?      ^

@peterjc
Copy link
Member

peterjc commented Jun 6, 2022

I think I saw that last week but haven't opened an issue yet (too busy with a sick child off school), I suspected something changed in the test environment rather than our code. Would you log this please?

@rob-miller
Copy link
Contributor Author

This is not a WIP, honest -- I'm just using 'in anger' now and finding niggles.

@peterjc
Copy link
Member

peterjc commented Jun 14, 2022

I do like pretty pictures for documentation :)

@rob-miller
Copy link
Contributor Author

closes #4213

@peterjc
Copy link
Member

peterjc commented Jan 24, 2023

@JoaoRodrigues do you still want to review this pull request from Rob? If not there are a few other regular contributors to the PDB code we could ask.

@JoaoRodrigues
Copy link
Member

JoaoRodrigues commented Jan 24, 2023 via email

Copy link
Member

@JoaoRodrigues JoaoRodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna go ahead and give this a go, since it's been a while and all tests and documentation seem in good shape. I had some comments but overall, it was nitpicking that's truly not necessary for the PR to be merged.

@peterjc
Copy link
Member

peterjc commented Jan 24, 2023

Great, thank you.

Rob, it looks like you've deliberately tried to give a useful commit history, so shall we rebase-and-merge this then?

@rob-miller
Copy link
Contributor Author

rob-miller commented Jan 24, 2023 via email

@rob-miller
Copy link
Contributor Author

rob-miller commented Jan 24, 2023 via email

@peterjc peterjc merged commit 2422695 into biopython:master Jan 24, 2023
@peterjc
Copy link
Member

peterjc commented Jan 24, 2023

Github's rebase-and-merge button was green, it normally warns if a conflict would prevent using it. Clicked!

Thank you again for your patience Rob 👍

@peterjc
Copy link
Member

peterjc commented Jan 24, 2023

Looking at this afresh, is there anything you'd like to move about in the NEWS file?

@rob-miller
Copy link
Contributor Author

Looking at this afresh, is there anything you'd like to move about in the NEWS file?

Thank you, yes have submitted #4222 with just that part. Feel free to modify as you see fit.

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

Successfully merging this pull request may close these issues.

None yet

3 participants