bigbio / pmultiqc

A library for QC report based on MultiQC framework
GNU General Public License v3.0
13 stars 8 forks source link

Refactor binning #47

Closed jpfeuffer closed 2 years ago

jpfeuffer commented 2 years ago

there should be better and shorter ways to bin data than doing n if cases: https://github.com/bigbio/pmultiqc/blob/main/pmultiqc/modules/quantms/quantms.py#L1088-L1104

In this case even very simple: Why not use integer keys?

charge_state = charge_state if charge_state < len(self.charge_state_distribution['Whole Experiment']) else len(self.charge_state_distribution['Whole Experiment'])
self.charge_state_distribution['Whole Experiment'][charge_state] += 1

But even for the ranges (e.g. 100-200) you can do a Histogram class or something like that.

ypriverol commented 2 years ago

@daichengxin I was talking with @WangHong007, and he will be happy to help with small issues of pmultiqc.