Created
March 27, 2026 06:13
-
-
Save kozo2/0b7fa8d73e4839980a90ed3ab2115cb0 to your computer and use it in GitHub Desktop.
MetaboLights assay index and maf file names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| url = "https://www.ebi.ac.uk/metabolights/ws/studies" | |
| response = requests.get(url) | |
| response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx) | |
| studies = response.json() | |
| mtbls_ids = data['content'] | |
| for study_id in mtbls_ids: | |
| url = f"https://www.ebi.ac.uk/metabolights/ws/studies/public/study/{study_id}" | |
| response = requests.get(url) | |
| response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx) | |
| data = response.json() | |
| for assay in data['content']['assays']: | |
| print(study_id, assay['assayNumber'], assay['fileName'], assay['metaboliteAssignment']['metaboliteAssignmentFileName']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment