Skip to content

Commit

Permalink
qtl for win
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Apr 24, 2019
1 parent 7a87a06 commit 9de1d8f
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 118 deletions.
232 changes: 116 additions & 116 deletions doc/qtl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ genetic candidates.
>>> from numpy.random import RandomState
>>> from pandas import DataFrame
>>>
>>> random = RandomState(1)
>>> random = RandomState(2)
>>>
>>> # sample size
>>> n = 100
Expand All @@ -166,11 +166,11 @@ genetic candidates.
>>> print(M.head())
offset age
sample
sample0 1.62435 25.00000
sample1 1.62435 27.00000
sample2 1.62435 21.00000
sample3 1.62435 31.00000
sample4 1.62435 16.00000
sample0 -0.41676 38.00000
sample1 -0.41676 59.00000
sample2 -0.41676 34.00000
sample3 -0.41676 27.00000
sample4 -0.41676 56.00000
>>> # genetic variants
>>> G = random.randn(n, 4)
>>>
Expand All @@ -191,40 +191,40 @@ We now apply the function :func:`limix.qtl.scan` to our data set
Hypothesis 0
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶, 4.115⋅𝙸)
𝐲 ~ 𝓝(𝙼𝜶, 3.462⋅𝙸)
<BLANKLINE>
M = ['offset' 'age']
𝜶 = [-1.60130331 0.17922863]
se(𝜶) = [0.33382518 0.01227417]
lml = -212.62741096350612
𝜶 = [2.10096551 0.19582931]
se(𝜶) = [1.25826998 0.01068367]
lml = -203.98750767964498
<BLANKLINE>
Hypothesis 2
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶 + G𝛃, s(4.115⋅𝙸))
𝐲 ~ 𝓝(𝙼𝜶 + G𝛃, s(3.462⋅𝙸))
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -1.965e+02 -7.056e-01 -6.597e-01
std 3.037e+01 9.470e-01 8.287e-01
min -2.125e+02 -1.648e+00 -1.891e+00
25% -2.118e+02 -1.585e+00 -7.375e-01
50% -2.112e+02 -6.789e-01 -3.283e-01
75% -1.959e+02 1.793e-01 -2.505e-01
max -1.509e+02 1.838e-01 -9.122e-02
mean -1.951e+02 9.915e-01 -6.198e-01
std 9.227e+00 9.342e-01 3.974e-01
min -2.031e+02 1.844e-01 -1.025e+00
25% -2.026e+02 1.959e-01 -9.275e-01
50% -1.967e+02 5.965e-01 -6.047e-01
75% -1.893e+02 1.831e+00 -2.970e-01
max -1.841e+02 2.312e+00 -2.448e-01
<BLANKLINE>
Likelihood-ratio test p-values
==============================
<BLANKLINE>
𝓗₀ vs 𝓗₂
----------------
mean 2.206e-01
std 3.160e-01
min 1.139e-28
25% 4.727e-02
50% 9.740e-02
75% 2.707e-01
max 6.876e-01
mean 6.514e-02
std 8.856e-02
min 2.804e-10
25% 2.606e-07
50% 3.651e-02
75% 1.016e-01
max 1.875e-01

Suppose we also have access to the whole genotype of our samples, 𝚇, and we want to use
them to account for population structure and cryptic relatedness in our data [Ho13]_.
Expand Down Expand Up @@ -269,40 +269,40 @@ matrix 𝙺, and call :func:`limix.qtl.scan` to perform the analysis.
Hypothesis 0
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶, 1.809⋅𝙺 + 3.194⋅𝙸)
𝐲 ~ 𝓝(𝙼𝜶, 1.436⋅𝙺 + 2.934⋅𝙸)
<BLANKLINE>
M = ['offset' 'age']
𝜶 = [-1.94732565 0.19294746]
se(𝜶) = [0.32847297 0.01227062]
lml = -217.17874209561472
𝜶 = [1.95338293 0.19448903]
se(𝜶) = [1.25455536 0.0107647 ]
lml = -211.3819625136375
<BLANKLINE>
Hypothesis 2
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶 + G𝛃, s(1.809⋅𝙺 + 3.194⋅𝙸))
𝐲 ~ 𝓝(𝙼𝜶 + G𝛃, s(1.436⋅𝙺 + 2.934⋅𝙸))
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -2.167e+02 -8.781e-01 1.065e-02
std 6.507e-01 1.077e+00 2.876e-01
min -2.172e+02 -2.047e+00 -6.198e-01
25% -2.172e+02 -1.949e+00 -1.781e-01
50% -2.170e+02 -8.392e-01 5.865e-03
75% -2.165e+02 1.930e-01 1.598e-01
max -2.150e+02 1.960e-01 6.612e-01
mean -2.109e+02 1.069e+00 5.922e-02
std 7.210e-01 8.819e-01 2.474e-01
min -2.114e+02 1.919e-01 -5.204e-01
25% -2.113e+02 1.944e-01 -1.102e-01
50% -2.111e+02 8.904e-01 4.920e-02
75% -2.109e+02 1.956e+00 2.366e-01
max -2.076e+02 2.215e+00 6.433e-01
<BLANKLINE>
Likelihood-ratio test p-values
==============================
<BLANKLINE>
𝓗₀ vs 𝓗₂
----------------
mean 5.185e-01
std 3.223e-01
min 3.889e-02
25% 2.303e-01
50% 5.590e-01
75% 8.491e-01
max 9.825e-01
mean 4.843e-01
std 2.705e-01
min 6.294e-03
25% 3.137e-01
50% 4.752e-01
75% 6.953e-01
max 9.929e-01

Non-normal trait association
============================
Expand Down Expand Up @@ -344,40 +344,40 @@ distribution is not sufficient to explain the variability of yᵢ.
Hypothesis 0
============
<BLANKLINE>
𝐳 ~ 𝓝(𝙼𝜶, 0.124⋅𝙺 + 0.096⋅𝙸) for yᵢ ~ Poisson(λᵢ=g(zᵢ)) and g(x)=eˣ
𝐳 ~ 𝓝(𝙼𝜶, 0.154⋅𝙺 + 0.000⋅𝙸) for yᵢ ~ Poisson(λᵢ=g(zᵢ)) and g(x)=eˣ
<BLANKLINE>
M = ['offset' 'age']
𝜶 = [-0.95485831 0.03996287]
se(𝜶) = [0.16946147 0.00531426]
lml = -136.23239573615007
𝜶 = [5.17511934 0.04665214]
se(𝜶) = [0.85159296 0.00604329]
lml = -145.33385788740767
<BLANKLINE>
Hypothesis 2
============
<BLANKLINE>
𝐳 ~ 𝓝(𝙼𝜶 + G𝛃, s(0.124⋅𝙺 + 0.096⋅𝙸)) for yᵢ ~ Poisson(λᵢ=g(zᵢ)) and g(x)=eˣ
𝐳 ~ 𝓝(𝙼𝜶 + G𝛃, s(0.154⋅𝙺 + 0.000⋅𝙸)) for yᵢ ~ Poisson(λᵢ=g(zᵢ)) and g(x)=eˣ
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -1.349e+02 -4.575e-01 -8.332e-02
std 2.145e+00 5.319e-01 1.631e-01
min -1.362e+02 -9.733e-01 -3.052e-01
25% -1.360e+02 -9.511e-01 -1.473e-01
50% -1.358e+02 -4.514e-01 -5.062e-02
75% -1.347e+02 3.996e-02 1.338e-02
max -1.317e+02 4.027e-02 7.322e-02
mean -1.440e+02 2.553e+00 -1.306e-01
std 1.343e+00 2.682e+00 9.268e-02
min -1.453e+02 4.345e-02 -2.227e-01
25% -1.450e+02 4.635e-02 -2.018e-01
50% -1.439e+02 2.456e+00 -1.344e-01
75% -1.428e+02 5.054e+00 -6.321e-02
max -1.427e+02 5.202e+00 -3.085e-02
<BLANKLINE>
Likelihood-ratio test p-values
==============================
<BLANKLINE>
𝓗₀ vs 𝓗₂
----------------
mean 4.206e-01
std 3.920e-01
min 2.559e-03
25% 2.155e-01
50% 3.713e-01
75% 5.764e-01
max 9.373e-01
mean 2.830e-01
std 3.213e-01
min 2.274e-02
25% 2.519e-02
50% 2.113e-01
75% 4.692e-01
max 6.867e-01

Single-trait with interaction
=============================
Expand Down Expand Up @@ -430,55 +430,55 @@ Here is an example.
Hypothesis 0
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶, 0.400⋅𝙺 + 2.242⋅𝙸)
𝐲 ~ 𝓝(𝙼𝜶, 0.376⋅𝙺 + 2.077⋅𝙸)
<BLANKLINE>
M = ['offset' 'age']
𝜶 = [-0.62334332 0.06181413]
se(𝜶) = [0.26023726 0.00964886]
lml = -189.46374093761898
𝜶 = [3.12608063 0.06042316]
se(𝜶) = [1.01867609 0.00870181]
lml = -185.77488727691096
<BLANKLINE>
Hypothesis 1
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶 + (𝙶⊙𝙴₀)𝛃₀, s(0.400⋅𝙺 + 2.242⋅𝙸))
𝐲 ~ 𝓝(𝙼𝜶 + (𝙶⊙𝙴₀)𝛃₀, s(0.376⋅𝙺 + 2.077⋅𝙸))
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -1.884e+02 -2.794e-01 -5.682e-02
std 7.613e-01 3.649e-01 2.830e-01
min -1.895e+02 -6.345e-01 -3.100e-01
25% -1.888e+02 -6.195e-01 -2.423e-01
50% -1.882e+02 -2.722e-01 -1.231e-01
75% -1.879e+02 6.164e-02 6.247e-02
max -1.878e+02 6.243e-02 3.288e-01
mean -1.856e+02 1.611e+00 -2.976e-03
std 1.949e-01 1.658e+00 1.208e-01
min -1.858e+02 6.034e-02 -1.461e-01
25% -1.858e+02 6.058e-02 -4.769e-02
50% -1.856e+02 1.590e+00 -7.487e-03
75% -1.854e+02 3.137e+00 3.722e-02
max -1.854e+02 3.235e+00 1.492e-01
<BLANKLINE>
Hypothesis 1
============
<BLANKLINE>
𝐲 ~ 𝓝(𝙼𝜶 + (𝙶⊙𝙴₀)𝛃₀ + (𝙶⊙𝙴₁)𝛃₁, s(0.400⋅𝙺 + 2.242⋅𝙸))
𝐲 ~ 𝓝(𝙼𝜶 + (𝙶⊙𝙴₀)𝛃₀ + (𝙶⊙𝙴₁)𝛃₁, s(0.376⋅𝙺 + 2.077⋅𝙸))
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -1.880e+02 -2.790e-01 -4.654e-02
std 6.498e-01 3.645e-01 2.302e-01
min -1.888e+02 -6.383e-01 -3.315e-01
25% -1.883e+02 -6.229e-01 -2.106e-01
50% -1.880e+02 -2.656e-01 -9.740e-02
75% -1.877e+02 6.165e-02 1.155e-01
max -1.872e+02 6.255e-02 3.352e-01
mean -1.852e+02 1.612e+00 7.001e-03
std 7.598e-01 1.659e+00 1.475e-01
min -1.857e+02 5.991e-02 -2.573e-01
25% -1.856e+02 6.096e-02 -4.135e-02
50% -1.855e+02 1.571e+00 3.611e-02
75% -1.851e+02 3.135e+00 7.660e-02
max -1.841e+02 3.241e+00 1.971e-01
<BLANKLINE>
Likelihood-ratio test p-values
==============================
<BLANKLINE>
𝓗₀ vs 𝓗₁ 𝓗₀ vs 𝓗₂ 𝓗₁ vs 𝓗₂
----------------------------------------
mean 3.035e-01 2.714e-01 3.901e-01
std 3.935e-01 1.728e-01 1.688e-01
min 6.780e-02 1.090e-01 2.482e-01
25% 7.538e-02 1.682e-01 2.831e-01
50% 1.286e-01 2.342e-01 3.423e-01
75% 3.567e-01 3.374e-01 4.493e-01
max 8.888e-01 5.084e-01 6.274e-01
mean 6.867e-01 6.501e-01 5.244e-01
std 3.199e-01 3.350e-01 3.168e-01
min 3.963e-01 1.795e-01 9.940e-02
25% 4.185e-01 5.578e-01 3.784e-01
50% 6.755e-01 7.277e-01 5.971e-01
75% 9.436e-01 8.200e-01 7.431e-01
max 9.995e-01 9.654e-01 8.042e-01


Multi-trait association
Expand Down Expand Up @@ -541,11 +541,11 @@ Here is an example.
<BLANKLINE>
traits = ['0' '1']
M = ['offset' 'age']
𝜶 = [-0.35658972 0.00603165 -0.27791642 0.00466769]
se(𝜶) = [0.39141908 0.01439179 0.31766476 0.01167998]
diag(C₀) = [3.60751606e-12 2.59476377e-14]
diag(C₁) = [0.89913313 1.14019828]
lml = -285.02921214513117
𝜶 = [-0.16350063 -0.00299804 -0.34519932 -0.00080396]
se(𝜶) = [11.30610534 0.09640495 5.36108799 0.04573768]
diag(C₀) = [0.01405506 0.29149252]
diag(C₁) = [0.81178933 0.85777798]
lml = -277.3341774005235
<BLANKLINE>
Hypothesis 1
============
Expand All @@ -554,13 +554,13 @@ Here is an example.
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -2.845e+02 -1.543e-01 2.297e-02
std 2.505e-01 1.684e-01 8.000e-02
min -2.849e+02 -3.846e-01 -9.417e-02
25% -2.846e+02 -3.066e-01 4.629e-03
50% -2.845e+02 -1.238e-01 5.502e-02
75% -2.844e+02 5.685e-03 7.336e-02
max -2.843e+02 7.323e-03 7.600e-02
mean -2.763e+02 -1.243e-01 -2.842e-02
std 1.329e+00 1.435e-01 1.120e-01
min -2.773e+02 -3.712e-01 -1.666e-01
25% -2.772e+02 -2.032e-01 -7.187e-02
50% -2.767e+02 -6.896e-02 -2.672e-02
75% -2.758e+02 -1.371e-03 1.673e-02
max -2.744e+02 1.388e-04 1.063e-01
<BLANKLINE>
Hypothesis 2
============
Expand All @@ -569,26 +569,26 @@ Here is an example.
<BLANKLINE>
lml cov. effsizes cand. effsizes
--------------------------------------------------
mean -2.838e+02 -1.542e-01 1.175e-02
std 1.463e+00 1.684e-01 8.129e-02
min -2.849e+02 -3.841e-01 -1.290e-01
25% -2.844e+02 -3.080e-01 -3.439e-02
50% -2.843e+02 -1.215e-01 1.122e-02
75% -2.836e+02 5.721e-03 4.966e-02
max -2.816e+02 7.297e-03 1.898e-01
mean -2.761e+02 -1.245e-01 -1.209e-02
std 1.404e+00 1.439e-01 5.823e-02
min -2.772e+02 -3.744e-01 -1.151e-01
25% -2.770e+02 -2.025e-01 -3.202e-02
50% -2.766e+02 -6.702e-02 -7.899e-03
75% -2.757e+02 -1.441e-03 2.127e-02
max -2.741e+02 -7.170e-04 7.371e-02
<BLANKLINE>
Likelihood-ratio test p-values
==============================
<BLANKLINE>
𝓗₀ vs 𝓗₁ 𝓗₀ vs 𝓗₂ 𝓗₁ vs 𝓗₂
----------------------------------------
mean 3.587e-01 6.012e-01 6.956e-01
std 1.632e-01 3.712e-01 4.387e-01
min 2.279e-01 7.680e-02 5.880e-02
25% 2.644e-01 5.317e-01 5.790e-01
50% 3.062e-01 6.880e-01 8.620e-01
75% 4.005e-01 7.576e-01 9.787e-01
max 5.944e-01 9.521e-01 9.996e-01
mean 3.973e-01 6.122e-01 8.438e-01
std 3.851e-01 3.942e-01 1.327e-01
min 1.597e-02 9.168e-02 7.251e-01
25% 1.133e-01 4.159e-01 7.320e-01
50% 3.626e-01 7.039e-01 8.370e-01
75% 6.466e-01 9.002e-01 9.488e-01
max 8.478e-01 9.493e-01 9.760e-01

.. rubric:: References

Expand Down
2 changes: 1 addition & 1 deletion limix/qtl/test/test_qtl_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def test_qtl_scan_lmm_repeat_samples_by_index():

result = scan(X, y, "normal", K, M=M, verbose=False)
pv = result.stats["pv20"]
assert_allclose(pv[ix_best_snp], 1.0)
assert_allclose(pv[ix_best_snp], 1.0, rtol=1e-6)
assert_allclose(pv.values[0], 0.6684700834450028, rtol=1e-6)


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install_requires =
brent-search>=2.0.0
click>=7.0
dask[array,dataframe]>=1.2.0
glimix-core>=3.1.5
glimix-core>=3.1.7
h5py>=2.9.0
humanfriendly>=4.18
joblib>=0.13.2
Expand Down

0 comments on commit 9de1d8f

Please sign in to comment.