You can convert from a q-value distribution to a p-value distribution rather simply (indeed, it's easier than the other way around!).
The way to do this in R is (explanation is in the comments):
convert.qval.pval = function(qvalues) {
# you need to know the estimate of pi0 used to create the q-value
# that's the maximum q-value (or very, very close to it)
pi0 = max(qvalues)
# compute m0, the estimated number of true nulls
m0 = length(qvalues) * pi0
# then you multiply each q-value by the proportion of true nulls
# expected to be under it (the inverse of how you get there from
# the p-value):
return(qvalues * rank(qvalues) / m0)
}
It can be done in one line as
qvalues * rank(qvalues) / (max(qvalues) * length(qvalues))
As a demonstration, using the package qvalue:
library(qvalue)
pvals = replicate(1000, t.test(rnorm(100, .1))$p.value)
qvals = qvalue(pvals)$qvalue
plot(pvals, convert.qval.pval(qvals))
