AdmiralenOla / Scoary

Pan-genome wide association studies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for non-binary traits

MrTomRod opened this issue · comments

Dear @AdmiralenOla

Under Coming soon, you list Support for non-binary traits.

This could be of interest to me. What approach are you thinking of? (Simply binarizing continuous traits?) What use case would it answer?

Btw, since you have probably moved on to other things, I am considering adding this feature to your code myself. Would this be okay with you?

Best, MrTomRod

Dear @MrTomRod

Yes, I've been wanting to add that feature for five years now. I'm not sure about the best way to implement it though, since much of the Scoary functionality is so intimately tied to having binary categories. Some of the approaches I've given some thought:

  • Breaking continous traits up into quantiles and treating these as binary, then using permutations to get "null distribution" test estimators.
  • Phylogenetic GLS. (A bit hard to harmonize with the Scoary approach since it would likely involve some kind of dimensionality reduction algorithm for the tree structure and an explicit evolutionary model.)
  • Replicated simulations of the continous phenotype on the input tree with no respect to the genotype, again to create a null distribution to compare towards. Maybe this would also require an explicit evolutionary model. My impression is that an Ornstein-Uhlenbeck process would be the best alternative, although there might be better alternatives I'm not up to speed with.

As you've noticed Scoary is not exactly in very active development at the moment due to other pressing obligations, but I maintain the ambition to continue development on it. I will happily accept PRs or spin-offs as long as you credit the original work. Thanks for offering!

All the best,
Ola

I have been using GaussionMixture to split by a continuous trait. This is a histogram of an example trait:

image

  • Blue is group 1
  • Green is group 2
  • Grey are those where the classifier was less than 85 % confident about which group the strain belongs to.

(has / has_not indicate whether a strain has the highest-scoring orthogene. Sorry for not plotting the estimated Gaussian distributions.)

My approach is simple and straightforward, but maybe not too powerful. I need something to quickly work on thousands of continuous traits.

I'm not sure if I fully understand your suggestions, will have to think about that some more. Would you be willing to discuss this sometimes or perhaps even support me a little if I decided to do this?

Btw, I've been using Boschloo's test instead of Fisher's, since it is perfectly matches the problem and is more powerful. It is slower, though. Not sure if it's worth it.

That looks promising! And thanks for teaching me about Boschloo's test.

Absolutely willing to work with you on this in the time I can contribute. You can get in contact with me at any time through my e-mail: olbb@fhi.no.

I wanted to compare Fisher's vs Boschloo's test. To do this, I simulated 10 pangenomes for each combination of sample size: [25, 50, 75, 100, 150, 200] and penetrance: [90, 75]. (As in the paper.) While the p-values from Boschloo's test are uniformly higher, the sensitivity decreased! These are the results:

fisher-boschloo-fig1

Each dot represents the results from one simulated pangenome. The x-axis is the rank of the 'causal' gene in the final table computed using Fisher's minus the rank computed using Boschloo's. In other words, if the resulting value is negative, Fisher's performed better, and if it is positive, Boschloo's performed better.

I performed a Wilcoxon signed-rank test to see if Fisher and Boschloo perform differently: pvalue=0.057.

While Boschloo's test (imo justifiedly) gives a lower p-value, Fisher's seems to perform better at ranking genes with the simulated data. I have no clue why that is, though.

Updated plot with improved ranking, based on pvalue instead of position in table. Didn't change the result.

fisher-boschloo-fig1

pvalue=0.0024

I performed the same analysis with my fast-fisher library. It is now incredibly fast.

The causal gene always got the same rank as with scipy's implementation, except for two simulated datasets: in one, the rank was one higher, in the other, it was one lower.

image

Heya,
Any chance this feature will come soon? I'ts exactly what I have been looking for and would perfectly fit into my workflow. I'm also happy to test.

Best wishes,
Tse

You want to run Scoary on continuous traits?

I'm working on an update for Scoary, but it's not ready yet. Approximately another month until testing makes sense.

I will use GaussianMixture for splitting.

You could simply pre-process your continuous traits with GaussianMixture yourself and then feed them into Scoary.

I think @MrTomRod did the necessary updates and put it as Scoary-2. Kindly check his GitHub repo