scripts/export/genomes/fetch_gen_metadata.py
def fetch_wgs_accs_metadata(upid, assembly_acc, wgs_range):
    """
    This function runs over the wgs range and exports all metadata for every
    accession in the provided wgs range

    wgs_range: A valid ENA-WGS set range
    """

    wgs_entries = []
    entry = {}
    fields = {}

    wgs_accs = gf.fetch_wgs_range_accs(wgs_range)

    for acc in wgs_accs:
        fields = fetch_wgs_acc_metadata(acc)
        # skip if fields dict is empty. This could be due to obsolete accessions
        if fields.keys() == 0:
            continue
        entry["model"] = gc.GENSEQ_MODEL
        entry["pk"] = acc
        entry["fields"] = fields
        # adding upid and wgs_acc in entry fields
        entry["fields"]["upid"] = upid
        entry["fields"]["gen_acc"] = assembly_acc
        wgs_entries.append(entry)
        entry = {}

    return wgs_entries

    This function runs over the wgs range and exports all metadata for every
    accession in the provided wgs range

    wgs_range: A valid ENA-WGS set range
    
This function runs over the wgs range and exports all metadata for every
accession in the provided wgs range

A valid ENA-WGS set range
This function runs over the wgs range and exports all metadata for every accession in the provided wgs range A valid ENA - WGS set range
def fetch_wgs_accs_metadata(upid, assembly_acc, wgs_range):
    wgs_entries = []
    entry = {}
    fields = {}
    wgs_accs = gf.fetch_wgs_range_accs(wgs_range)
    for acc in wgs_accs:
        fields = fetch_wgs_acc_metadata(acc)
        if fields.keys() == 0:
            continue
        entry["model"] = gc.GENSEQ_MODEL
        entry["pk"] = acc
        entry["fields"] = fields
        entry["fields"]["upid"] = upid
        entry["fields"]["gen_acc"] = assembly_acc
        wgs_entries.append(entry)
        entry = {}
    return wgs_entries
def fetch_wgs_accs_metadata ( upid , assembly_acc , wgs_range ) : wgs_entries = [ ] entry = { } fields = { } wgs_accs = gf . fetch_wgs_range_accs ( wgs_range ) for acc in wgs_accs : fields = fetch_wgs_acc_metadata ( acc ) if fields . keys ( ) == 0 : continue entry [ "model" ] = gc . GENSEQ_MODEL entry [ "pk" ] = acc entry [ "fields" ] = fields entry [ "fields" ] [ "upid" ] = upid entry [ "fields" ] [ "gen_acc" ] = assembly_acc wgs_entries . append ( entry ) entry = { } return wgs_entries
This function runs over the wgs range and exports all metadata for every
accession in the provided wgs range
This function runs over the wgs range and exports all metadata for every accession in the provided wgs range
"""
    This function runs over the wgs range and exports all metadata for every
    accession in the provided wgs range

    wgs_range: A valid ENA-WGS set range
    """ # skip if fields dict is empty. This could be due to obsolete accessions # adding upid and wgs_acc in entry fields
upid
assembly_acc
wgs_range