LongQC
LongQC copied to clipboard
ValueError when mode_logn_main is nan
Hi,
In a sample with very few reads, I got the following error in the calc_xome_size
function caused by
https://github.com/yfukasawa/LongQC/blob/d55acc1b9911fe795c4efe9f15eee8c51581cc73/lq_coverage.py#L375
ValueError: cannot convert float NaN to integer
As a quick fix, I added a try/exception statement to use self.mean_main
instead. I wonder if this is a reasobable approach here?
Proposed change:
try:
m_size = int((throughput * (1.0 - self.unmapped_frac_med)) / self.mode_logn_main)
except ValueError:
m_size = int((throughput * (1.0 - self.unmapped_frac_med)) / self.mean_main)
Hi @husensofteng,
Thank you for reporting and your suggestion. Yes, I think it is reasonable and has no issue at all. I didn't expect NaN, but indeed it is possible... Thanks for catching this!
Y.
Hi! is it possible to implement this approach for next version? Thank you in advance!
Hi @eprdz, Thanks for your reminder! yes, absolutely. Y.