utils/db_utils.py
def update_assembly_names(upid_gca_file):
    """
    Loads the upid_gca json files and parses the corresponding assembly xml files
    from ENA to fetch the assembly names and update the fields in genome table

    param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }

    return: void
    """

    fp = open(upid_gca_file, 'r')
    acc_pairs = json.load(fp)
    fp.close()

    # a list of tuples to
    assembly_names = []

    for upid in acc_pairs.keys():
        data = fgm.fetch_gca_data(upid, acc_pairs[upid]["GCA"], acc_pairs[upid]["DOM"])

        if "fields" in data:
            if data["fields"]["assembly_name"] is not None:
                assembly_names.append((data["fields"]["assembly_name"], upid))

    # connect to db
    cnx = RfamDB.connect()

    # get a new buffered cursor
    cursor = cnx.cursor(buffered=True, dictionary=True)

    query = "update genome set assembly_name=%s where upid=%s"

    cursor.executemany(query, assembly_names)
    cnx.commit()

    cursor.close()
    RfamDB.disconnect(cnx)

    Loads the upid_gca json files and parses the corresponding assembly xml files
    from ENA to fetch the assembly names and update the fields in genome table

    param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }

    return: void
    
Loads the upid_gca json files and parses the corresponding assembly xml files
from ENA to fetch the assembly names and update the fields in genome table

param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }

void
Loads the upid_gca json files and parses the corresponding assembly xml files from ENA to fetch the assembly names and update the fields in genome table param upid_gca_file : A json file with upid : { " GCA " : GCAxxx " DOM " : domain } void
def update_assembly_names(upid_gca_file):
    fp = open(upid_gca_file, 'r')
    acc_pairs = json.load(fp)
    fp.close()
    assembly_names = []
    for upid in acc_pairs.keys():
        data = fgm.fetch_gca_data(upid, acc_pairs[upid]["GCA"], acc_pairs[upid]["DOM"])
        if "fields" in data:
            if data["fields"]["assembly_name"] is not None:
                assembly_names.append((data["fields"]["assembly_name"], upid))
    cnx = RfamDB.connect()
    cursor = cnx.cursor(buffered=True, dictionary=True)
    query = "update genome set assembly_name=%s where upid=%s"
    cursor.executemany(query, assembly_names)
    cnx.commit()
    cursor.close()
    RfamDB.disconnect(cnx)
def update_assembly_names ( upid_gca_file ) : fp = open ( upid_gca_file , 'r' ) acc_pairs = json . load ( fp ) fp . close ( ) assembly_names = [ ] for upid in acc_pairs . keys ( ) : data = fgm . fetch_gca_data ( upid , acc_pairs [ upid ] [ "GCA" ] , acc_pairs [ upid ] [ "DOM" ] ) if "fields" in data : if data [ "fields" ] [ "assembly_name" ] is not None : assembly_names . append ( ( data [ "fields" ] [ "assembly_name" ] , upid ) ) cnx = RfamDB . connect ( ) cursor = cnx . cursor ( buffered = True , dictionary = True ) query = "update genome set assembly_name=%s where upid=%s" cursor . executemany ( query , assembly_names ) cnx . commit ( ) cursor . close ( ) RfamDB . disconnect ( cnx )
Loads the upid_gca json files and parses the corresponding assembly xml files
from ENA to fetch the assembly names and update the fields in genome table
Loads the upid_gca json files and parses the corresponding assembly xml files from ENA to fetch the assembly names and update the fields in genome table
"""
    Loads the upid_gca json files and parses the corresponding assembly xml files
    from ENA to fetch the assembly names and update the fields in genome table

    param upid_gca_file: A json file with upid: {"GCA" : GCAxxx, "DOM": domain }

    return: void
    """ # a list of tuples to # connect to db # get a new buffered cursor
upid_gca_file