scripts/export/rfam_xml_dumper.py
def full_region_xml_builder(entries, upid):
    """
    Export full region entries for a genome.

    entries:    Entries node on xml tree
    upid:  Genome identifier.
    """

    tax_id_duplicates = {'562': 1, '1280': 1, '7209': 1, '10679': 1, '10717': 1,
                         '11021': 1, '11036': 1, '11072': 1, '11082': 1, '11228': 1,
                         '11636': 1, '11963': 1, '31649': 1, '84589': 1, '90370': 1,
                         '93838': 1, '186617': 1, '229533': 1, '351048': 1,
                         '456327': 1, '766192': 1, '1891747': 1}
    genome = None
    chromosomes = []
    if upid[0:2] == 'UP':
        genome = Genome.objects.select_related('ncbi').get(upid=upid)
        chromosomes = get_chromosome_metadata()

    rnacentral_ids = get_rnacentral_mapping(upid=upid)
    cnx = RfamDB.connect()
    cursor = cnx.cursor(dictionary=True, buffered=True)

    # work on 'full' refions
    cursor.execute(rs.FULL_REGION_FIELDS % upid)
    for row in result_iterator(cursor):
        format_full_region(entries, row, genome, chromosomes, rnacentral_ids)

    # work on 'seed' regions if not already exported
    # cursor.execute(rs.FULL_REGION_SEEDS % upid)

    """
    # if one of the cases of duplicates, work with the flags
    if genome.ncbi_id in tax_id_duplicates:
        if tax_id_duplicates[genome.ncbi_id] == 1:
            for row in result_iterator(cursor):
                format_full_region(entries, row, genome, chromosomes, rnacentral_ids)
            # set flag to 0 to disable export
            tax_id_duplicates[genome.ncbi_id] = 0
    """
    # capture the rest of the cases
    # else:
    cursor.execute(rs.FULL_REGION_SEEDS % upid)
    for row in result_iterator(cursor):
        format_full_region(entries, row, genome, chromosomes, rnacentral_ids)

    cursor.close()
    cnx.disconnect()

    Export full region entries for a genome.

    entries:    Entries node on xml tree
    upid:  Genome identifier.
    
Export full region entries for a genome.
entries:    Entries node on xml tree
upid:  Genome identifier.
Export full region entries for a genome . entries : Entries node on xml tree upid : Genome identifier .
def full_region_xml_builder(entries, upid):
    tax_id_duplicates = {'562': 1, '1280': 1, '7209': 1, '10679': 1, '10717': 1,
                         '11021': 1, '11036': 1, '11072': 1, '11082': 1, '11228': 1,
                         '11636': 1, '11963': 1, '31649': 1, '84589': 1, '90370': 1,
                         '93838': 1, '186617': 1, '229533': 1, '351048': 1,
                         '456327': 1, '766192': 1, '1891747': 1}
    genome = None
    chromosomes = []
    if upid[0:2] == 'UP':
        genome = Genome.objects.select_related('ncbi').get(upid=upid)
        chromosomes = get_chromosome_metadata()
    rnacentral_ids = get_rnacentral_mapping(upid=upid)
    cnx = RfamDB.connect()
    cursor = cnx.cursor(dictionary=True, buffered=True)
    cursor.execute(rs.FULL_REGION_FIELDS % upid)
    for row in result_iterator(cursor):
        format_full_region(entries, row, genome, chromosomes, rnacentral_ids)
    cursor.execute(rs.FULL_REGION_SEEDS % upid)
    for row in result_iterator(cursor):
        format_full_region(entries, row, genome, chromosomes, rnacentral_ids)
    cursor.close()
    cnx.disconnect()
def full_region_xml_builder ( entries , upid ) : tax_id_duplicates = { '562' : 1 , '1280' : 1 , '7209' : 1 , '10679' : 1 , '10717' : 1 , '11021' : 1 , '11036' : 1 , '11072' : 1 , '11082' : 1 , '11228' : 1 , '11636' : 1 , '11963' : 1 , '31649' : 1 , '84589' : 1 , '90370' : 1 , '93838' : 1 , '186617' : 1 , '229533' : 1 , '351048' : 1 , '456327' : 1 , '766192' : 1 , '1891747' : 1 } genome = None chromosomes = [ ] if upid [ 0 : 2 ] == 'UP' : genome = Genome . objects . select_related ( 'ncbi' ) . get ( upid = upid ) chromosomes = get_chromosome_metadata ( ) rnacentral_ids = get_rnacentral_mapping ( upid = upid ) cnx = RfamDB . connect ( ) cursor = cnx . cursor ( dictionary = True , buffered = True ) cursor . execute ( rs . FULL_REGION_FIELDS % upid ) for row in result_iterator ( cursor ) : format_full_region ( entries , row , genome , chromosomes , rnacentral_ids ) """
    # if one of the cases of duplicates, work with the flags
    if genome.ncbi_id in tax_id_duplicates:
        if tax_id_duplicates[genome.ncbi_id] == 1:
            for row in result_iterator(cursor):
                format_full_region(entries, row, genome, chromosomes, rnacentral_ids)
            # set flag to 0 to disable export
            tax_id_duplicates[genome.ncbi_id] = 0
    """ cursor . execute ( rs . FULL_REGION_SEEDS % upid ) for row in result_iterator ( cursor ) : format_full_region ( entries , row , genome , chromosomes , rnacentral_ids ) cursor . close ( ) cnx . disconnect ( )
Export full region entries for a genome.
Export full region entries for a genome .
"""
    Export full region entries for a genome.

    entries:    Entries node on xml tree
    upid:  Genome identifier.
    """ # work on 'full' refions # work on 'seed' regions if not already exported # cursor.execute(rs.FULL_REGION_SEEDS % upid) """
    # if one of the cases of duplicates, work with the flags
    if genome.ncbi_id in tax_id_duplicates:
        if tax_id_duplicates[genome.ncbi_id] == 1:
            for row in result_iterator(cursor):
                format_full_region(entries, row, genome, chromosomes, rnacentral_ids)
            # set flag to 0 to disable export
            tax_id_duplicates[genome.ncbi_id] = 0
    """ # capture the rest of the cases # else:
entries
upid