Skip to content

Implementation of from_alphafold - #5457

Open
jauy123 wants to merge 114 commits into
MDAnalysis:developfrom
jauy123:fetcher_alphafold
Open

Implementation of from_alphafold#5457
jauy123 wants to merge 114 commits into
MDAnalysis:developfrom
jauy123:fetcher_alphafold

Conversation

@jauy123

@jauy123 jauy123 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #5432

Changes made in this Pull Request:

  • Implements from_alphafold using StaticFetcher

LLM / AI generated code disclosure

LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: no

PR Checklist

  • Issue raised/referenced?
  • Tests updated/added?
  • Documentation updated/added?
  • package/CHANGELOG file updated?
  • Is your name in package/AUTHORS? (If it is not, add it!)
  • I have read and understand the current AI Policy
  • LLM/AI disclosure was updated.

Developers Certificate of Origin

I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.

@jauy123 jauy123 changed the title Fetcher alphafold Implementation of from_alphafold Aug 12, 2026
@jauy123

jauy123 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

This diverged from #5436 using StaticFetcher as a base.

@jauy123

jauy123 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Docs need to be updated

@read-the-docs-community

read-the-docs-community Bot commented Aug 12, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.27891% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.88%. Comparing base (83bc9a2) to head (d7eefc8).
⚠️ Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
package/MDAnalysis/fetch/fetchers.py 96.74% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5457      +/-   ##
===========================================
+ Coverage    93.87%   93.88%   +0.01%     
===========================================
  Files          182      183       +1     
  Lines        22510    22650     +140     
  Branches      3202     3227      +25     
===========================================
+ Hits         21131    21266     +135     
- Misses         917      921       +4     
- Partials       462      463       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jauy123

jauy123 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Docs are also done here

@orbeckst orbeckst 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.

Impressive work, nice!

My comments are mostly docs and coding style.

I'll leave the heavy commenting to @BradyAJohnston @yuxuanzhuang @talagayev .

Comment thread .gitignore
Comment on lines +1 to +5
# for rn
package/doc/sphinx/build_docs.sh
testsuite/MDAnalysisTests/fetch/run_tests.sh
package/MDAnalysis/TEST.py

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.

Please remove your private gitignores. Instead add them to your .git/info/exclude file, which is not revision-controlled.

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.

Is this PR introducing StaticFetcher ?

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.

Now I am seeing that the main PR is really #5436 – I'll add a quick comment there to send you back here. Sorry.


Primarily designed to be working with `FAIR`_
databases, this method works by sending a request to a web server and
caching them to a registry.The registry is in the format of a

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.

space after period

Notes
-----
The download directory can be overridden by setting the environment
variable ``MDANALYSIS_FETCHER_DATA`` to a valid path. This class uses

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.

Check the reST/sphinx markup for an environment variable (maybe :envvar: ?) and use it.

:mod:`pooch` as a backend for downloading and caching files. The
cache database is created on demand when ``db_name`` does not
exist relative to :attr:`cache_path`.

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.

might need 2 blank lines.

Always check the rendered docs.

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 checked and it rendered fine, which is good. In the past, double-blank lines were needed.

]

return paths if not isinstance(pdb_ids, str) else paths[0]
def from_ALPHAFOLD(id, cache_path=None, progressbar=False, file_format="cif"):

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.

Why capitalized from_ALPHAFOLD when you refer to it elsewhere as AlphaFold? I'd be consistent and call the function from_AlphaFold().


Download a single AlphaFold file and convert it to a universe:

>>> mda.Universe(from_ALPHAFOLD("Q9I1F6"), files_format="pdb")

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.

file_format

.. versionadded:: 2.11.0
"""

if file_format not in _SUPPORTED_FILE_FORMATS_ALPHAFOLD.keys():

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 don't think you need .keys(). in just works with dict keys.

Comment on lines +28 to +30
This suite of functions download structure files from the Research
Collaboratory for Structural Bioinformatics (RCSB)
`Protein Data Batabank`_ (PDB).

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.

The header only talks about Protein Databank but the AlphaFold fetcher is also in here. Personally, I'd create a separate module for AlphaFold, similar to this one here.

However, if you and your mentors prefer to have it in the same file then please at least update the text here to also talk about the AF database (with link).

Comment on lines -54 to +57
#: Name of the :mod:`pooch` cache directory ``pooch.os_cache(DEFAULT_CACHE_NAME_DOWNLOADER)``;
#: see :func:`pooch.os_cache` for further details.
#: Alias to fetchers/DEFAULT_CACHE_NAME_DOWNLOADER
#:
#: .. versionadded:: 2.11.0
DEFAULT_CACHE_NAME_DOWNLOADER = "MDAnalysis_pdbs"
#: Maintained for backwards compatiblity
#:
from .fetchers import DEFAULT_CACHE_NAME_DOWNLOADER

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.

Just remove what you do not want. Given that fetch_PDB had not been released yet (it's not in 2.10.0) you do not need to maintain any compatibility. Just write it as cleanly as you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetcher GSoC GSoC project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GSoC 2026] Implementation of from_alphafold()

2 participants