Description Display methods The bimap concept Flat representation of a bimap AnnDbBimap and FlatBimap objects The "flatten" generic Property0 The Bimap interface in AnnotationDbi See Also Examples
What we usually call "annotation maps" are in fact Bimap objects. In the following sections we present the bimap concept and the Bimap interface as it is defined in AnnotationDbi.
In the code snippets below,
x
is a Bimap object.
show(x)
:
Display minimal information about Bimap object x
.
summary(x)
:
Display a little bit more information about Bimap object x
.
A bimap is made of:
1 2 3 4 5 6 |
1 2 3 4 5 |
In other words, a bimap is a bipartite graph.
Here are some examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
The flat representation of a bimap is a data frame. For example, for B1, it is:
1 2 3 4 5 6 | left right
a A
a B
b A
d C
|
If in addition the right objects have 1 multivalued attribute, for example, a numeric vector:
1 2 3 4 |
then the flat representation of B1 becomes:
1 2 3 4 5 6 7 8 9 10 |
Note that now the number of rows is greater than the number of links!
An AnnDbBimap object is a bimap whose data are stored in a data base. A FlatBimap object is a bimap whose data (left keys, right keys and links) are stored in memory (in a data frame for the links). Conceptually, AnnDbBimap and FlatBimap objects are the same (only their internal representation differ) so it's natural to try to define a set of methods that make sense for both (so they can be manipulated in a similar way). This common interface is the Bimap interface.
Note that both AnnDbBimap and FlatBimap objects have a read-only semantic: the user can subset them but cannot change their data.
1 2 3 | flatten(x) converts AnnDbBimap object x into FlatBimap
object y with no loss of information
|
Note that a FlatBimap object can't be converted into an AnnDbBimap object (well, in theory maybe it could be, but for now the data bases we use to store the data of the AnnDbBimap objects are treated as read-only). This conversion from AnnDbBimap to FlatBimap is performed by the "flatten" generic function (with methods for AnnDbBimap objects only).
The "flatten" generic plays a very useful role when we need to understand or explain exactly what a given Bimap method f will do when applied to an AnnDbBimap object. It's generally easier to explain what it does on a FlatBimap object and then to just say "and it does the same thing on an AnnDbBimap object". This is exactly what Property0 says:
1 2 3 | for any AnnDbBimap object x, f(x) is expected to be
indentical to f(flatten(x))
|
Of course, this implies that the f method for AnnDbBimap objects return the same type of object than the f method for FlatBimap objects. In this sense, the "revmap" and "subset" Bimap methods are particular because they are expected to return an object of the same class as their argument x, so f(x) can't be identical to f(flatten(x)). For these methods, Property0 says:
1 2 3 | for any AnnDbBimap object x, flatten(f(x)) is expected to
be identical to f(flatten(x))
|
Note to the AnnotationDbi maintainers/developpers: the checkProperty0
function (AnnDbPkg-checker.R file) checks that Property0 is satisfied on all
the AnnDbBimap objects defined in a given package (FIXME: checkProperty0 is
currently broken).
The full documentation for the methods of the Bimap interface is splitted into 4 man pages: Bimap-direction, Bimap-keys and Bimap-toTable.
Bimap-direction, Bimap-keys, Bimap-toTable, BimapFormatting, Bimap-envirAPI
1 2 3 4 5 6 |
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: ‘BiocGenerics’
The following objects are masked from ‘package:parallel’:
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from ‘package:stats’:
IQR, mad, sd, var, xtabs
The following objects are masked from ‘package:base’:
anyDuplicated, append, as.data.frame, basename, cbind, colnames,
dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
union, unique, unsplit, which.max, which.min
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Loading required package: IRanges
Loading required package: S4Vectors
Attaching package: ‘S4Vectors’
The following object is masked from ‘package:base’:
expand.grid
Loading required package: org.Hs.eg.db
[1] "hgu95av2" "hgu95av2_dbconn" "hgu95av2_dbfile"
[4] "hgu95av2_dbInfo" "hgu95av2_dbschema" "hgu95av2.db"
[7] "hgu95av2ACCNUM" "hgu95av2ALIAS2PROBE" "hgu95av2CHR"
[10] "hgu95av2CHRLENGTHS" "hgu95av2CHRLOC" "hgu95av2CHRLOCEND"
[13] "hgu95av2ENSEMBL" "hgu95av2ENSEMBL2PROBE" "hgu95av2ENTREZID"
[16] "hgu95av2ENZYME" "hgu95av2ENZYME2PROBE" "hgu95av2GENENAME"
[19] "hgu95av2GO" "hgu95av2GO2ALLPROBES" "hgu95av2GO2PROBE"
[22] "hgu95av2MAP" "hgu95av2MAPCOUNTS" "hgu95av2OMIM"
[25] "hgu95av2ORGANISM" "hgu95av2ORGPKG" "hgu95av2PATH"
[28] "hgu95av2PATH2PROBE" "hgu95av2PFAM" "hgu95av2PMID"
[31] "hgu95av2PMID2PROBE" "hgu95av2PROSITE" "hgu95av2REFSEQ"
[34] "hgu95av2SYMBOL" "hgu95av2UNIGENE" "hgu95av2UNIPROT"
GO map for chip hgu95av2 (object of class "ProbeGo3AnnDbBimap")
GO map for chip hgu95av2 (object of class "ProbeGo3AnnDbBimap")
|
| Lkeyname: probe_id (Ltablename: probes)
| Lkeys: "1000_at", "1001_at", ... (total=12625/mapped=11279)
|
| Rkeyname: go_id (Rtablename: go_bpgo_ccgo_mf)
| Rkeys: "GO:0000002", "GO:0000003", ... (total=18348/mapped=15963)
|
| tagname: Evidence
|
| direction: L --> R
GO2PROBE map for chip hgu95av2 (object of class "ProbeGo3AnnDbBimap")
GO2PROBE map for chip hgu95av2 (object of class "ProbeGo3AnnDbBimap")
|
| Lkeyname: probe_id (Ltablename: probes)
| Lkeys: "1000_at", "1001_at", ... (total=12625/mapped=11279)
|
| Rkeyname: go_id (Rtablename: go_bpgo_ccgo_mf)
| Rkeys: "GO:0000002", "GO:0000003", ... (total=18348/mapped=15963)
|
| tagname: Evidence
|
| direction: L <-- R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.