Genesets-geneSetsFromFile: Creates a GeneSetCollection object from a file

Description Usage Arguments Value See Also Examples

Description

geneSetsFromFile creates a GeneSetCollection object from the data present in a file. The file must be a tab separated values file (tsv). Each line will parse to a GeneSet. First field will be the GeneSet setName, the second the setIdentifier and the remaining are the genes.

Usage

1
2
3
4
geneSetsFromFile(filePath, ...)

## S4 method for signature 'character'
geneSetsFromFile(filePath, is_GO = FALSE)

Arguments

filePath

character with the path of the file to parse.

...

not in use.

is_GO

logical indicating if this gene sets are from the Gene Ontology. If true, then each gene GeneSet setName must be a GO id.

Value

A GeneSetCollection object.

See Also

as.Genesets

Genesets-enrichr

loadGo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Create some fake gene sets in a data.frame to save them in disk and then
## load them (10 gene sets with 20 genes each (it is not neccesary that they
## have the same number of genes).
gsets <- data.frame(
  IDs = paste("set", 1:10),
  Names = rep("", 10),
  matrix(paste("gene", 1:(10 * 20)), nrow = 10)
)
## And save this file as a tab separated file.
geneSetsFile <- paste(tempdir(), "/fakeGsets.tsv", sep = "")
write.table(gsets,
  file = geneSetsFile, sep = "\t",
  col.names = FALSE, row.names = FALSE, quote = FALSE
)
## Now lets load this tsv file as a GeneSetCollection object.
myGsets <- geneSetsFromFile(geneSetsFile)
## And lets delete this tsv file (so we dont have garbage in our disk).
unlink(geneSetsFile)

MIGSA documentation built on Nov. 8, 2020, 8:26 p.m.