1919log = logging .getLogger ("multiqc" )
2020
2121
22-
2322def xenium_extra_execution_start ():
2423 """Code to execute after config files and command line flags have been parsed.
2524
@@ -35,34 +34,13 @@ def xenium_extra_execution_start():
3534 # Note: shared=True allows multiple modules to access these files
3635 # Note: We don't check contents since these are binary files
3736 if "xenium/transcripts" not in config .sp :
38- config .update_dict (
39- config .sp ,
40- {
41- "xenium/transcripts" : {
42- "fn" : "transcripts.parquet"
43- }
44- }
45- )
37+ config .update_dict (config .sp , {"xenium/transcripts" : {"fn" : "transcripts.parquet" }})
4638
4739 if "xenium/cells" not in config .sp :
48- config .update_dict (
49- config .sp ,
50- {
51- "xenium/cells" : {
52- "fn" : "cells.parquet"
53- }
54- }
55- )
40+ config .update_dict (config .sp , {"xenium/cells" : {"fn" : "cells.parquet" }})
5641
5742 if "xenium/cell_feature_matrix" not in config .sp :
58- config .update_dict (
59- config .sp ,
60- {
61- "xenium/cell_feature_matrix" : {
62- "fn" : "cell_feature_matrix.h5"
63- }
64- }
65- )
43+ config .update_dict (config .sp , {"xenium/cell_feature_matrix" : {"fn" : "cell_feature_matrix.h5" }})
6644
6745 # Increase file size limit to handle large Xenium files (if not already set by user)
6846 # Default is 50MB, Xenium files can be several GB
@@ -171,7 +149,6 @@ def extend_xenium_module(xenium_module):
171149 # Core module already adds: num_transcripts, num_cells_detected, fraction_transcripts_assigned, median_genes_per_cell
172150 # Plugin adds: fraction_transcripts_decoded_q20, cell_area_median, nucleus_area_median, nucleus_to_cell_area_ratio_median
173151 if cells_data_by_sample or transcript_data_by_sample :
174-
175152 # Add Q20+ transcripts metric if available
176153 if any ("fraction_transcripts_decoded_q20" in data for data in xenium_module .data_by_sample .values ()):
177154 xenium_module .genstat_headers ["fraction_transcripts_decoded_q20" ] = ColumnDict (
@@ -798,9 +775,7 @@ def parse_cells_parquet(f) -> Optional[Dict]:
798775 # Nucleus to cell area ratio (only for non-null values)
799776 ratio_stats = (
800777 lazy_df .filter (
801- (pl .col ("cell_area" ).is_not_null ())
802- & (pl .col ("nucleus_area" ).is_not_null ())
803- & (pl .col ("cell_area" ) > 0 )
778+ (pl .col ("cell_area" ).is_not_null ()) & (pl .col ("nucleus_area" ).is_not_null ()) & (pl .col ("cell_area" ) > 0 )
804779 )
805780 .with_columns ((pl .col ("nucleus_area" ) / pl .col ("cell_area" )).alias ("ratio" ))
806781 .select (
@@ -1355,9 +1330,7 @@ def xenium_transcripts_per_gene_plot(transcript_data_by_sample):
13551330 sample_data = transcript_data_by_sample [s_name ]
13561331 # Create single-item threshold dict for consistency
13571332 single_sample_thresholds = {s_name : n_mols_threshold }
1358- return _create_single_sample_molecules_plot (
1359- sample_data , bins , bin_centers , single_sample_thresholds , s_name
1360- )
1333+ return _create_single_sample_molecules_plot (sample_data , bins , bin_centers , single_sample_thresholds , s_name )
13611334 else :
13621335 # Multi-sample with per-sample thresholds
13631336 return _create_multi_sample_molecules_plot (
@@ -1705,7 +1678,6 @@ def _create_single_sample_combined_density(samples_with_transcript_counts, sampl
17051678 raw_transcript_values = transcript_values
17061679 transcript_values = np .array (transcript_values )
17071680
1708-
17091681 kde = stats .gaussian_kde (transcript_values )
17101682 x_min , x_max = transcript_values .min (), transcript_values .max ()
17111683 x_range = np .linspace (x_min , x_max , 1000 )
@@ -1744,7 +1716,6 @@ def _create_single_sample_combined_density(samples_with_transcript_counts, sampl
17441716 genes_data [float (x )] = float (y )
17451717 plot_data ["Detected genes per cell" ] = genes_data
17461718
1747-
17481719 if not plot_data :
17491720 return None
17501721
@@ -1830,9 +1801,7 @@ def _create_single_sample_area_density(cell_data):
18301801
18311802 # Skip density plots if only pre-calculated statistics are available
18321803 if "cell_area_values" not in cell_data :
1833- log .info (
1834- "Skipping cell area density plot - using pre-calculated statistics. Density plots require raw data."
1835- )
1804+ log .info ("Skipping cell area density plot - using pre-calculated statistics. Density plots require raw data." )
18361805 return None
18371806
18381807 cell_areas = cell_data ["cell_area_values" ]
0 commit comments