Revision fe303085b0c8f132dfa07ce7ab5b38941a1a8d86 authored by Matthias Bernt on 26 August 2022, 10:55:08 UTC, committed by Matthias Bernt on 26 August 2022, 13:53:40 UTC
bed and interval datatypes `check element_is_set` before overwriting metadata. since the having `default=None` and `no_value=0` makes `element_is_set` return True (since `None!=0`). Therefore metadata values are never set
1 parent 4e23fbb
parse_builds_3_sites.py
#!/usr/bin/env python
"""
Connects to sites and determines which builds are available at each.
"""
import xml.etree.ElementTree as ElementTree
import requests
sites = ['http://genome.ucsc.edu/cgi-bin/',
'http://archaea.ucsc.edu/cgi-bin/',
'http://genome-test.gi.ucsc.edu/cgi-bin/']
names = ['main', 'archaea', 'test']
def main():
for i in range(len(sites)):
site = sites[i] + "das/dsn"
trackurl = sites[i] + "hgTracks?"
builds = []
try:
text = requests.get(site).text
except Exception:
print("#Unable to connect to " + site)
continue
try:
tree = ElementTree.fromstring(text)
except Exception:
print("#Invalid xml passed back from " + site)
continue
print("#Harvested from", site)
for dsn in tree:
build = dsn.find("SOURCE").attrib['id']
builds.append(build)
build_dict = {}
for build in builds:
build_dict[build] = 0
builds = list(build_dict.keys())
yield [names[i], trackurl, builds]
if __name__ == "__main__":
for site in main():
print(site[0] + "\t" + site[1] + "\t" + ",".join(site[2]))
Computing file changes ...