broadinstitute / tensorqtl

Ultrafast GPU-enabled QTL mapper
BSD 3-Clause "New" or "Revised" License
162 stars 52 forks source link

error while conducting permutations for cis-eQTL #157

Open Vibha-Acharya opened 1 month ago

Vibha-Acharya commented 1 month ago

Hello tensorqtl team, We are using tensorqtl to conduct eQTL analysis in our datasets and while computing permutations for the cis-eQTL to get empirical values we encountered this error.

tensorqtl/core.py:315: RuntimeWarning: invalid value encountered in sqrt return 2*stats.t.cdf(-np.abs(np.sqrt(tstat2)), dof)

We checked if there are missing in our data, however there are no missing. I was wondering if you could provide some insights into it and how we could avoid the error,

Thank you, Regards, Vibha

francois-a commented 1 month ago

Hi, can you please provide a small example dataset that reproduces this issue?

Vibha-Acharya commented 1 month ago

Sure , here's a representative file :

Chr Start End TargetID AAA AAB AAC AAD

1 11868 11869 ENSG00000290825.1_1 15.30 3.16 1.85 9.71 1 12009 12010 ENSG00000223972.6_6 1.61. 0.32 0.00. 0.00 1 24885 24886 ENSG00000227232.6_6 36.44. 22.06 29.08 24.84 1 622033 622034 ENSG00000188966.11_9 38.83 22.34 27.54 26.84

We used the linux based code and plink2 formatted genotypes,

Thank you so much,

Regards, Vibha

francois-a commented 1 month ago

sorry, can you please provide all the inputs needed to reproduce the error?

Vibha-Acharya commented 1 month ago

Hi francois-a,

I have attached the sample datasets in the zipfile,

I used the command

python3 -m tensorqtl Samples Phenotypechr1.bed Chr1 \ --covariates Covar.txt --maf_threshold 0.01 --window 1000000 --chunk_size 50000 --mode cis --fdr 0.05 --qvalue_lambda 0.85

Tensor_qtl_test.zip

Thank you so much, Vibha

luluzuo-tju commented 1 month ago

I encountered a similar problem today, did you solve it?If you solved it, could you also share your experience?

francois-a commented 1 month ago

Thanks for sharing the example dataset. I'm not able to reproduce the error. Can you try updating to the latest version from this repository (pip install git+https://github.com/broadinstitute/tensorqtl.git), as well as torch?

Vibha-Acharya commented 1 week ago

Hi all, I tried with updated tensor and noticed that the error is now limited to the .out file but not apparent in each chromosome specific log file. I checked the output and the permutation p value is available in all input genes.

Also, I tried different ways to see if the warning can be avoided. During this, I noticed the permutation p values for the gene are different when I use different filter :for instance the p-beta for gene A when I use filter 10 reads in 30 % samples is 0.2586 and when I use the filter of 6 reads in 20 % samples (exclude some genes) , the p beta is 0.03. I do not understand how changing the number of genes alters the p beta as the number of variants for the specific genes remains constant. Am I missing something?

francois-a commented 1 week ago

How different are the p-values? Small differences are expected due to sampling. Otherwise can you please send another dataset that reproduces these differences?