@@ -302,7 +302,7 @@ def check_cell_type(row, cluster_id, clustering_merge_data):
302302 low_threshold = clustering_merge_data ['scores' ][cluster_id ]['q25' ]
303303 final_score = 0
304304 num_rules = 1
305- while not pd .isnull (row ['marker' + str (num_rules )]):
305+ while ( 'marker' + str ( num_rules )) in row and not pd .isnull (row ['marker' + str (num_rules )]):
306306 curr_marker = row ['marker' + str (num_rules )]
307307 curr_rule = row ['rule' + str (num_rules )]
308308 num_rules = num_rules + 1
@@ -534,6 +534,8 @@ def clustering(df_norm, markers):
534534 kmeans_cluster = KMeans (n_clusters = k_clusters , random_state = 0 ).fit (adata .obsm ['X_pca' ])
535535 adata .obs ['kmeans' ] = kmeans_cluster .labels_ .astype (str )
536536
537+ print (">>> Kmeans cluster calculated =" , datetime .datetime .now ().strftime ("%d/%m/%Y %H:%M:%S" ), flush = True )
538+
537539 #We print the complete kmeans cluster and all related information
538540 calculate_cluster_info (adata , "kmeans" )
539541
@@ -543,7 +545,6 @@ def clustering(df_norm, markers):
543545 calculate_cluster_info (adata , "kmeans_ref" )
544546 except Exception as e :
545547 print (">>> Failed at refining kmeans cluster =" , datetime .datetime .now ().strftime ("%d/%m/%Y %H:%M:%S" ), flush = True )
546- print (e ,flush = True )
547548
548549 if (leiden == 'yes' or kmeans == 'yes' ):
549550 df = pd .read_csv (data_folder + '/analysis/cell_data.csv' )
0 commit comments