All functions


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


Check universe appropriateness


cleanws takes multi-line, code formatted strings and just formats them as simple strings


Just a reverser. Reverses the order of arguments and passes them untouched to countOverlapsAny -- so you can use it with lapply.


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.


Grab the filename for a a single region set from a database specified by filename.


Grab a single region set from a database, specified by filename.


Function to run lapply or mclapply, depending on the option set in getOption("mc.cores"), which can be set with setLapplyAlias().


Lists the region sets for given collection(s) in a region database on disk.


converts a list of GRanges into a GRangesList; strips all metadata.


Helper function to annotate and load a regionDB, a folder with subfolder collections of regions.


Genome locus overlap analysis.


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.


Named list function.


Given some results (you grab the top ones on your own), this plots a barplot visualizing their odds ratios.


Imports bed files and creates GRanges objects, using the fread() function from data.table.


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.


Read collection annotation


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.


This function takes a region annotation object and reads in the regions, returning a GRangesList object of the regions.


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.


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.


This will change the string in filename to have a new extension


Enrichment Calculation


Function to sample regions from a GRangesList object, in specified proportion


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 Sets global variable specifying the default data directory.


Efficiently split a data.table by a column in the table


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.


An example set of regions, sampled from the example database.


A reduced GRanges object from the example regionDB database


Wrapper of write.table that provides defaults to write a simple .tsv file. Passes additional arguments to write.table


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.


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.