Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (54 sloc) 1.895 kb
ae757e9 @kbroman Add function markerlrt()
kbroman authored
1 ######################################################################
2 #
3 # markerlrt.R
4 #
5 # copyright (c) 2010, Karl W Broman
6 # last modified Jul, 2010
7 # first written Jul, 2010
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License,
11 # version 3, as published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but without any warranty; without even the implied warranty of
15 # merchantability or fitness for a particular purpose. See the GNU
16 # General Public License, version 3, for more details.
17 #
18 # A copy of the GNU General Public License, version 3, is available
19 # at http://www.r-project.org/Licenses/GPL-3
20 #
21 # Part of the R/qtl package
22 # Contains: markerlrt
23 #
24 ######################################################################
25
26 ######################################################################
27 #
28 # markerlrt: General likelihood ratio test to assess linkage between
29 # all pairs of markers
30 #
31 ######################################################################
32
33 markerlrt <-
34 function(cross)
35 {
36 if(!any(class(cross) == "cross"))
37 stop("Input should have class \"cross\".")
38
39 Geno <- pull.geno(cross)
40 Geno[is.na(Geno)] <- 0
41 maxg <- max(as.numeric(Geno))
42 n.ind <- nrow(Geno)
43 n.mar <- ncol(Geno)
44 mar.names <- colnames(Geno)
45
46 z <- .C("R_markerlrt",
47 as.integer(n.ind), # number of individuals
48 as.integer(n.mar), # number of markers
49 as.integer(Geno),
50 as.integer(maxg), # maximum observed genotype
51 lod = as.double(rep(0,n.mar*n.mar)),
52 PACKAGE="qtl")
53
54 cross$rf <- matrix(z$lod,ncol=n.mar)
55 dimnames(cross$rf) <- list(mar.names,mar.names)
56 attr(cross$rf, "onlylod") <- TRUE
57
58 cross
59 }
60
61 # end of markerlrt.R
Something went wrong with that request. Please try again.