r=sql_ask_database(conn,f"SELECT structure_id, '_1_', chain_name, '_', CAST(pdb_start AS TEXT), '-', CAST(pdb_end AS TEXT) FROM chain WHERE rfam_acc='{f}';")
filelist=sorted([''.join(list(x))+'.cif'forxinr])
r=sql_ask_database(conn,f"SELECT cm_coord FROM align_column WHERE rfam_acc = '{f}' AND index_ali > 0 ORDER BY index_ali ASC;")
cm_coords=[x[0]forxinr]
cm_coords=[x[0]forxinr]# len(cm_coords) is the number of saved columns. There are many None values in the list.
i=len(cm_coords)-1
whilecm_coords[i]isNone:
ifi==0:
# Issue somewhere. Abort.
warn(f"{f} has no mapping to CM. Ignoring distance matrix.")
ifnotmultithread:
idxQueue.put(thr_idx)# replace the thread index in the queue