# Locus overlap analysis for enrichment of genomic ranges

## Documentation for package ‘LOLA’ version 1.23.0

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

buildRestrictedUniverse | If you want to test for differential enrichment within your usersets, you can restrict the universe to only regions that are covered in at least one of your sets. This function helps you build just such a restricted universe
checkUniverseAppropriateness | Check universe appropriateness
cleanws | cleanws takes multi-line, code formatted strings and just formats them as simple strings
countOverlapsAnyRev | Just a reverser. Reverses the order of arguments and passes them untouched to countOverlapsAny - so you can use it with lapply.
extractEnrichmentOverlaps | Given a single row from an enrichment table calculation, finds the set of overlaps between the user set and the test set. You can then use these, for example, to get sequences for those regions.
getRegionFile | Grab the filename for a a single region set from a database specified by filename.
getRegionSet | Grab a single region set from a database, specified by filename.
lapplyAlias | Function to run lapply or mclapply, depending on the option set in getOption("mc.cores"), which can be set with setLapplyAlias().
listRegionSets | Lists the region sets for given collection(s) in a region database on disk.
listToGRangesList | converts a list of GRanges into a GRangesList; strips all metadata.
loadRegionDB | Helper function to annotate and load a regionDB, a folder with subfolder collections of regions.
LOLA | Genome locus overlap analysis.
mergeRegionDBs | Given two regionDBs, (lists returned from loadRegionDB()), This function will combine them into a single regionDB. This will enable you to combine, for example, LOLA Core databases with custom databases into a single analysis.
nlist | Named list function.
plotTopLOLAEnrichments | Given some results (you grab the top ones on your own), this plots a barplot visualizing their odds ratios.
readBed | Imports bed files and creates GRanges objects, using the fread() function from data.table.
readCollection | Given a bunch of region set files, read in all those flat (bed) files and create a GRangesList object holding all the region sets. This function is used by readRegionGRL to process annotation objects.
readCollectionAnnotation | Read collection annotation
readCollectionFiles | Given a database and a collection, this will create the region annotation data.table; either giving a generic table based on file names, or by reading in the annotation data.
readRegionGRL | This function takes a region annotation object and reads in the regions, returning a GRangesList object of the regions.
readRegionSetAnnotation | Given a folder containing region collections in subfolders, this function will either read the annotation file if one exists, or create a generic annotation file.

redefineUserSets

This function will take the user sets, overlap with the universe, and redefine the user sets as the set of regions in the user universe that overlap at least one region in user sets. this makes for a more appropriate statistical enrichment comparison, as the user sets are actually exactly the same regions found in the universe otherwise, you can get some weird artifacts from the many-to-many relationship between user set regions and universe regions.

replaceFileExtension | This will change the string in filename to have a new extension
runLOLA | Enrichment Calculation
sampleGRL | Function to sample regions from a GRangesList object, in specified proportion
setLapplyAlias | To make parallel processing a possibility but not required, I use an lapply alias which can point at either the base lapply (for no multicore), or it can point to mclapply, and set the options for the number of cores (what mclapply uses). With no argument given, returns intead the number of cpus currently selected.
setSharedDataDir | setSharedDataDir Sets global variable specifying the default data directory.
splitDataTable | Efficiently split a data.table by a column in the table
splitFileIntoCollection | This function will take a single large bed file that is annotated with a column grouping different sets of similar regions, and split it into separate files for use with the LOLA collection format.
userSets | An example set of regions, sampled from the example database.
userUniverse | A reduced GRanges object from the example regionDB database
write.tsv | Wrapper of write.table that provides defaults to write a simple .tsv file. Passes additional arguments to write.table
writeCombinedEnrichment | Function for writing output all at once: combinedResults is an table generated by "locationEnrichment()" or by rbinding category/location results. Writes all enrichments to a single file, and also spits out the same data divided into groups based on userSets, and Databases, just for convenience. disable this with an option.
writeDataTableSplitByColumn | Given a data table and a factor variable to split on, efficiently divides the table and then writes the different splits to separate files, named with filePrepend and numbered according to split.