scripts/export/genomes/fetch_gen_metadata.py
def fetch_assembly_links(gca_acc):
    """
    Retrieves and returns a dictionary with all ftp links found in the GCA xml
    file

    gca_acc: A valid GCA accession from ENA
    """

    gca_ftp_links = {}

    response = requests.get(gc.ENA_XML_URL % gca_acc)

    if response.status_code == httplib.OK:

        xml_tree = ET.fromstring(response.content)

        # fetch assembly links node
        assembly_node = xml_tree.find("ASSEMBLY")
        assembly_links = assembly_node.find(
            "ASSEMBLY_LINKS")

        if assembly_links is not None:
            assembly_links = assembly_links.findall("ASSEMBLY_LINK")

            # loop over all available links
            for link in assembly_links:
                label = link.find("URL_LINK").find("LABEL").text.replace(' ', '_')
                url = link.find("URL_LINK").find("URL").text

                gca_ftp_links[label] = url

                label = None
                url = None

    return gca_ftp_links

    Retrieves and returns a dictionary with all ftp links found in the GCA xml
    file

    gca_acc: A valid GCA accession from ENA
    
Retrieves and returns a dictionary with all ftp links found in the GCA xml
file

A valid GCA accession from ENA
Retrieves and returns a dictionary with all ftp links found in the GCA xml file A valid GCA accession from ENA
def fetch_assembly_links(gca_acc):
    gca_ftp_links = {}
    response = requests.get(gc.ENA_XML_URL % gca_acc)
    if response.status_code == httplib.OK:
        xml_tree = ET.fromstring(response.content)
        assembly_node = xml_tree.find("ASSEMBLY")
        assembly_links = assembly_node.find(
            "ASSEMBLY_LINKS")
        if assembly_links is not None:
            assembly_links = assembly_links.findall("ASSEMBLY_LINK")
            for link in assembly_links:
                label = link.find("URL_LINK").find("LABEL").text.replace(' ', '_')
                url = link.find("URL_LINK").find("URL").text
                gca_ftp_links[label] = url
                label = None
                url = None
    return gca_ftp_links
def fetch_assembly_links ( gca_acc ) : gca_ftp_links = { } response = requests . get ( gc . ENA_XML_URL % gca_acc ) if response . status_code == httplib . OK : xml_tree = ET . fromstring ( response . content ) assembly_node = xml_tree . find ( "ASSEMBLY" ) assembly_links = assembly_node . find ( "ASSEMBLY_LINKS" ) if assembly_links is not None : assembly_links = assembly_links . findall ( "ASSEMBLY_LINK" ) for link in assembly_links : label = link . find ( "URL_LINK" ) . find ( "LABEL" ) . text . replace ( ' ' , '_' ) url = link . find ( "URL_LINK" ) . find ( "URL" ) . text gca_ftp_links [ label ] = url label = None url = None return gca_ftp_links
Retrieves and returns a dictionary with all ftp links found in the GCA xml
file
Retrieves and returns a dictionary with all ftp links found in the GCA xml file
"""
    Retrieves and returns a dictionary with all ftp links found in the GCA xml
    file

    gca_acc: A valid GCA accession from ENA
    """ # fetch assembly links node # loop over all available links
gca_acc