hlaModelFiles {HIBAG} | R Documentation

## Load a model object from files

### Description

To load HIBAG models from a list of files, and merge all together.

### Usage

    hlaModelFiles(fn.list, action.missingfile=c("ignore", "stop"), verbose=TRUE)

### Arguments

`fn.list` | a vector of file names
`action.missingfile` | "ignore", ignore the missing files, by default; "stop", stop if missing
`verbose` | if TRUE, show information

### Value

Return `hlaAttrBagObj`.

### Author(s)

Xiuwen Zheng

### See Also

`hlaAttrBagging`, `hlaModelToObj`

### Examples

    # make a "hlaAlleleClass" object
    hla.id <- "C"
    hla <- hlaAllele(HLA_Type_Table$sample.id,
        H1 = HLA_Type_Table[, paste(hla.id, ".1", sep="")],
        H2 = HLA_Type_Table[, paste(hla.id, ".2", sep="")],
        locus=hla.id, assembly="hg19")

    # training genotypes
    region <- 100   # kb
    snpid <- hlaFlankingSNP(HapMap_CEU_Geno$snp.id, HapMap_CEU_Geno$snp.position,
        hla.id, region*1000, assembly="hg19")
    train.geno <- hlaGenoSubset(HapMap_CEU_Geno,
        snp.sel = match(snpid, HapMap_CEU_Geno$snp.id),
        samp.sel = match(hla$value$sample.id, HapMap_CEU_Geno$sample.id))

    #
    # train HIBAG models
    #
    set.seed(1000)

    model1 <- hlaAttrBagging(hla, train.geno, nclassifier=1)
    mobj1 <- hlaModelToObj(model1)
    save(mobj1, file="tm1.RData")

    model2 <- hlaAttrBagging(hla, train.geno, nclassifier=1)
    mobj2 <- hlaModelToObj(model2)
    save(mobj2, file="tm2.RData")

    model3 <- hlaAttrBagging(hla, train.geno, nclassifier=1)
    mobj3 <- hlaModelToObj(model3)
    save(mobj3, file="tm3.RData")

    # load all of mobj1, mobj2 and mobj3
    mobj <- hlaModelFiles(c("tm1.RData", "tm2.RData", "tm3.RData"))
    summary(mobj)

    # delete the temporary files
    unlink(c("tm1.RData", "tm2.RData", "tm3.RData"), force=TRUE)

[Package HIBAG version 1.16.0 Index]