I was trying to calculate t-statistics using Python's scipy and numpy as np-

    NP.mean(x[['GSM1224991', 'GSM1224992']]),
    NP.std(x[['GSM1224991', 'GSM1224992']]),
    len(['GSM1224991', 'GSM1224992']),
    NP.mean(x[['GSM1224993', 'GSM1224994']]),
    NP.std(x[['GSM1224993', 'GSM1224994']]),
    len(['GSM1224993', 'GSM1224994']),

For example in the dataset given below, GSM1224991 & GSM1224992 are in first group and GSM1224993 & GSM1224994 form second group.


Here is the calculation given in GEO2R analysis for the same reference but while I calculate t test it is 0.029630766122806237 instead of -0.33768 something as shown below.

ID  adj.P.Val   P.Value t   B   logFC
148000  1   0.001426    -9.44   -0.33768    -2.513

How to calculate t-stat here? Or considering single row is wrong approach?


1 Answer 1


That is not trivial. GEO2R uses the Bayesian linear model-based framework limma https://bioconductor.org/packages/release/bioc/html/limma.html for the analysis. I doubt you can easily and meaningfully implement the relevant code in Python without a major effort and notable background knowledge. The user guide https://bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf has background information plus links to the relevant papers. Don't try to analyze things by hand, use expert software. If it is not significant, well, then it is not significant. A 2vs2 comparison is strongly underpowered, therefore lack of DEGs are not unexpected, especially for microarrays.

  • $\begingroup$ I am learning R and I will make transition to R for sure but I want to understand each and every step and function to satisfying my quest. $\endgroup$ Commented Mar 4, 2021 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.