-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/add mdposit scraper #61
Changes from 40 commits
0a37b89
caf2865
9147f32
f809832
e1a4e9d
fb283e1
064d94b
e150d24
e3c5e38
cfe2622
5b01789
5533d8b
9ebc838
96793e5
f031e28
6cb949d
3871d22
c9be76f
542f54a
21943fc
d826989
671008c
f987ea7
059d51f
ebf4470
63181fa
7a5f580
d0324ee
8b57c76
024efa9
88b9955
dd724a7
9e0374f
6b959da
e3a353c
7068584
9cd0a88
40ea3ca
a8ed77b
7884275
71f7c43
3d003b3
cf32a04
91595f1
6658973
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -171,6 +171,26 @@ This command will: | |||||
| 5. Save the extracted metadata to Parquet files | ||||||
|
|
||||||
|
|
||||||
| ## Scrape MDDB | ||||||
|
|
||||||
| Have a look at the notes regarding [MDDB](docs/mddb.md) and its API. | ||||||
|
|
||||||
| Scrape MDDB (MDposit MMB node and MDposit Inria node) to collect molecular dynamics (MD) datasets and files: | ||||||
|
|
||||||
| ```bash | ||||||
| uv run scrape-mddb --output-dir data | ||||||
| ``` | ||||||
|
|
||||||
| This command will: | ||||||
|
|
||||||
| 1. Search for molecular dynamics datasets and files through the MDposit API nodes. | ||||||
| 2. Parse metadata and validate them using the Pydantic models | ||||||
| `DatasetMetadata` and `FileMetadata`. | ||||||
| 3. Save validated files and datasets metadata. | ||||||
|
|
||||||
| The scraping takes about 13 minutes. | ||||||
|
||||||
| The scraping takes about 13 minutes. | |
| The scraping may take several minutes, depending on your network connection and hardware. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,87 @@ | ||||||||||||||||||||||
| # MDDB | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| > The [MDDB (Molecular Dynamics Data Bank) project](https://mddbr.eu/about/) is an initiative to collect, preserve, and share molecular dynamics (MD) simulation data. As part of this project, **MDposit** is an open platform that provides web access to atomistic MD simulations. Its goal is to facilitate and promote data sharing within the global scientific community to advance research. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The MDposit infrastructure is distributed across several MDposit nodes. All metadata are accessible through the global node: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| MDposit MMB node: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - web site: <https://mdposit.mddbr.eu/> | ||||||||||||||||||||||
| - documentation: <https://mdposit.mddbr.eu/#/help> | ||||||||||||||||||||||
| - API: <https://mdposit.mddbr.eu/api/rest/docs/> | ||||||||||||||||||||||
| - API base URL: <https://mdposit.mddbr.eu/api/rest/v1> | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| No account / token is needed to access the MDposit API. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Getting metadata | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### Datasets | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| In MDposit, a dataset (a simulation and its related files) is called a "[project](https://mdposit.mddbr.eu/api/rest/docs/#/projects/get_projects_summary)". | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| APY entrypoint to get the total number of projects: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - Endpoint: `/projects/summary` | ||||||||||||||||||||||
| - HTTP methode: GET | ||||||||||||||||||||||
|
||||||||||||||||||||||
| APY entrypoint to get the total number of projects: | |
| - Endpoint: `/projects/summary` | |
| - HTTP methode: GET | |
| API entrypoint to get the total number of projects: | |
| - Endpoint: `/projects/summary` | |
| - HTTP method: GET |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in docs: “HTTP methode” should be “HTTP method”.
| - HTTP methode: GET | |
| - HTTP method: GET |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ extend-select = [ | |
| ignore = [ | ||
| "COM812", # Redundant with ruff formatter. See: https://docs.astral.sh/ruff/rules/missing-trailing-comma/ | ||
| "G004", # f-strings are allowed with the loguru module. See https://docs.astral.sh/ruff/rules/logging-f-string/ | ||
| "PERF401", # list.extend suggestion is not applicable when appending model instances. | ||
| ] | ||
|
Comment on lines
41
to
44
|
||
|
|
||
| # Force numpy-style for docstrings | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,9 +3,16 @@ | |||||
| import re | ||||||
| from typing import Annotated | ||||||
|
|
||||||
| from pydantic import BaseModel, ConfigDict, Field, StringConstraints, field_validator | ||||||
| from pydantic import ( | ||||||
| BaseModel, | ||||||
| ConfigDict, | ||||||
| Field, | ||||||
| StringConstraints, | ||||||
| field_validator, | ||||||
| model_validator, | ||||||
| ) | ||||||
|
|
||||||
| from .enums import ExternalDatabaseName | ||||||
| from .enums import ExternalDatabaseName, MoleculeType | ||||||
|
|
||||||
| DOI = Annotated[ | ||||||
| str, | ||||||
|
|
@@ -37,6 +44,30 @@ class ExternalIdentifier(BaseModel): | |||||
| None, min_length=1, description="Direct URL to the identifier into the database" | ||||||
| ) | ||||||
|
|
||||||
| @model_validator(mode="after") | ||||||
| def compute_url(self) -> "ExternalIdentifier": | ||||||
| """Compute the URL for the external identifier. | ||||||
|
|
||||||
| Parameters | ||||||
| ---------- | ||||||
| self: ExternalIdentifier | ||||||
| The model instance being validated, with all fields already validated. | ||||||
|
|
||||||
| Returns | ||||||
| ------- | ||||||
| ExternalIdentifier | ||||||
| The model instance with the URL field computed if it was not provided. | ||||||
| """ | ||||||
| if self.url is not None: | ||||||
| return self | ||||||
|
|
||||||
| if self.database_name == ExternalDatabaseName.PDB: | ||||||
| self.url = f"https://www.rcsb.org/structure/{self.identifier}" | ||||||
| elif self.database_name == ExternalDatabaseName.UNIPROT: | ||||||
| self.url = f"https://www.uniprot.org/uniprotkb/{self.identifier}" | ||||||
|
|
||||||
| return self | ||||||
|
|
||||||
|
|
||||||
| class Molecule(BaseModel): | ||||||
| """Molecule in a simulation.""" | ||||||
|
|
@@ -45,18 +76,25 @@ class Molecule(BaseModel): | |||||
| model_config = ConfigDict(extra="forbid") | ||||||
|
|
||||||
| name: str = Field(..., description="Name of the molecule.") | ||||||
| type: MoleculeType | None = Field( | ||||||
| None, | ||||||
| description="Type of the molecule." | ||||||
|
Essmaw marked this conversation as resolved.
|
||||||
| "Allowed values in the MoleculeType enum. " | ||||||
|
||||||
| "Allowed values in the MoleculeType enum. " | |
| " Allowed values in the MoleculeType enum. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text says the scraper targets only the MMB and INRIA nodes, but the implementation includes an additional CINECA node in
MDDB_NODES. Update the README wording to match the actual supported nodes (or clarify which nodes are scraped).