geneSetsFromFile {MIGSA} | R Documentation

## Creates a GeneSetCollection object from a file

### 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

    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

    ## 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);

[Package MIGSA version 1.8.1 Index]