From c1400ae9dbdd0c0000531f53c5414cd2c40a5f9f Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 22 Oct 2025 17:14:35 +0800 Subject: Handle the case where given an experiment ID, no corresponding LIBRARY_STRATEGY or LIBRARY_SOURCE could be found. --- Code/download_ena_experiment_records.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Code/download_ena_experiment_records.py (limited to 'Code/download_ena_experiment_records.py') diff --git a/Code/download_ena_experiment_records.py b/Code/download_ena_experiment_records.py new file mode 100644 index 0000000..f3c9126 --- /dev/null +++ b/Code/download_ena_experiment_records.py @@ -0,0 +1,17 @@ +# Given an experiment's accession SRX6711770, get its full information from the following link +# https://www.ebi.ac.uk/ena/browser/api/xml/SRX6711770 + +import urllib.request + +def get_xml_for_experiment_id(eid): + url = 'https://www.ebi.ac.uk/ena/browser/api/xml/%s' % (eid) + content = '' + with urllib.request.urlopen(url) as response: + content = response.read() + return content.decode('utf-8') + + + +if __name__ == '__main__': + print(get_xml_for_experiment_id('SRX6711770')) + -- cgit v1.2.1