Commit 88623070 authored by Blaise Li's avatar Blaise Li
Browse files

Avoid error when not enough data in log10.

parent 7f6056dc
......@@ -1276,8 +1276,14 @@ rule compare_replicates:
(r_val, p_val) = pearsonr(data[rep_a], data[rep_b])
corr_file.write(f"{rep_a}{warn_a}_vs_{rep_b}{warn_b}\t{r_val} ({p_val})\n")
filtered = log_data[[rep_a, rep_b]].dropna()
(log_r_val, log_p_val) = pearsonr(filtered[rep_a], filtered[rep_b])
corr_file.write(f"log10_{rep_a}{warn_a}_vs_log10_{rep_b}{warn_b}\t{log_r_val} ({log_p_val})\n")
try:
(log_r_val, log_p_val) = pearsonr(filtered[rep_a], filtered[rep_b])
corr_file.write(f"log10_{rep_a}{warn_a}_vs_log10_{rep_b}{warn_b}\t{log_r_val} ({log_p_val})\n")
except ValueError as err:
if str(err) == "x and y must have length at least 2.":
corr_file.write(f"Only {len(filtered)} points in log10 data.\n")
else:
raise
corr_file.write("(*): not normal\n(**): log10 not normal\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment