Sharedsupport / knitr_example.texOpen in CoCalc
Authors: Harald Schilly, ℏal Snyder, William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
1
\documentclass[12pt]{article}\usepackage[]{graphicx}\usepackage[]{color}
2
%% maxwidth is the original width if it is less than linewidth
3
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
4
\makeatletter
5
\def\maxwidth{ %
6
\ifdim\[email protected]@width>\linewidth
7
\linewidth
8
\else
9
\[email protected]@width
10
\fi
11
}
12
\makeatother
13
14
\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
15
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
16
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
17
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
18
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
19
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
20
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
21
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
22
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
23
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
24
\let\hlipl\hlkwb
25
26
\usepackage{framed}
27
\makeatletter
28
\newenvironment{kframe}{%
29
\def\[email protected]@[email protected]{}%
30
\ifinner\ifhmode%
31
\def\[email protected]@[email protected]{\end{minipage}}%
32
\begin{minipage}{\columnwidth}%
33
\fi\fi%
34
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
35
\colorbox{shadecolor}{##1}\hskip-\fboxsep
36
% There is no \\@totalrightmargin, so:
37
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
38
\MakeFramed {\advance\hsize-\width
39
\@totalleftmargin\[email protected] \linewidth\hsize
40
\@setminipage}}%
41
{\par\unskip\endMakeFramed%
42
\[email protected]@[email protected]}
43
\makeatother
44
45
\definecolor{shadecolor}{rgb}{.97, .97, .97}
46
\definecolor{messagecolor}{rgb}{0, 0, 0}
47
\definecolor{warningcolor}{rgb}{1, 0, 1}
48
\definecolor{errorcolor}{rgb}{1, 0, 0}
49
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
50
51
\usepackage{alltt}
52
53
\usepackage{times}
54
\usepackage{hyperref}
55
\hypersetup{pdfpagemode=UseNone} % don't show bookmarks on initial view
56
\hypersetup{colorlinks, urlcolor={blue}}
57
58
% revise margins
59
\setlength{\headheight}{0.0in}
60
\setlength{\topmargin}{0.0in}
61
\setlength{\headsep}{0.0in}
62
\setlength{\textheight}{8.65in}
63
\setlength{\footskip}{0.35in}
64
\setlength{\oddsidemargin}{0.0in}
65
\setlength{\evensidemargin}{0.0in}
66
\setlength{\textwidth}{6.5in}
67
68
\setlength{\parskip}{6pt}
69
\setlength{\parindent}{0pt}
70
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
71
\begin{document}
72
73
{\sffamily \textbf{An example Knitr/R Markdown document}}
74
75
\href{http://kbroman.org}{Karl W Broman}
76
77
This is a portion of the ``\href{http://www.rqtl.org/rqtltour2.pdf}{A shorter tour of R/qtl}''
78
tutorial, developed here in multiple formats to illustrate the use of knitr.
79
This particular document is written with \href{http://www.latex-project.org}{LaTeX}.
80
81
82
83
\bigskip
84
{\sffamily \textbf{Preliminaries}}
85
\nopagebreak
86
87
To install R/qtl, you need to first install the package.
88
Type (within R) {\tt install.packages("qtl")}
89
(This needs to be done just once.)
90
91
You then load the R/qtl package using the {\tt library} function:
92
93
\begin{knitrout}
94
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
95
\begin{alltt}
96
\hlkwd{library}\hlstd{(qtl)}
97
\end{alltt}
98
\end{kframe}
99
\end{knitrout}
100
101
This needs to be done every time you start R. (There is a way to
102
have the package loaded automatically every time, but we won't discuss
103
that here.)
104
105
To get help on the functions and data sets in R
106
(and in R/qtl), use {\tt help()} or {\tt ?}. For example, to view the help
107
file for the {\tt read.cross} function, type one of the following:
108
109
\begin{knitrout}
110
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
111
\begin{alltt}
112
\hlkwd{help}\hlstd{(read.cross)}
113
\hlopt{?}\hlstd{read.cross}
114
\end{alltt}
115
\end{kframe}
116
\end{knitrout}
117
118
\bigskip
119
{\sffamily \textbf{Data import}}
120
\nopagebreak
121
122
We will consider data from
123
\href{http://www.ncbi.nlm.nih.gov/pubmed/12118100}{Sugiyama et al.,
124
Physiol Genomics 10:5--12, 2002}. Load the data into R/qtl as
125
follows.
126
127
\begin{knitrout}
128
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
129
\begin{alltt}
130
\hlstd{sug} \hlkwb{<-} \hlkwd{read.cross}\hlstd{(}\hlstr{"csv"}\hlstd{,} \hlstr{"http://www.rqtl.org"}\hlstd{,} \hlstr{"sug.csv"}\hlstd{,}
131
\hlkwc{genotypes}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"CC"}\hlstd{,} \hlstr{"CB"}\hlstd{,} \hlstr{"BB"}\hlstd{),}
132
\hlkwc{alleles}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"C"}\hlstd{,} \hlstr{"B"}\hlstd{))}
133
\end{alltt}
134
\begin{verbatim}
135
## --Read the following data:
136
## 163 individuals
137
## 93 markers
138
## 6 phenotypes
139
## --Cross type: f2
140
\end{verbatim}
141
\end{kframe}
142
\end{knitrout}
143
144
145
The function {\tt read.cross} is for importing data into R/qtl.
146
{\tt "sug.csv"} is the name of the file, which we import directly
147
from the R/qtl website. {\tt genotypes} indicates the codes used for
148
the genotypes; {\tt alleles} indicates single-character codes to be
149
used in plots and such.
150
151
{\tt read.cross} loads the data from the file and formats it into
152
a special cross object, which is then assigned to {\tt sug} via the
153
assignment operator {\tt <-}.
154
155
The data are from an intercross between BALB/cJ and CBA/CaJ; only male
156
offspring were considered. There are four phenotypes: blood pressure,
157
heart rate, body weight, and heart weight. We will focus on the blood
158
pressure phenotype, will consider just the 163 individuals with
159
genotype data and, for simplicity, will focus on the autosomes.
160
161
162
\bigskip
163
{\sffamily \textbf{Summaries}}
164
\nopagebreak
165
166
The data object {\tt sug} is complex; it contains the genotype
167
data, phenotype data and genetic map. R has a certain amount of
168
``object oriented'' facilities, so that calls to functions like
169
{\tt summary} and {\tt plot} are interpreted appropriately for the object
170
considered.
171
172
The object {\tt sug} has ``class'' {\tt "cross"}, and so calls to
173
{\tt summary} and {\tt plot} are actually sent to the functions
174
{\tt summary.cross} and {\tt plot.cross}.
175
176
Use {\tt summary()} to get a quick summary of the data. (This also
177
performs a variety of checks of the integrity of the data.)
178
179
\begin{knitrout}
180
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
181
\begin{alltt}
182
\hlkwd{summary}\hlstd{(sug)}
183
\end{alltt}
184
\begin{verbatim}
185
## F2 intercross
186
##
187
## No. individuals: 163
188
##
189
## No. phenotypes: 6
190
## Percent phenotyped: 95.1 95.7 99.4 99.4 100 100
191
##
192
## No. chromosomes: 19
193
## Autosomes: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
194
## 16 17 18 19
195
##
196
## Total markers: 93
197
## No. markers: 5 7 5 5 5 4 8 4 4 5 6 3 3 5 5 4 4 6
198
## 5
199
## Percent genotyped: 98.3
200
## Genotypes (%): CC:23.9 CB:50.2 BB:26.0
201
## not BB:0.0 not CC:0.0
202
\end{verbatim}
203
\end{kframe}
204
\end{knitrout}
205
206
We see that this is an intercross with 163 individuals.
207
There are 6 phenotypes, and genotype data at
208
93 markers across the 19 autosomes. The genotype
209
data is quite complete.
210
211
Use {\tt plot()} to get a summary plot of the data.
212
213
\begin{knitrout}
214
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
215
\begin{alltt}
216
\hlkwd{plot}\hlstd{(sug)}
217
\end{alltt}
218
\end{kframe}
219
\includegraphics[width=\maxwidth]{RnwFigs/summary_plot-1}
220
221
\end{knitrout}
222
223
The plot in the upper-left shows the pattern of missing genotype data, with
224
black pixels corresponding to missing genotypes. The next plot shows
225
the genetic map of the typed markers. The following plots are
226
histograms or bar plots for the six phenotypes. The last two
227
``phenotypes'' are sex (with 1 corresponding to males) and mouse ID.
228
229
230
\bigskip
231
{\sffamily \textbf{Single-QTL analysis}}
232
\nopagebreak
233
234
Let's now proceed to QTL mapping via a single-QTL model.
235
236
We first calculate the QTL genotype probabilities, given the
237
observed marker data, via the function {\tt calc.genoprob}. This is
238
done at the markers and at a grid along the chromosomes. The argument
239
{\tt step} is the density of the grid (in cM), and defines the
240
density of later QTL analyses.
241
242
\begin{knitrout}
243
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
244
\begin{alltt}
245
\hlstd{sug} \hlkwb{<-} \hlkwd{calc.genoprob}\hlstd{(sug,} \hlkwc{step}\hlstd{=}\hlnum{1}\hlstd{)}
246
\end{alltt}
247
\end{kframe}
248
\end{knitrout}
249
250
The output of {\tt calc.genoprob} is the same cross object as input,
251
with additional information (the QTL genotype probabilities) inserted. We
252
assign this back to the original object (writing over the previous
253
data), though it could have also been assigned to a new object.
254
255
To perform a single-QTL genome scan, we use the function {\tt scanone}.
256
By default, it performs standard interval mapping (that is, maximum
257
likelihood via the EM algorithm). Also, by default, it considers the
258
first phenotype in the input cross object (in this case, blood
259
pressure).
260
261
\begin{knitrout}
262
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
263
\begin{alltt}
264
\hlstd{out.em} \hlkwb{<-} \hlkwd{scanone}\hlstd{(sug)}
265
\end{alltt}
266
\end{kframe}
267
\end{knitrout}
268
269
The output has ``class'' {\tt "scanone"}. The {\tt summary}
270
function is passed to the function {\tt summary.scanone}, and gives
271
the maximum LOD score on each chromosome.
272
273
\begin{knitrout}
274
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
275
\begin{alltt}
276
\hlkwd{summary}\hlstd{(out.em)}
277
\end{alltt}
278
\begin{verbatim}
279
## chr pos lod
280
## D1MIT36 1 76.73 1.449
281
## c2.loc77 2 82.80 1.901
282
## c3.loc42 3 52.82 1.393
283
## c4.loc43 4 47.23 0.795
284
## D5MIT223 5 86.57 1.312
285
## c6.loc26 6 27.81 0.638
286
## c7.loc45 7 47.71 6.109
287
## c8.loc34 8 54.90 1.598
288
## D9MIT71 9 27.07 0.769
289
## c10.loc51 10 60.75 0.959
290
## c11.loc34 11 38.70 2.157
291
## D12MIT145 12 2.23 1.472
292
## c13.loc20 13 27.26 1.119
293
## D14MIT138 14 12.52 1.119
294
## c15.loc8 15 11.96 5.257
295
## c16.loc31 16 45.69 0.647
296
## D17MIT16 17 17.98 1.241
297
## D18MIT22 18 13.41 1.739
298
## D19MIT71 19 56.28 0.402
299
\end{verbatim}
300
\end{kframe}
301
\end{knitrout}
302
303
Alternatively, we can give a threshold, e.g., to only see those
304
chromosomes with LOD $>$ 3.
305
306
\begin{knitrout}
307
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
308
\begin{alltt}
309
\hlkwd{summary}\hlstd{(out.em,} \hlkwc{threshold}\hlstd{=}\hlnum{3}\hlstd{)}
310
\end{alltt}
311
\begin{verbatim}
312
## chr pos lod
313
## c7.loc45 7 47.7 6.11
314
## c15.loc8 15 12.0 5.26
315
\end{verbatim}
316
\end{kframe}
317
\end{knitrout}
318
319
We can plot the results as follows.
320
321
\begin{knitrout}
322
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
323
\begin{alltt}
324
\hlkwd{plot}\hlstd{(out.em)}
325
\end{alltt}
326
\end{kframe}
327
\includegraphics[width=\maxwidth]{RnwFigs/plot_scanone-1}
328
329
\end{knitrout}
330
331
We can do the genome scan via Haley-Knott regression by calling
332
{\tt scanone} with the argument {\tt method="hk"}.
333
334
\begin{knitrout}
335
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
336
\begin{alltt}
337
\hlstd{out.hk} \hlkwb{<-} \hlkwd{scanone}\hlstd{(sug,} \hlkwc{method}\hlstd{=}\hlstr{"hk"}\hlstd{)}
338
\end{alltt}
339
\end{kframe}
340
\end{knitrout}
341
342
We may plot the two sets of LOD curves together in a single call
343
to {\tt plot}.
344
345
\begin{knitrout}
346
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
347
\begin{alltt}
348
\hlkwd{plot}\hlstd{(out.em, out.hk,} \hlkwc{col}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"blue"}\hlstd{,} \hlstr{"red"}\hlstd{))}
349
\end{alltt}
350
\end{kframe}
351
\includegraphics[width=\maxwidth]{RnwFigs/plot_em_and_hk-1}
352
353
\end{knitrout}
354
355
Alternatively, we could do the following (figure not included, for brevity):
356
357
\begin{knitrout}
358
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
359
\begin{alltt}
360
\hlkwd{plot}\hlstd{(out.em,} \hlkwc{col}\hlstd{=}\hlstr{"blue"}\hlstd{)}
361
\hlkwd{plot}\hlstd{(out.hk,} \hlkwc{col}\hlstd{=}\hlstr{"red"}\hlstd{,} \hlkwc{add}\hlstd{=}\hlnum{TRUE}\hlstd{)}
362
\end{alltt}
363
\end{kframe}
364
\end{knitrout}
365
366
It's perhaps more informative to plot the differences:
367
368
\begin{knitrout}
369
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
370
\begin{alltt}
371
\hlkwd{plot}\hlstd{(out.hk} \hlopt{-} \hlstd{out.em,} \hlkwc{ylim}\hlstd{=}\hlkwd{c}\hlstd{(}\hlopt{-}\hlnum{0.3}\hlstd{,} \hlnum{0.3}\hlstd{),}
372
\hlkwc{ylab}\hlstd{=}\hlstr{"LOD(HK)-LOD(EM)"}\hlstd{)}
373
\end{alltt}
374
\end{kframe}
375
\includegraphics[width=\maxwidth]{RnwFigs/plot_diff-1}
376
377
\end{knitrout}
378
379
\bigskip
380
{\sffamily \textbf{Permutation tests}}
381
\nopagebreak
382
383
To perform a permutation test, to get a genome-wide significance
384
threshold or genome-scan-adjusted p-values, we use {\tt scanone} just as
385
before, but with an additional argument, {\tt n.perm}, indicating the
386
number of permutation replicates. It's quickest to use Haley-Knott
387
regression.
388
389
\begin{knitrout}
390
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
391
\begin{alltt}
392
\hlstd{operm} \hlkwb{<-} \hlkwd{scanone}\hlstd{(sug,} \hlkwc{method}\hlstd{=}\hlstr{"hk"}\hlstd{,} \hlkwc{n.perm}\hlstd{=}\hlnum{1000}\hlstd{)}
393
\end{alltt}
394
\begin{verbatim}
395
## Doing permutation in batch mode ...
396
\end{verbatim}
397
\end{kframe}
398
\end{knitrout}
399
400
A histogram of the results (the 1000 genome-wide maximum LOD
401
scores) is obtained as follows:
402
403
\begin{knitrout}
404
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
405
\begin{alltt}
406
\hlkwd{plot}\hlstd{(operm)}
407
\end{alltt}
408
\end{kframe}
409
\includegraphics[width=\maxwidth]{RnwFigs/plot_perm-1}
410
411
\end{knitrout}
412
413
Significance thresholds may be obtained via the {\tt summary}
414
function:
415
416
\begin{knitrout}
417
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
418
\begin{alltt}
419
\hlkwd{summary}\hlstd{(operm)}
420
\end{alltt}
421
\begin{verbatim}
422
## LOD thresholds (1000 permutations)
423
## lod
424
## 5% 3.46
425
## 10% 3.12
426
\end{verbatim}
427
\begin{alltt}
428
\hlkwd{summary}\hlstd{(operm,} \hlkwc{alpha}\hlstd{=}\hlkwd{c}\hlstd{(}\hlnum{0.05}\hlstd{,} \hlnum{0.2}\hlstd{))}
429
\end{alltt}
430
\begin{verbatim}
431
## LOD thresholds (1000 permutations)
432
## lod
433
## 5% 3.46
434
## 20% 2.78
435
\end{verbatim}
436
\end{kframe}
437
\end{knitrout}
438
439
The permutation results may be used along with
440
the {\tt scanone} results to have significance thresholds and
441
p-values calculated automatically:
442
443
\begin{knitrout}
444
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
445
\begin{alltt}
446
\hlkwd{summary}\hlstd{(out.hk,} \hlkwc{perms}\hlstd{=operm,} \hlkwc{alpha}\hlstd{=}\hlnum{0.2}\hlstd{,} \hlkwc{pvalues}\hlstd{=}\hlnum{TRUE}\hlstd{)}
447
\end{alltt}
448
\begin{verbatim}
449
## chr pos lod pval
450
## c7.loc45 7 47.7 6.11 0.000
451
## c15.loc8 15 12.0 5.29 0.002
452
\end{verbatim}
453
\end{kframe}
454
\end{knitrout}
455
456
\bigskip
457
{\sffamily \textbf{Interval estimates of QTL location}}
458
\nopagebreak
459
460
For the blood pressure phenotype, we've seen good evidence for QTL on
461
chromosomes 7 and 15. Interval estimates of the location of QTL are
462
commonly obtained via 1.5-LOD support intervals, which may be
463
calculated via the function {\tt lodint}. Alternatively, an
464
approximate Bayes credible interval may be obtained with
465
{\tt bayesint}.
466
467
To obtain the 1.5-LOD support interval and 95\% Bayes interval
468
for the QTL on chromosome 7, type the following.
469
The first and last rows define the ends of the intervals; the middle
470
row is the estimated QTL location.
471
472
\begin{knitrout}
473
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
474
\begin{alltt}
475
\hlkwd{lodint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{7}\hlstd{)}
476
\end{alltt}
477
\begin{verbatim}
478
## chr pos lod
479
## c7.loc34 7 36.71 4.404165
480
## c7.loc45 7 47.71 6.107099
481
## c7.loc54 7 56.71 4.505278
482
\end{verbatim}
483
\begin{alltt}
484
\hlkwd{bayesint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{7}\hlstd{)}
485
\end{alltt}
486
\begin{verbatim}
487
## chr pos lod
488
## c7.loc37 7 39.71 5.086176
489
## c7.loc45 7 47.71 6.107099
490
## c7.loc50 7 52.71 5.379287
491
\end{verbatim}
492
\end{kframe}
493
\end{knitrout}
494
495
It is sometimes useful to identify the closest flanking markers;
496
use {\tt expandtomarkers=TRUE}:
497
498
\begin{knitrout}
499
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
500
\begin{alltt}
501
\hlkwd{lodint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{7}\hlstd{,} \hlkwc{expandtomarkers}\hlstd{=}\hlnum{TRUE}\hlstd{)}
502
\end{alltt}
503
\begin{verbatim}
504
## chr pos lod
505
## D7MIT176 7 34.48 3.894345
506
## c7.loc45 7 47.71 6.107099
507
## D7MIT7 7 63.14 2.800203
508
\end{verbatim}
509
\begin{alltt}
510
\hlkwd{bayesint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{7}\hlstd{,} \hlkwc{expandtomarkers}\hlstd{=}\hlnum{TRUE}\hlstd{)}
511
\end{alltt}
512
\begin{verbatim}
513
## chr pos lod
514
## D7MIT176 7 34.48 3.894345
515
## c7.loc45 7 47.71 6.107099
516
## D7MIT323 7 54.45 4.690901
517
\end{verbatim}
518
\end{kframe}
519
\end{knitrout}
520
521
We can calculate the 2-LOD support interval and the 99\% Bayes
522
interval as follows.
523
524
\begin{knitrout}
525
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
526
\begin{alltt}
527
\hlkwd{lodint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{7}\hlstd{,} \hlkwc{drop}\hlstd{=}\hlnum{2}\hlstd{)}
528
\end{alltt}
529
\begin{verbatim}
530
## chr pos lod
531
## c7.loc32 7 34.71 3.945848
532
## c7.loc45 7 47.71 6.107099
533
## c7.loc57 7 59.71 3.849972
534
\end{verbatim}
535
\begin{alltt}
536
\hlkwd{bayesint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{7}\hlstd{,} \hlkwc{prob}\hlstd{=}\hlnum{0.99}\hlstd{)}
537
\end{alltt}
538
\begin{verbatim}
539
## chr pos lod
540
## c7.loc34 7 36.71 4.404165
541
## c7.loc45 7 47.71 6.107099
542
## c7.loc54 7 56.71 4.505278
543
\end{verbatim}
544
\end{kframe}
545
\end{knitrout}
546
547
The intervals for the chr 15 locus may be calculated as follows.
548
549
\begin{knitrout}
550
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
551
\begin{alltt}
552
\hlkwd{lodint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{15}\hlstd{)}
553
\end{alltt}
554
\begin{verbatim}
555
## chr pos lod
556
## D15MIT175 15 3.96 4.432504
557
## c15.loc8 15 11.96 5.290136
558
## D15MIT184 15 22.82 3.778414
559
\end{verbatim}
560
\begin{alltt}
561
\hlkwd{bayesint}\hlstd{(out.hk,} \hlkwc{chr}\hlstd{=}\hlnum{15}\hlstd{)}
562
\end{alltt}
563
\begin{verbatim}
564
## chr pos lod
565
## D15MIT175 15 3.96 4.432504
566
## c15.loc8 15 11.96 5.290136
567
## c15.loc16 15 19.96 4.373680
568
\end{verbatim}
569
\end{kframe}
570
\end{knitrout}
571
572
573
\bigskip
574
{\sffamily \textbf{R and package versions used}}
575
\nopagebreak
576
577
\begin{knitrout}
578
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
579
\begin{alltt}
580
\hlkwd{sessionInfo}\hlstd{()}
581
\end{alltt}
582
\begin{verbatim}
583
## R version 3.3.2 (2016-10-31)
584
## Platform: x86_64-pc-linux-gnu (64-bit)
585
## Running under: Ubuntu 15.10
586
##
587
## locale:
588
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C
589
## [3] LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
590
## [5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
591
## [7] LC_PAPER=C.UTF-8 LC_NAME=C
592
## [9] LC_ADDRESS=C LC_TELEPHONE=C
593
## [11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
594
##
595
## attached base packages:
596
## [1] stats graphics grDevices utils datasets
597
## [6] methods base
598
##
599
## other attached packages:
600
## [1] qtl_1.36-6 knitr_1.15.1
601
##
602
## loaded via a namespace (and not attached):
603
## [1] magrittr_1.5 parallel_3.3.2 tools_3.3.2
604
## [4] stringi_1.1.2 highr_0.6 stringr_1.1.0
605
## [7] evaluate_0.10
606
\end{verbatim}
607
\end{kframe}
608
\end{knitrout}
609
610
\end{document}
611