save-load-IndexedFst: Saving and loading IndexedFst

Description Usage Arguments Value See Also Examples

Description

Functions to save or load and indexed fst file

Saves a data.frame (or GRanges object) into an indexed FST file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
loadIndexedFst(file, nthreads = 1)

saveIndexedFst(
  d,
  index.by,
  file.prefix,
  nthreads = 1,
  index.properties = NULL,
  add.info = list(),
  ...
)

Arguments

file

Path to the fst file, it's index (.idx), or their prefix.

nthreads

Number of threads to use for reading (default 1). This does not affect the loading of the index itself, but will affect all downstream reading operations performed on the object. If NULL, will use 'fst::threads_fst()'.

d

A data.frame or GRanges object

index.by

A column of 'd' by which it should be indexed.

file.prefix

Path and prefix of the output files.

index.properties

An optional data.frame of properties, with the levels of 'index.by' as row names.

add.info

An optional list of additional information to save.

...

Passed to 'write.fst'

Value

'loadIndexedFst' returns an object of class IndexedFst-class, and 'saveIndexedFst' returns nothing.

See Also

IndexedFst-class

IndexedFst-class

Examples

1
2
3
4
5
6
7
8
9
# 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) )
saveIndexedFst(d, "category", f)
# we then load the index, and can use category names for random access:
d <- loadIndexedFst(f)

ETHZ-INS/scanMiRApp documentation built on Jan. 20, 2022, 5:51 p.m.