scripts/export/rfam_xml_dumper.py
def build_genome_additional_fields(entry, fields):
    """
    Builds additional field nodes for a Genome

    entry:  This is the xml.etree.ElementTree at the point of entry
    fields: A list of additional fields to expand the entry with

    return: void
    """

    # TO DO - Generalize this one by executing a query to fetch additional
    # fields here

    add_fields = ET.SubElement(entry, "additional_fields")

    # adding entry type
    ET.SubElement(add_fields, "field", name="entry_type").text = "Genome"

    if fields["assembly_acc"] is None:
        ET.SubElement(add_fields, "field", name="gca_accession").text = ''
    else:
        ET.SubElement(add_fields, "field", name="gca_accession").text = fields["assembly_acc"]

    ET.SubElement(add_fields, "field", name="length").text = str(fields["total_length"])
    ET.SubElement(add_fields, "field", name="tax_string").text = fields["tax_string"]
    ET.SubElement(add_fields, "field", name="ncbi_taxid").text = str(fields["ncbi_id"])
    ET.SubElement(add_fields, "field", name="num_rfam_hits").text = str(fields["num_rfam_regions"])
    ET.SubElement(add_fields, "field", name="num_families").text = str(fields["num_families"])
    ET.SubElement(add_fields, "field", name="scientific_name").text = str(fields["name"])  # redundant

    # add popular species if any
    species = str(fields["ncbi_id"])
    if species in rs.POPULAR_SPECIES:
        ET.SubElement(add_fields, "field", name="popular_species").text = species

    if fields["common_name"] is not None:
        ET.SubElement(add_fields, "field", name="common_name").text = str(fields["common_name"])

    if fields["assembly_level"] is not None:
        ET.SubElement(add_fields, "field", name="assembly_level").text = str(fields["assembly_level"])

    if fields["assembly_name"] is not None:
        ET.SubElement(add_fields, "field", name="assembly_name").text = str(fields["assembly_name"])

    return add_fields

    Builds additional field nodes for a Genome

    entry:  This is the xml.etree.ElementTree at the point of entry
    fields: A list of additional fields to expand the entry with

    return: void
    
Builds additional field nodes for a Genome
entry:  This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with

void
Builds additional field nodes for a Genome entry : This is the xml . etree . ElementTree at the point of entry fields : A list of additional fields to expand the entry with void
def build_genome_additional_fields(entry, fields):
    add_fields = ET.SubElement(entry, "additional_fields")
    ET.SubElement(add_fields, "field", name="entry_type").text = "Genome"
    if fields["assembly_acc"] is None:
        ET.SubElement(add_fields, "field", name="gca_accession").text = ''
    else:
        ET.SubElement(add_fields, "field", name="gca_accession").text = fields["assembly_acc"]
    ET.SubElement(add_fields, "field", name="length").text = str(fields["total_length"])
    ET.SubElement(add_fields, "field", name="tax_string").text = fields["tax_string"]
    ET.SubElement(add_fields, "field", name="ncbi_taxid").text = str(fields["ncbi_id"])
    ET.SubElement(add_fields, "field", name="num_rfam_hits").text = str(fields["num_rfam_regions"])
    ET.SubElement(add_fields, "field", name="num_families").text = str(fields["num_families"])
    ET.SubElement(add_fields, "field", name="scientific_name").text = str(fields["name"])  
    species = str(fields["ncbi_id"])
    if species in rs.POPULAR_SPECIES:
        ET.SubElement(add_fields, "field", name="popular_species").text = species
    if fields["common_name"] is not None:
        ET.SubElement(add_fields, "field", name="common_name").text = str(fields["common_name"])
    if fields["assembly_level"] is not None:
        ET.SubElement(add_fields, "field", name="assembly_level").text = str(fields["assembly_level"])
    if fields["assembly_name"] is not None:
        ET.SubElement(add_fields, "field", name="assembly_name").text = str(fields["assembly_name"])
    return add_fields
def build_genome_additional_fields ( entry , fields ) : add_fields = ET . SubElement ( entry , "additional_fields" ) ET . SubElement ( add_fields , "field" , name = "entry_type" ) . text = "Genome" if fields [ "assembly_acc" ] is None : ET . SubElement ( add_fields , "field" , name = "gca_accession" ) . text = '' else : ET . SubElement ( add_fields , "field" , name = "gca_accession" ) . text = fields [ "assembly_acc" ] ET . SubElement ( add_fields , "field" , name = "length" ) . text = str ( fields [ "total_length" ] ) ET . SubElement ( add_fields , "field" , name = "tax_string" ) . text = fields [ "tax_string" ] ET . SubElement ( add_fields , "field" , name = "ncbi_taxid" ) . text = str ( fields [ "ncbi_id" ] ) ET . SubElement ( add_fields , "field" , name = "num_rfam_hits" ) . text = str ( fields [ "num_rfam_regions" ] ) ET . SubElement ( add_fields , "field" , name = "num_families" ) . text = str ( fields [ "num_families" ] ) ET . SubElement ( add_fields , "field" , name = "scientific_name" ) . text = str ( fields [ "name" ] ) species = str ( fields [ "ncbi_id" ] ) if species in rs . POPULAR_SPECIES : ET . SubElement ( add_fields , "field" , name = "popular_species" ) . text = species if fields [ "common_name" ] is not None : ET . SubElement ( add_fields , "field" , name = "common_name" ) . text = str ( fields [ "common_name" ] ) if fields [ "assembly_level" ] is not None : ET . SubElement ( add_fields , "field" , name = "assembly_level" ) . text = str ( fields [ "assembly_level" ] ) if fields [ "assembly_name" ] is not None : ET . SubElement ( add_fields , "field" , name = "assembly_name" ) . text = str ( fields [ "assembly_name" ] ) return add_fields
Builds additional field nodes for a Genome
entry:  This is the xml.etree.ElementTree at the point of entry
fields: A list of additional fields to expand the entry with
Builds additional field nodes for a Genome entry : This is the xml . etree . ElementTree at the point of entry fields : A list of additional fields to expand the entry with
"""
    Builds additional field nodes for a Genome

    entry:  This is the xml.etree.ElementTree at the point of entry
    fields: A list of additional fields to expand the entry with

    return: void
    """ # TO DO - Generalize this one by executing a query to fetch additional # fields here # adding entry type # redundant # add popular species if any
entry
fields