geno2Cross {MPR}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

geno2Cross(geno.data, pheno.data, cm_unit = 250000)

Arguments

geno.data ~~Describe geno.data here~~
pheno.data ~~Describe pheno.data here~~
cm_unit ~~Describe cm_unit here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (geno.data, pheno.data, cm_unit = 250000) 
{
    myGeno.data <- geno.data
    geno.value <- sort(unique(na.omit(c(myGeno.data))))
    if (identical(as.numeric(geno.value), c(0, 1))) {
        myGeno.data <- myGeno.data + 1
        geno.value <- sort(unique(na.omit(c(myGeno.data))))
    }
    if (!identical(as.numeric(geno.value), c(1, 2))) 
        stop("the value of geno.data should be 1, 2, or NA.")
    ids.RILs <- match(colnames(myGeno.data), rownames(pheno.data))
    myGeno.site <- data.frame(Chr = as.numeric(substr(rownames(myGeno.data), 
        1, 2)), Position = as.numeric(substr(rownames(myGeno.data), 
        3, 10)))
    myCrossData <- list()
    myCrossData$geno <- lapply(split(1:nrow(myGeno.data), myGeno.site$Chr), 
        function(ids) {
            myMarkers <- myGeno.site$Position[ids]/cm_unit
            names(myMarkers) <- rownames(myGeno.data)[ids]
            myMap <- list(data = t(myGeno.data[ids, ]), map = myMarkers)
            class(myMap) <- "A"
            myMap
        })
    myCrossData$pheno <- as.data.frame(pheno.data[ids.RILs, ])
    class(myCrossData) <- c("riself", "cross")
    attr(myCrossData, "alleles") <- c("A", "B")
    myCrossData
  }

[Package MPR version 0.1 Index]