Skip to content

Commit 5595f89

Browse files
committed
small things/text
1 parent df7f609 commit 5595f89

File tree

2 files changed

+55
-37
lines changed

2 files changed

+55
-37
lines changed

Lecture-1-Linear-Regression.ipynb

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"cell_type": "markdown",
2323
"metadata": {},
2424
"source": [
25-
"#### Set up environment"
25+
"### Set up the environment"
2626
]
2727
},
2828
{
@@ -50,15 +50,15 @@
5050
"cell_type": "markdown",
5151
"metadata": {},
5252
"source": [
53-
"#### Download data"
53+
"### Load the data"
5454
]
5555
},
5656
{
5757
"cell_type": "markdown",
5858
"metadata": {},
5959
"source": [
60-
"We here load the yeast cross dataset.\n",
61-
"The data used in this study have been preconverted into an hdf5 file. \n",
60+
"Here, we load the yeast cross dataset.\n",
61+
"The data used in this study have already been converted into an hdf5 file. \n",
6262
"To process your own data, please use the limix command line binary (see [here](http://nbviewer.jupyter.org/github/limix/limix-tutorials/blob/master/preprocessing_QC/loading_files.ipynb))."
6363
]
6464
},
@@ -81,14 +81,14 @@
8181
"cell_type": "markdown",
8282
"metadata": {},
8383
"source": [
84-
"#### Set up data object"
84+
"### Set up the data object"
8585
]
8686
},
8787
{
8888
"cell_type": "markdown",
8989
"metadata": {},
9090
"source": [
91-
"Phenotypes and genotypes are stored inside the HDF5 file. Load them into a dataframe and select the first 3 phenotypes. "
91+
"Both the phenotypes and the genotypes are stored inside an HDF5 file. Load the data into a dataframe; here, we focus on the first 3 phenotypes. "
9292
]
9393
},
9494
{
@@ -462,14 +462,14 @@
462462
"cell_type": "markdown",
463463
"metadata": {},
464464
"source": [
465-
"## Normal distributed phenotypes and phenotype transformations"
465+
"## Check the model assumptions (are the data normal?)"
466466
]
467467
},
468468
{
469469
"cell_type": "markdown",
470470
"metadata": {},
471471
"source": [
472-
"To explore the phenotypic data, we create a histogram of the phenotype values."
472+
"Here, we use histograms to look at the distributions of the phenotypes."
473473
]
474474
},
475475
{
@@ -562,25 +562,23 @@
562562
"cell_type": "markdown",
563563
"metadata": {},
564564
"source": [
565-
"Some of the phenotypes deviate from a normal distribution.\n",
566-
"One of the assumptions of the linear regression model we use for association testing is that the model residuals are normal distrbuted.\n",
567-
"Violation of this assumption leads to biases in the analysis.\n",
568-
"We only have access to the residuals after fitting the model.\n",
569-
"Under the assumption that the model eplains only a small portion of phenotypic variation we can assess the phenotype values instead."
565+
"Your data will often deviate from a normal distribution (sometimes drastically, like Cadmium Chloride shown above).\n",
566+
"Unfortunately, one of the assumptions of the model that we use in GWAS is that the residuals are normally distrbuted.\n",
567+
"Violations of this assumption can result in model misspecification and thus biased parameter estimates."
570568
]
571569
},
572570
{
573571
"cell_type": "markdown",
574572
"metadata": {},
575573
"source": [
576-
"### Transforming phenotypes"
574+
"### Variance stabilizing transformations; standardizing the phenotypes"
577575
]
578576
},
579577
{
580578
"cell_type": "markdown",
581579
"metadata": {},
582580
"source": [
583-
"To make the data look more normal distrbuted, we apply two different phenotype transformations, the Box-Cox transformation and a non-parametric rank-based transformation."
581+
"There are a wide variety of methods to stabilize variance and make data normally distributed. Here, we explore the usefulness of the Box-Cox transformation as well as a (non-parametric) rank-based transformation."
584582
]
585583
},
586584
{
@@ -594,7 +592,7 @@
594592
"cell_type": "markdown",
595593
"metadata": {},
596594
"source": [
597-
"The Box-Cox transformation makes the data \"more normal\" by fitting a power transformation with one parameter to the observed phenotypic data."
595+
"The Box-Cox transformation makes the data \"more normal\" by fitting a power transformation ($y^{\\lambda}$, where $\\lambda$ is found using maximum likelihood) to the observed phenotypic data."
598596
]
599597
},
600598
{
@@ -926,14 +924,14 @@
926924
"cell_type": "markdown",
927925
"metadata": {},
928926
"source": [
929-
"#### Manhattan plot"
927+
"### Plotting the results"
930928
]
931929
},
932930
{
933931
"cell_type": "markdown",
934932
"metadata": {},
935933
"source": [
936-
"A common way to visualize the results of a GWAS is a so-called Manhattan plot, where the $-log_{10}$ P-values are plotted against the genomic position.\n",
934+
"A common way to visualize the results from GWAS is by using a so-called Manhattan plot, where the $-log_{10}$ P-values are plotted against the genomic position.\n",
937935
"\n",
938936
"The LIMIX function for producing Manhattan plots is ``limix.plot.plot_manhattan`` (see [here][1]).\n",
939937
"\n",
@@ -1026,14 +1024,14 @@
10261024
"cell_type": "markdown",
10271025
"metadata": {},
10281026
"source": [
1029-
"##### GWAS using linear regression on the transformed phenotypes:"
1027+
"### Conducting GWAS with the transformed phenotypes:"
10301028
]
10311029
},
10321030
{
10331031
"cell_type": "markdown",
10341032
"metadata": {},
10351033
"source": [
1036-
"First we analyze the Box-Cox transformed phenotypes."
1034+
"First we perform GWAS with the Box-Cox transformed phenotypes."
10371035
]
10381036
},
10391037
{
@@ -1059,7 +1057,7 @@
10591057
"cell_type": "markdown",
10601058
"metadata": {},
10611059
"source": [
1062-
"Next, we analyze the phenotypes transformed by the rank-based transformation."
1060+
"Next, we investigate the rank-transformed phenotypes."
10631061
]
10641062
},
10651063
{
@@ -1085,7 +1083,7 @@
10851083
"cell_type": "markdown",
10861084
"metadata": {},
10871085
"source": [
1088-
"To compare the results of the various transformations, we plot the p-values against one another:"
1086+
"To compare the results of the transformations, we can plot the p-values against one another:"
10891087
]
10901088
},
10911089
{
@@ -1641,16 +1639,16 @@
16411639
},
16421640
{
16431641
"cell_type": "code",
1644-
"execution_count": 29,
1642+
"execution_count": 25,
16451643
"metadata": {},
16461644
"outputs": [
16471645
{
16481646
"data": {
16491647
"text/plain": [
1650-
"<matplotlib.legend.Legend at 0x1a5bb55d10>"
1648+
"<matplotlib.legend.Legend at 0x1a24e668d0>"
16511649
]
16521650
},
1653-
"execution_count": 29,
1651+
"execution_count": 25,
16541652
"metadata": {},
16551653
"output_type": "execute_result"
16561654
},
@@ -1716,17 +1714,17 @@
17161714
"covars_conditional= sp.concatenate((geno_df.loc[sample_idx].values[:,imax:imax+1], sp.ones((phenotype_vals.values.shape[0],1))),1)\n",
17171715
" \n",
17181716
"\n",
1719-
"#run linear regression on each SNP\n",
1717+
"#run linear regression on each SNP, while conditioning on the top SNP as a covariate.\n",
17201718
"lm_conditional = qtl_test_lm(snps=geno_df.loc[sample_idx].values,pheno=phenotype_vals.values,covs=covars_conditional)\n",
17211719
"\n",
1722-
"#convert P-values to a DataFrame for nice output writing:\n",
1720+
"#convert P-values to a pandas DataFrame:\n",
17231721
"pvalues_lm_conditional = pd.DataFrame(data=lm_conditional.pvalues.T,index=positions,\n",
17241722
" columns=phenotype_ID)"
17251723
]
17261724
},
17271725
{
17281726
"cell_type": "code",
1729-
"execution_count": 30,
1727+
"execution_count": 27,
17301728
"metadata": {},
17311729
"outputs": [
17321730
{

Lecture-2-Linear-Mixed-Model.ipynb

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
"cell_type": "markdown",
6161
"metadata": {},
6262
"source": [
63-
"We here load the arabidopsis dataset.\n",
64-
"The data used in this study have been pre-converted into an hdf5 file. \n",
65-
"To process your own data, please use the limix command line binary (see [here](http://nbviewer.jupyter.org/github/limix/limix-tutorials/blob/master/preprocessing_QC/loading_files.ipynb))."
63+
"Here, we load the arabidopsis data, which have already been converted into an hdf5 file. \n",
64+
"\n",
65+
"To process your own data, use the limix command line binary (see [here](http://nbviewer.jupyter.org/github/limix/limix-tutorials/blob/master/preprocessing_QC/loading_files.ipynb) for an example)."
6666
]
6767
},
6868
{
@@ -87,7 +87,7 @@
8787
"cell_type": "markdown",
8888
"metadata": {},
8989
"source": [
90-
"The data object allows to query specific genotype or phenotype data"
90+
"The HDF5 file holds both the genotype and phenotype data."
9191
]
9292
},
9393
{
@@ -295,7 +295,7 @@
295295
},
296296
{
297297
"cell_type": "code",
298-
"execution_count": 6,
298+
"execution_count": 35,
299299
"metadata": {},
300300
"outputs": [],
301301
"source": [
@@ -307,6 +307,26 @@
307307
" dtype='float64')"
308308
]
309309
},
310+
{
311+
"cell_type": "code",
312+
"execution_count": 36,
313+
"metadata": {},
314+
"outputs": [
315+
{
316+
"data": {
317+
"text/plain": [
318+
"(1179, 21456)"
319+
]
320+
},
321+
"execution_count": 36,
322+
"metadata": {},
323+
"output_type": "execute_result"
324+
}
325+
],
326+
"source": [
327+
"geno_df.shape"
328+
]
329+
},
310330
{
311331
"cell_type": "code",
312332
"execution_count": 7,
@@ -520,7 +540,7 @@
520540
"cell_type": "markdown",
521541
"metadata": {},
522542
"source": [
523-
"### Explore flowering time phenotypes"
543+
"### Let's work with flowering time data"
524544
]
525545
},
526546
{
@@ -675,7 +695,7 @@
675695
"cell_type": "markdown",
676696
"metadata": {},
677697
"source": [
678-
"Note that when cov are not set (None), LIMIX fits an intercept (i.e., ``covs=sp.ones((N,1))``)."
698+
"When you do not include covariates (None), LIMIX still fits an intercept (i.e., ``covs=sp.ones((N,1))``)."
679699
]
680700
},
681701
{
@@ -817,7 +837,7 @@
817837
"cell_type": "markdown",
818838
"metadata": {},
819839
"source": [
820-
"### Manhattan plot"
840+
"### To get a quick idea of the results from GWAS, visualize the P-values with a Manhattan plot"
821841
]
822842
},
823843
{
@@ -1052,7 +1072,7 @@
10521072
"cell_type": "markdown",
10531073
"metadata": {},
10541074
"source": [
1055-
"Here, we perform GWAS while using an increasing number of principal components (after PCA of the genotype matrix) in an attempt to correct for confounding due to population structure. Then, we use QQ-plots to check for (possible) P-value inflation."
1075+
"Here, we perform GWAS using principal components (after PCA of the genotype matrix) in an attempt to correct for confounding due to population structure. Like earlier, we use QQ-plots to check for (possible) P-value inflation."
10561076
]
10571077
},
10581078
{

0 commit comments

Comments
 (0)