@@ -667,13 +667,6 @@ def plot_interactive(anchor_name, chrom, start_coord, end_coord, step, pancounts
667
667
bin_size = int ((end_coord - start_coord ) / params .max_chr_bins ) + 1
668
668
adjusted_bin_size = int (bin_size / step )
669
669
670
- #bin_counts = index.pancount_to_bins(pancnts, bin_size)
671
- #print(start_coord, end_coord, bin_size)
672
- #print(bin_counts)
673
- print (pancounts )
674
-
675
- print (paircounts )
676
-
677
670
x = pancounts .columns * bin_size
678
671
679
672
t3 = time .perf_counter ()
@@ -756,9 +749,7 @@ def plot_interactive(anchor_name, chrom, start_coord, end_coord, step, pancounts
756
749
fig .update_layout (barmode = 'stack' , bargap = 0.0 )
757
750
fig .update_xaxes (showticklabels = False , row = 3 , col = 1 )
758
751
759
- print (paircounts )
760
- fig .add_trace (go .Heatmap (z = paircounts , x = paircounts .columns , y = paircounts .index ,
761
- ),
752
+ fig .add_trace (go .Heatmap (z = paircounts , x = paircounts .columns , y = paircounts .index , coloraxis = "coloraxis" ),
762
753
row = 4 , col = 1 )
763
754
764
755
t7 = time .perf_counter ()
@@ -782,7 +773,8 @@ def plot_interactive(anchor_name, chrom, start_coord, end_coord, step, pancounts
782
773
fig .update_yaxes (title_text = "# of k-mers" , range = [0 ,adjusted_bin_size ] , row = 3 , col = 1 )
783
774
784
775
#TODO don't use template, manually set background to white
785
- fig .update_layout (xaxis_range = [start_coord ,end_coord ], font = dict (size = 16 ))
776
+ cax = {"colorscale" :"plasma_r" ,"colorbar" :{"title" :"Pair Cons." ,"y" :0 ,"len" :0.35 ,"yanchor" :"bottom" }}
777
+ fig .update_layout (xaxis_range = [start_coord ,end_coord ], font = dict (size = 16 ),coloraxis = cax )
786
778
787
779
t10 = time .perf_counter ()
788
780
print (f"\t Truly finishing touches { t10 - t9 :0.4f} seconds" )
@@ -1411,7 +1403,7 @@ def chromosome_callback(tab, start_coord, end_coord, chrs, anchor_name):
1411
1403
return update_all_figs (chr_num , chrs , anchor_name , 0 , start_coord , end_coord ,n_skips )
1412
1404
1413
1405
def update_all_figs ( chr_num , chrom , anchor_name , redo_wg , start_coord , end_coord , n_skips ):
1414
- tic = time .perf_counter ()
1406
+ t_start = time .perf_counter ()
1415
1407
1416
1408
sys .stderr .write ("Quering genes 8\n " )
1417
1409
end = index .chrs .loc [anchor_name , chrom ]["size" ]
@@ -1430,19 +1422,24 @@ def update_all_figs( chr_num, chrom, anchor_name, redo_wg, start_coord, end_coor
1430
1422
1431
1423
gene_names = all_genes ["name" ] #[g.split(';')[0].split("=")[1] for g in genes['attr']]
1432
1424
1433
- toc_tmp = time .perf_counter ()
1434
- print (f"All_genes in { toc_tmp - tic :0.4f} seconds" )
1425
+ t1 = time .perf_counter ()
1426
+ print (f"All_genes in { t1 - t_start :0.4f} seconds" )
1427
+ t0 = t1
1435
1428
if get_buffer (start_coord , end_coord , index .lowres_step ) == 1 :
1436
1429
n_skips = 1
1437
1430
1438
1431
bitmap = index .query_bitmap (anchor_name , chrom , start_coord , end_coord , n_skips )
1439
- bitmap_counts = index .bitmap_to_pancount (bitmap ) #pd.Series(bitmap.to_numpy().sum(axis=1),index=bitmap.index)
1432
+
1433
+ t1 = time .perf_counter ()
1434
+ print (f"query bitmap { t1 - t0 :0.4f} seconds" )
1435
+ t0 = t1
1440
1436
1441
1437
bin_size = ((end_coord - start_coord ) // params .max_chr_bins ) + 1
1442
1438
pan , pair = index .bitmap_to_bins (bitmap , bin_size )
1443
1439
1444
- toc_tmp_1 = time .perf_counter ()
1445
- print (f"query bitmap { toc_tmp_1 - toc_tmp :0.4f} seconds" )
1440
+ t1 = time .perf_counter ()
1441
+ print (f"transform bitmap { t1 - t0 :0.4f} seconds" )
1442
+ toc_tmp_1 = t1
1446
1443
1447
1444
fig1 = plot_interactive (
1448
1445
anchor_name , chrom , start_coord , end_coord , n_skips ,
@@ -1469,7 +1466,7 @@ def update_all_figs( chr_num, chrom, anchor_name, redo_wg, start_coord, end_coor
1469
1466
toc_tmp_32 = time .perf_counter ()
1470
1467
print (f"chr fig in { toc_tmp_32 - toc_tmp_31 :0.4f} seconds" )
1471
1468
1472
- bar_sum_regional = bitmap_counts .value_counts ().reindex (index .bitsum_index , fill_value = 0 )
1469
+ bar_sum_regional = pan . sum ( axis = 1 ) # bitmap_counts.value_counts().reindex(index.bitsum_index, fill_value=0)
1473
1470
fig2 = get_local_info (bar_sum_regional , anchor_name , chrom )
1474
1471
toc_tmp_33 = time .perf_counter ()
1475
1472
print (f"fig 2 plot in { toc_tmp_33 - toc_tmp_32 :0.4f} seconds" )
@@ -1510,7 +1507,7 @@ def update_all_figs( chr_num, chrom, anchor_name, redo_wg, start_coord, end_coor
1510
1507
print (f"plots sorted in { toc_tmp_11 - toc_tmp_10 :0.4f} seconds" )
1511
1508
1512
1509
toc = time .perf_counter ()
1513
- print (f"Update all in { toc - tic :0.4f} seconds" )
1510
+ print (f"Update all in { toc - t_start :0.4f} seconds" )
1514
1511
return (
1515
1512
chr_fig ,
1516
1513
fig1 , fig2 , fig3 , fig4 ,
0 commit comments