The functions import
and export
load and save objects from and to particular file formats.
The unisets
package aims to implement support for a number of annotation and sequence formats.
The following file formats are currently supported: GMT.
GMTFile(resource) import.gmt(con, ...) # S4 method for GMTFile,ANY,ANY import(con, format, text, ...) export.gmt(object, con, ...) # S4 method for Sets,GMTFile,ANY export(object, con, format, ...) import.Go3AnnDbBimap(con, format, text, ...) # S4 method for Go3AnnDbBimap,ANY,ANY import(con, format, text, ...)
resource | For |
---|---|
con | The connection from which data is loaded or to which data is saved.
If this is a character vector, it is assumed to be a filename
and a corresponding file connection is created and then closed after exporting the object.
If a |
... | Parameters to pass to the format-specific method. |
format, text | Arguments defined in the |
object | An object of class inheriting from |
Go3AnnDbBimap | A |
For GMTFile()
, an object representing the path to a .gmt file on disk
as(Go3AnnDbBimap, "Sets")
and as.Sets(Go3AnnDbBimap)
return a Sets
from a Gene Ontology Bimap
stored distributed in a Bioconductor annotation package.
# Example file ---- gmt <- system.file(package="unisets", "extdata", "example.gmt") # Import ---- bs <- import(gmt) bs#> Sets with 674 relations between 633 elements and 4 sets #> element set #> <character> <character> #> [1] JUNB HALLMARK_TNFA_SIGNALING_VIA_NFKB #> [2] CXCL2 HALLMARK_TNFA_SIGNALING_VIA_NFKB #> [3] ATF3 HALLMARK_TNFA_SIGNALING_VIA_NFKB #> [4] NFKBIA HALLMARK_TNFA_SIGNALING_VIA_NFKB #> [5] TNFAIP3 HALLMARK_TNFA_SIGNALING_VIA_NFKB #> ... ... ... #> [670] STK38L HALLMARK_MITOTIC_SPINDLE #> [671] YWHAE HALLMARK_MITOTIC_SPINDLE #> [672] RAPGEF5 HALLMARK_MITOTIC_SPINDLE #> [673] CEP72 HALLMARK_MITOTIC_SPINDLE #> [674] CSNK1D HALLMARK_MITOTIC_SPINDLE #> ----------- #> elementInfo: IdVector with 0 metadata #> setInfo: IdVector with 1 metadata (source)# Export ---- tf <- tempfile(fileext = ".gmt") export(bs, tf) # Import (Go3AnnDbBimap) ---- library(org.Hs.eg.db) bs1 <- import(org.Hs.egGO)#>#>#>bs1#> GOSets with 322301 relations between 20488 elements and 18177 sets #> element set | evidence ontology #> <character> <character> | <factor> <factor> #> [1] 1 GO:0002576 | TAS BP #> [2] 1 GO:0008150 | ND BP #> [3] 1 GO:0043312 | TAS BP #> [4] 2 GO:0001869 | IDA BP #> [5] 2 GO:0002576 | TAS BP #> ... ... ... . ... ... #> [322297] 111089941 GO:0004571 | IMP MF #> [322298] 111089941 GO:0005509 | IEA MF #> [322299] 111240474 GO:0005515 | IPI MF #> [322300] 112441434 GO:0005515 | IPI MF #> [322301] 113219467 GO:0030533 | IEA MF #> ----------- #> elementInfo: EntrezIdVector with 0 metadata #> setInfo: GOIdVector with 4 metadata (GOID, DEFINITION, ...)