aggregateFileList.Rd
Class to facilitate merging aggregateFiles. By providing a vector of aggregateFile filepaths,
aggregateFileList will check whether identical samples are included and if duplicated units are included.
The aggregateFileList can then be used to merge the aggregateFiles into either a new aggregateFile,
or merge all included aggregates into a single aggregate score per sample (mergeAggregateFiles
).
aggregateFileList(filelist, checkDups=TRUE)
: Here filelist
is a vector of aggregateFile
filepaths. checkDups
is set to TRUE
by default, in which case an error raised if
unit names are duplicated across aggregateFiles.
In the following code snippets, x is an aggregateFileList object.
listUnits(x)
: Return a vector of all units included across aggregateFiles in the aggregateFileList.
listSamples(x)
: Return a vector of all samples included across aggregateFiles in the aggregateFileList.
mergeAggregateFiles(object, output = NULL, verbose = TRUE)
:
Merge aggregrateFiles, this will generate a new aggregateFile
including all aggregates across provided aggregateFiles.
See mergeAggregateFiles
for details.
collapseAggregateFiles(object, output = NULL, verbose = TRUE)
: Collapse aggregrateFiles by aggregating values across aggregateFiles.
This will result in one aggregate score for each sample, representing the aggregate value across aggregate files.
The output will be a two-column matrix including sample IDs and aggregate scores respectively.
See collapseAggregateFiles
for details.
library(rvatData)
gdb <- gdb(rvat_example("rvatData.gdb"))
# generate two aggregate files
varsetfile <- varSetFile(rvat_example("rvatData_varsetfile.txt.gz"))
aggregatefile1 <- tempfile()
aggregate(x = gdb,
varSet = getVarSet(varsetfile, unit = c("SOD1", "FUS"), varSetName = "High"),
maxMAF = 0.001,
output = aggregatefile1,
verbose = FALSE)
aggregatefile2 <- tempfile()
aggregate(x = gdb,
varSet = getVarSet(varsetfile, unit = c("NEK1"), varSetName = "High"),
maxMAF = 0.001,
output = aggregatefile2,
verbose = FALSE)
# merge using mergeAggregateFiles
aggregatefile <- tempfile()
agglist <- aggregateFileList(c(aggregatefile1, aggregatefile2))
mergeAggregateFiles(
agglist,
output = aggregatefile
)
#> 1/2
#> 2/2