Skip to content

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

Merged
peterjc merged 35 commits into
biopython:masterfrom
rob-miller:ic-doc-update
Jan 24, 2023
Merged

peterjc merged 35 commits into
biopython:masterfrom
rob-miller:ic-doc-update

Conversation

@rob-miller

Copy link
Copy Markdown
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

codecov Bot commented Apr 6, 2022 •

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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 done
internal coordinate data files.

**Usage:**
::

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread Bio/PDB/internal_coords.py Resolved
@peterjc

peterjc commented Apr 16, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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

peterjc commented Apr 22, 2022

Copy link
Copy Markdown
Member

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

@JoaoRodrigues

Copy link
Copy Markdown
Member

Hi @peterjc, sure. On it.

@rob-miller

Copy link
Copy Markdown
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
Copy Markdown
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

peterjc commented Jun 6, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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

@peterjc

peterjc commented Jun 14, 2022

Copy link
Copy Markdown
Member

I do like pretty pictures for documentation :)

@rob-miller

Copy link
Copy Markdown
Contributor Author

closes #4213

@peterjc

peterjc commented Jan 24, 2023

Copy link
Copy Markdown
Member

@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

JoaoRodrigues commented Jan 24, 2023 via email

Copy link
Copy Markdown
Member

@JoaoRodrigues JoaoRodrigues left a comment

Copy link
Copy Markdown
Member

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

peterjc commented Jan 24, 2023

Copy link
Copy Markdown
Member

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

rob-miller commented Jan 24, 2023 via email

Copy link
Copy Markdown
Contributor Author

@rob-miller

rob-miller commented Jan 24, 2023 via email

Copy link
Copy Markdown
Contributor Author

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

peterjc commented Jan 24, 2023

Copy link
Copy Markdown
Member

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

peterjc commented Jan 24, 2023

Copy link
Copy Markdown
Member

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

@rob-miller

Copy link
Copy Markdown
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.

3 participants