IndexedFst-class {scanMiRApp} | R Documentation |
Objects of the IndexedFst class enable fast named random access to FST files. This is particularly appropriate for large data.frames which often need to be accessed according to the (e.g. factor) value of a particular column.
## S4 method for signature 'IndexedFst' show(object) ## S4 method for signature 'IndexedFst' summary(object) ## S4 method for signature 'IndexedFst' names(x) ## S4 method for signature 'IndexedFst' length(x) ## S4 method for signature 'IndexedFst' lengths(x) ## S4 method for signature 'IndexedFst' nrow(x) ## S4 method for signature 'IndexedFst' ncol(x) ## S4 method for signature 'IndexedFst' colnames(x) ## S4 method for signature 'IndexedFst,ANY,ANY' x[[i, j = NULL, ...]] ## S4 method for signature 'IndexedFst,ANY,ANY,ANY' x[i, j = NULL, ..., drop = TRUE] ## S4 method for signature 'IndexedFst' x$name ## S4 method for signature 'IndexedFst' head(x, n = 6L, ...) ## S4 method for signature 'IndexedFst' as.data.frame(x, name)
object |
an IndexedFst object |
x |
an IndexedFst object |
i |
the desired index (either numeric or name) |
j, drop |
ignored |
... |
ignored |
name |
the indexed name to fetch |
n |
the desired number of rows |
Depends on the method
Pierre-Luc Germain, pierre-luc.germain@hest.ethz.ch
saveIndexedFst
, loadIndexedFst
# we first create and save an indexed FST file tmp <- tempdir() f <- system.file(tmp, "test") d <- data.frame( category=sample(LETTERS[1:4], 10000, replace=TRUE), var2=sample(LETTERS, 10000, replace=TRUE), var3=runif(10000) ) format(object.size(d),units="Kb") saveIndexedFst(d, "category", f) rm(d) # we then load the index, and can use category names for random access: d <- loadIndexedFst(f) format(object.size(d),units="Kb") nrow(d) names(d) head(d$A)