comparison bio2srr.py @ 10:ccec96a537b7

planemo upload for repository https://toolrepo.galaxytrakr.org/view/jpayne/bioproject_to_srr_2/556cac4fb538
author jpayne
date Mon, 06 May 2024 00:12:39 -0400
parents f9f1d0a0599a
children 7fd0ef5842e7
comparison
equal deleted inserted replaced
9:f9f1d0a0599a 10:ccec96a537b7
87 response.raise_for_status() 87 response.raise_for_status()
88 replyy = response.json() 88 replyy = response.json()
89 for field, value in replyy.get("result", {}).items(): 89 for field, value in replyy.get("result", {}).items():
90 if "uids" not in field: 90 if "uids" not in field:
91 yield bioproject, field, value["sampledata"] # this is XML, deleriously 91 yield bioproject, field, value["sampledata"] # this is XML, deleriously
92 sleep(0.1) 92 sleep(1)
93 93
94 94
95 biosample_example = """ 95 biosample_example = """
96 <BioSample access="public" publication_date="2020-12-21T00:00:00.000" last_update="2022-06-23T17:45:35.674" submission_date="2020-12-21T15:08:05.690" id="17131268" accession="SAMN17131268"> 96 <BioSample access="public" publication_date="2020-12-21T00:00:00.000" last_update="2022-06-23T17:45:35.674" submission_date="2020-12-21T15:08:05.690" id="17131268" accession="SAMN17131268">
97 <Ids> 97 <Ids>
154 sleep(0.1) 154 sleep(0.1)
155 response = requests.get(elink, params=dict(id=",".join(biosampleids), dbfrom="biosample", db="sra", format="json")) 155 response = requests.get(elink, params=dict(id=",".join(biosampleids), dbfrom="biosample", db="sra", format="json"))
156 response.raise_for_status() 156 response.raise_for_status()
157 reply = response.json() 157 reply = response.json()
158 for ids in batched(reply.get("linksets", [{}])[0].get("linksetdbs", [{}])[0].get("links", []), 200): 158 for ids in batched(reply.get("linksets", [{}])[0].get("linksetdbs", [{}])[0].get("links", []), 200):
159 sleep(0.1) 159 sleep(0.3)
160 response = requests.get(esummary, params=dict(id=','.join(ids), db="sra", format="json")) 160 response = requests.get(esummary, params=dict(id=','.join(ids), db="sra", format="json"))
161 response.raise_for_status() 161 response.raise_for_status()
162 replyy = response.json() 162 replyy = response.json()
163 for field, value in replyy.get("result", {}).items(): 163 for field, value in replyy.get("result", {}).items():
164 if "uids" not in field: 164 if "uids" not in field: