@@ -51,8 +51,8 @@ def compute_gene_diagnostic_info(config: DiagnosisConfig):
51
51
mk_score = mk_score .loc [trait_ldsc_result .index ]
52
52
53
53
# Filter out genes with no variation
54
- non_zero_std_cols = mk_score .columns [ mk_score .std () > 0 ]
55
- mk_score = mk_score .loc [:, non_zero_std_cols ]
54
+ has_variation = ( ~ mk_score .eq ( mk_score .iloc [ 0 ], axis = 1 )). any ()
55
+ mk_score = mk_score .loc [:, has_variation ]
56
56
57
57
logger .info ("Calculating correlation between gene marker scores and trait logp-values..." )
58
58
corr = mk_score .corrwith (trait_ldsc_result ["logp" ])
@@ -69,10 +69,6 @@ def compute_gene_diagnostic_info(config: DiagnosisConfig):
69
69
}
70
70
)
71
71
72
- # Filter based on median GSS score
73
- high_GSS_Gene_annotation_pair = high_GSS_Gene_annotation_pair [
74
- high_GSS_Gene_annotation_pair ["Median_GSS" ] >= 1.0
75
- ]
76
72
high_GSS_Gene_annotation_pair = high_GSS_Gene_annotation_pair .merge (
77
73
corr , left_on = "Gene" , right_index = True
78
74
)
@@ -161,6 +157,20 @@ def generate_manhattan_plot(config: DiagnosisConfig):
161
157
+ gwas_data_to_plot ["Annotation" ].astype (str )
162
158
)
163
159
160
+ # Verify data integrity
161
+ if gwas_data_with_gene_annotation_sort .empty :
162
+ logger .error ("Filtered GWAS data is empty, cannot create Manhattan plot" )
163
+ return
164
+
165
+ if len (gwas_data_to_plot ) == 0 :
166
+ logger .error ("No SNPs passed filtering criteria for Manhattan plot" )
167
+ return
168
+
169
+ # Log some diagnostic information
170
+ logger .info (f"Creating Manhattan plot with { len (gwas_data_to_plot )} SNPs" )
171
+ logger .info (f"Columns available: { list (gwas_data_to_plot .columns )} " )
172
+ logger .info (f"Chromosome column values: { gwas_data_to_plot ['CHR' ].unique ()} " )
173
+
164
174
fig = ManhattanPlot (
165
175
dataframe = gwas_data_to_plot ,
166
176
title = "gsMap Diagnosis Manhattan Plot" ,
0 commit comments