mehrnoushmalek / flowDensity

Automated gating
7 stars 3 forks source link

How is the tinypeak.removal parameter interpreted in deGate() and is there a recommended upper limit? #7

Closed saheedb closed 1 year ago

saheedb commented 2 years ago

deGate() works fantastically well most of the time, but there are instances where it fails, and I'm wondering what I can do to improve it. Here are some examples where it doesn't gate where expected:

deGate_missed

And this is how I'm using deGate(): deGate(ff, chan, count.lim = 100, tinypeak.removal = 0.25)

I have been incrementing tinypeak.removal to see if that helps, but considering that the default value is quite low (1/25), is there an upper limit I should avoid reaching which may introduce other unpredictable behavior? Is this the most useful parameter to play with in order to improve the gating? Or do I just need cleaner data to begin with? Thank you

mehrnoushmalek commented 2 years ago

Hi Saheed, tinypeak.removalis a value between 0 to 1, so when it's 1 deGate would ignore all peaks other than the largest one, and therefore tried to find a threshold based on upper or inflection point. The smaller it gets , the more sensitive it is to peaks. There's also an argument called adjust.dens that's same as the adjust argument in density() function, which makes the curve smoother. Looking at your data, I can see that the left peak is not always present in the data, and it shows up as a shoulder in some cases (plot 1&4 for example), so you may benefit from adding the upper=F, alpha=0.1 in deGate for those cases. You can play around with alpha to make the threshold closer or farther away from the main peak

saheedb commented 1 year ago

Thank you for clarifying.