pdb_mapping/pdb_families.py
def list_new_families():
    """
    List new families with 3D structures
    """
    conn = RfamDB.connect()
    cursor = conn.cursor()
    new_families_query = ("SELECT DISTINCT rfam_acc, pdb_id "
                          "FROM pdb_full_region "
                          "WHERE is_significant = 1 "
                          "AND rfam_acc NOT IN "
                          "(SELECT DISTINCT rfam_acc FROM pdb_full_region_old WHERE is_significant = 1);")
    try:
        pdb_txt = "pdb_mapping/pdb_families.txt"
        with open(pdb_txt, "w") as pdb_file:
            cursor.execute("select count(distinct rfam_acc) from `pdb_full_region_old` where is_significant = 1;")
            pdb_file.write("Number of families with 3D before: {0} \n".format(cursor.fetchone()[0]))
            cursor.execute("select count(distinct rfam_acc) from `pdb_full_region` where is_significant = 1; ")
            pdb_file.write("Number of families with 3D after: {0} \n".format(cursor.fetchone()[0]))
            cursor.execute(new_families_query)
            new_families = cursor.fetchall()
            if new_families:
                for entry in new_families:
                    rf_num = entry[0]
                    pd_id = entry[1]
                    pdb_file.write("\nRfam accession number: {0}   PDB ID: {1}".
                                format(rfam_search_url.format(rf_num), pdb_search_url.format(pd_id)))
            else:
                pdb_file.write("There are no new families.")

    except mysql.connector.Error as e:
        logging.debug("MySQL error has occurred: {0}".format(e))
        raise e
    except Exception as e:
        raise e

    finally:
        cursor.close()
        conn.close()

    List new families with 3D structures
    
List new families with 3D structures
List new families with 3D structures
def list_new_families():
    conn = RfamDB.connect()
    cursor = conn.cursor()
    new_families_query = ("SELECT DISTINCT rfam_acc, pdb_id "
                          "FROM pdb_full_region "
                          "WHERE is_significant = 1 "
                          "AND rfam_acc NOT IN "
                          "(SELECT DISTINCT rfam_acc FROM pdb_full_region_old WHERE is_significant = 1);")
    try:
        pdb_txt = "pdb_mapping/pdb_families.txt"
        with open(pdb_txt, "w") as pdb_file:
            cursor.execute("select count(distinct rfam_acc) from `pdb_full_region_old` where is_significant = 1;")
            pdb_file.write("Number of families with 3D before: {0} \n".format(cursor.fetchone()[0]))
            cursor.execute("select count(distinct rfam_acc) from `pdb_full_region` where is_significant = 1; ")
            pdb_file.write("Number of families with 3D after: {0} \n".format(cursor.fetchone()[0]))
            cursor.execute(new_families_query)
            new_families = cursor.fetchall()
            if new_families:
                for entry in new_families:
                    rf_num = entry[0]
                    pd_id = entry[1]
                    pdb_file.write("\nRfam accession number: {0}   PDB ID: {1}".
                                format(rfam_search_url.format(rf_num), pdb_search_url.format(pd_id)))
            else:
                pdb_file.write("There are no new families.")
    except mysql.connector.Error as e:
        logging.debug("MySQL error has occurred: {0}".format(e))
        raise e
    except Exception as e:
        raise e
    finally:
        cursor.close()
        conn.close()
def list_new_families ( ) : conn = RfamDB . connect ( ) cursor = conn . cursor ( ) new_families_query = ( "SELECT DISTINCT rfam_acc, pdb_id " "FROM pdb_full_region " "WHERE is_significant = 1 " "AND rfam_acc NOT IN " "(SELECT DISTINCT rfam_acc FROM pdb_full_region_old WHERE is_significant = 1);" ) try : pdb_txt = "pdb_mapping/pdb_families.txt" with open ( pdb_txt , "w" ) as pdb_file : cursor . execute ( "select count(distinct rfam_acc) from `pdb_full_region_old` where is_significant = 1;" ) pdb_file . write ( "Number of families with 3D before: {0} \n" . format ( cursor . fetchone ( ) [ 0 ] ) ) cursor . execute ( "select count(distinct rfam_acc) from `pdb_full_region` where is_significant = 1; " ) pdb_file . write ( "Number of families with 3D after: {0} \n" . format ( cursor . fetchone ( ) [ 0 ] ) ) cursor . execute ( new_families_query ) new_families = cursor . fetchall ( ) if new_families : for entry in new_families : rf_num = entry [ 0 ] pd_id = entry [ 1 ] pdb_file . write ( "\nRfam accession number: {0}   PDB ID: {1}" . format ( rfam_search_url . format ( rf_num ) , pdb_search_url . format ( pd_id ) ) ) else : pdb_file . write ( "There are no new families." ) except mysql . connector . Error as e : logging . debug ( "MySQL error has occurred: {0}" . format ( e ) ) raise e except Exception as e : raise e finally : cursor . close ( ) conn . close ( )
List new families with 3D structures
List new families with 3D structures
"""
    List new families with 3D structures
    """