scripts/export/rfam_xml_dumper.py
def build_full_region_additional_fields(entry, fields, genome, chromosomes):
    """
    Builds additional field nodes for a the full_region xml dump

    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")

    tax_string = ''
    species = ''
    common_name = ''
    scientific_name = ''
    if genome is not None:
        tax_string = genome.ncbi.tax_string
        species = genome.ncbi_id
        common_name = genome.common_name
        scientific_name = genome.scientific_name
    else:
        tax_string = fields["tax_string"]
        species = fields["ncbi_id"]
        scientific_name = fields["scientific_name"]

    # adding entry type
    ET.SubElement(add_fields, "field", name="entry_type").text = "Sequence"
    ET.SubElement(add_fields, "field", name="rfamseq_acc").text = str(fields["rfamseq_acc"])
    ET.SubElement(add_fields, "field", name="rfamseq_acc_description").text = str(fields["rfamseq_acc_description"])
    ET.SubElement(add_fields, "field", name="seq_start").text = str(fields["seq_start"])
    ET.SubElement(add_fields, "field", name="seq_end").text = str(fields["seq_end"])
    ET.SubElement(add_fields, "field", name="cm_start").text = str(fields["cm_start"])
    ET.SubElement(add_fields, "field", name="cm_end").text = str(fields["cm_end"])

    ET.SubElement(add_fields, "field", name="evalue_score").text = str(fields["evalue_score"])
    ET.SubElement(add_fields, "field", name="bit_score").text = str(fields["bit_score"])
    ET.SubElement(add_fields, "field", name="alignment_type").text = str(fields["alignment_type"])
    ET.SubElement(add_fields, "field", name="truncated").text = str(fields["truncated"])
    # ET.SubElement(add_fields, "field", name="tax_string").text = genome.ncbi.tax_string
    ET.SubElement(add_fields, "field", name="tax_string").text = tax_string

    if fields["rfamseq_acc"] in chromosomes:
        ET.SubElement(add_fields, "field", name="chromosome_name").text = chromosomes[fields["rfamseq_acc"]][
            "chromosome_name"]
        ET.SubElement(add_fields, "field", name="chromosome_type").text = chromosomes[fields["rfamseq_acc"]][
            "chromosome_type"]

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

    # rna types
    rna_types = get_value_list(fields["rna_type"], rs.RNA_TYPE_DEL)

    for rna_type in rna_types:
        ET.SubElement(add_fields, "field", name="rna_type").text = rna_type

    if common_name:
        # ET.SubElement(add_fields, "field", name="common_name").text = genome.common_name
        ET.SubElement(add_fields, "field", name="common_name").text = common_name
    # ET.SubElement(add_fields, "field", name="scientific_name").text = genome.scientific_name
    ET.SubElement(add_fields, "field", name="scientific_name").text = scientific_name

    return add_fields

    Builds additional field nodes for a the full_region xml dump

    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 the full_region xml dump
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 the full_region xml dump 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_full_region_additional_fields(entry, fields, genome, chromosomes):
    add_fields = ET.SubElement(entry, "additional_fields")
    tax_string = ''
    species = ''
    common_name = ''
    scientific_name = ''
    if genome is not None:
        tax_string = genome.ncbi.tax_string
        species = genome.ncbi_id
        common_name = genome.common_name
        scientific_name = genome.scientific_name
    else:
        tax_string = fields["tax_string"]
        species = fields["ncbi_id"]
        scientific_name = fields["scientific_name"]
    ET.SubElement(add_fields, "field", name="entry_type").text = "Sequence"
    ET.SubElement(add_fields, "field", name="rfamseq_acc").text = str(fields["rfamseq_acc"])
    ET.SubElement(add_fields, "field", name="rfamseq_acc_description").text = str(fields["rfamseq_acc_description"])
    ET.SubElement(add_fields, "field", name="seq_start").text = str(fields["seq_start"])
    ET.SubElement(add_fields, "field", name="seq_end").text = str(fields["seq_end"])
    ET.SubElement(add_fields, "field", name="cm_start").text = str(fields["cm_start"])
    ET.SubElement(add_fields, "field", name="cm_end").text = str(fields["cm_end"])
    ET.SubElement(add_fields, "field", name="evalue_score").text = str(fields["evalue_score"])
    ET.SubElement(add_fields, "field", name="bit_score").text = str(fields["bit_score"])
    ET.SubElement(add_fields, "field", name="alignment_type").text = str(fields["alignment_type"])
    ET.SubElement(add_fields, "field", name="truncated").text = str(fields["truncated"])
    ET.SubElement(add_fields, "field", name="tax_string").text = tax_string
    if fields["rfamseq_acc"] in chromosomes:
        ET.SubElement(add_fields, "field", name="chromosome_name").text = chromosomes[fields["rfamseq_acc"]][
            "chromosome_name"]
        ET.SubElement(add_fields, "field", name="chromosome_type").text = chromosomes[fields["rfamseq_acc"]][
            "chromosome_type"]
    if species in rs.POPULAR_SPECIES:
        ET.SubElement(add_fields, "field", name="popular_species").text = species
    rna_types = get_value_list(fields["rna_type"], rs.RNA_TYPE_DEL)
    for rna_type in rna_types:
        ET.SubElement(add_fields, "field", name="rna_type").text = rna_type
    if common_name:
        ET.SubElement(add_fields, "field", name="common_name").text = common_name
    ET.SubElement(add_fields, "field", name="scientific_name").text = scientific_name
    return add_fields
def build_full_region_additional_fields ( entry , fields , genome , chromosomes ) : add_fields = ET . SubElement ( entry , "additional_fields" ) tax_string = '' species = '' common_name = '' scientific_name = '' if genome is not None : tax_string = genome . ncbi . tax_string species = genome . ncbi_id common_name = genome . common_name scientific_name = genome . scientific_name else : tax_string = fields [ "tax_string" ] species = fields [ "ncbi_id" ] scientific_name = fields [ "scientific_name" ] ET . SubElement ( add_fields , "field" , name = "entry_type" ) . text = "Sequence" ET . SubElement ( add_fields , "field" , name = "rfamseq_acc" ) . text = str ( fields [ "rfamseq_acc" ] ) ET . SubElement ( add_fields , "field" , name = "rfamseq_acc_description" ) . text = str ( fields [ "rfamseq_acc_description" ] ) ET . SubElement ( add_fields , "field" , name = "seq_start" ) . text = str ( fields [ "seq_start" ] ) ET . SubElement ( add_fields , "field" , name = "seq_end" ) . text = str ( fields [ "seq_end" ] ) ET . SubElement ( add_fields , "field" , name = "cm_start" ) . text = str ( fields [ "cm_start" ] ) ET . SubElement ( add_fields , "field" , name = "cm_end" ) . text = str ( fields [ "cm_end" ] ) ET . SubElement ( add_fields , "field" , name = "evalue_score" ) . text = str ( fields [ "evalue_score" ] ) ET . SubElement ( add_fields , "field" , name = "bit_score" ) . text = str ( fields [ "bit_score" ] ) ET . SubElement ( add_fields , "field" , name = "alignment_type" ) . text = str ( fields [ "alignment_type" ] ) ET . SubElement ( add_fields , "field" , name = "truncated" ) . text = str ( fields [ "truncated" ] ) ET . SubElement ( add_fields , "field" , name = "tax_string" ) . text = tax_string if fields [ "rfamseq_acc" ] in chromosomes : ET . SubElement ( add_fields , "field" , name = "chromosome_name" ) . text = chromosomes [ fields [ "rfamseq_acc" ] ] [ "chromosome_name" ] ET . SubElement ( add_fields , "field" , name = "chromosome_type" ) . text = chromosomes [ fields [ "rfamseq_acc" ] ] [ "chromosome_type" ] if species in rs . POPULAR_SPECIES : ET . SubElement ( add_fields , "field" , name = "popular_species" ) . text = species rna_types = get_value_list ( fields [ "rna_type" ] , rs . RNA_TYPE_DEL ) for rna_type in rna_types : ET . SubElement ( add_fields , "field" , name = "rna_type" ) . text = rna_type if common_name : ET . SubElement ( add_fields , "field" , name = "common_name" ) . text = common_name ET . SubElement ( add_fields , "field" , name = "scientific_name" ) . text = scientific_name return add_fields
Builds additional field nodes for a the full_region xml dump
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 the full_region xml dump 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 the full_region xml dump

    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 # ET.SubElement(add_fields, "field", name="tax_string").text = genome.ncbi.tax_string # add popular species if any # species = genome.ncbi_id # rna types # ET.SubElement(add_fields, "field", name="common_name").text = genome.common_name # ET.SubElement(add_fields, "field", name="scientific_name").text = genome.scientific_name
entry
fields
genome
chromosomes