utils/db_utils.py
def fetch_family_full_regions(rfam_acc, sort=True):
    """
    Fetches family regions from full_region table
    :param rfam_acc:

    :return: A dictionary with all FULL regions per accession belonging to a specific
    family
    """

    query = """select rfamseq_acc, seq_start, seq_end
        from full_region
        where rfam_acc=\'%s\'
        and is_significant=1
        and type=\'full\'"""

    cnx = RfamDB.connect()
    cursor = cnx.cursor(dictionary=True)

    cursor.execute(query % rfam_acc)

    regions = {}

    for region in cursor.fetchall():
        if region["rfamseq_acc"] not in regions:
            regions[region["rfamseq_acc"]] = [(int(region["seq_start"]), int(region["seq_end"]))]
        else:
            regions[region["rfamseq_acc"]].append((int(region["seq_start"]), int(region["seq_end"])))

    cursor.close()
    cnx.close()

    if sort is True:
        for accession in regions:
            # sorts hits by start points
            regions[accession].sort(key=lambda tup: tup[1])

    return regions

    Fetches family regions from full_region table
    :param rfam_acc:

    :return: A dictionary with all FULL regions per accession belonging to a specific
    family
    
Fetches family regions from full_region table
Fetches family regions from full_region table
def fetch_family_full_regions(rfam_acc, sort=True):
    query = """select rfamseq_acc, seq_start, seq_end
        from full_region
        where rfam_acc=\'%s\'
        and is_significant=1
        and type=\'full\'"""
    cnx = RfamDB.connect()
    cursor = cnx.cursor(dictionary=True)
    cursor.execute(query % rfam_acc)
    regions = {}
    for region in cursor.fetchall():
        if region["rfamseq_acc"] not in regions:
            regions[region["rfamseq_acc"]] = [(int(region["seq_start"]), int(region["seq_end"]))]
        else:
            regions[region["rfamseq_acc"]].append((int(region["seq_start"]), int(region["seq_end"])))
    cursor.close()
    cnx.close()
    if sort is True:
        for accession in regions:
            regions[accession].sort(key=lambda tup: tup[1])
    return regions
def fetch_family_full_regions ( rfam_acc , sort = True ) : query = """select rfamseq_acc, seq_start, seq_end
        from full_region
        where rfam_acc=\'%s\'
        and is_significant=1
        and type=\'full\'""" cnx = RfamDB . connect ( ) cursor = cnx . cursor ( dictionary = True ) cursor . execute ( query % rfam_acc ) regions = { } for region in cursor . fetchall ( ) : if region [ "rfamseq_acc" ] not in regions : regions [ region [ "rfamseq_acc" ] ] = [ ( int ( region [ "seq_start" ] ) , int ( region [ "seq_end" ] ) ) ] else : regions [ region [ "rfamseq_acc" ] ] . append ( ( int ( region [ "seq_start" ] ) , int ( region [ "seq_end" ] ) ) ) cursor . close ( ) cnx . close ( ) if sort is True : for accession in regions : regions [ accession ] . sort ( key = lambda tup : tup [ 1 ] ) return regions
Fetches family regions from full_region table
Fetches family regions from full_region table
"""
    Fetches family regions from full_region table
    :param rfam_acc:

    :return: A dictionary with all FULL regions per accession belonging to a specific
    family
    """ # sorts hits by start points
A dictionary with all FULL regions per accession belonging to a specific
family
A dictionary with all FULL regions per accession belonging to a specific family
rfam_acc
None
sort