fuseAnnotMatr {wrMisc} | R Documentation |
Fuse annotation matrix to initial matrix
Description
In a number of instances experimental measurements and additional information (annotation) are provided by separate objects (matrixes) as they may not be generated the same time.
The aim of this function is provide help when matching approprate lines for 2 sets of data (experimental measures in iniTab
and annotation from annotTab
) for fusing.
fuseAnnotMatr
adds suppelmental columns/annotation to an initial matrix iniTab
: using column 'refIniT' as key (in iniTab
) to compare with key 'refAnnotT' (from 'annotTab').
The columns to be added from annotTab
must be chosen explicitely.
Note: if non-unique IDs in iniTab : runs slow (but save) due to use of loop for each unique ID.
Usage
fuseAnnotMatr(
iniTab,
annotTab,
refIniT = "Uniprot",
refAnnotT = "combName",
addCol = c("ensembl_gene_id", "description", "geneName", "combName"),
debug = TRUE,
silent = FALSE,
callFrom = NULL
)
Arguments
iniTab |
(matrix), that may have lines with multiple (=repeated) key entries |
annotTab |
(matrix) containing reference annotation |
refIniT |
(character) type of reference (eg 'Uniprot') |
refAnnotT |
(character) column name to use for reference-annotation |
addCol |
(character) column-namess of 'annotTab' to use/extract (if no matches found, use all) |
debug |
(logical) for bug-tracking: more/enhanced messages |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of message(s) produced |
Value
combined matrix (elements not found in 'annotTab' are displayed as NA)
See Also
Examples
tab0 <- matrix(rep(letters[1:25],8),ncol=10)
tab1 <- cbind(Uniprot=paste(tab0[,1],tab0[,2]),col1=paste(tab0[,3],
tab0[,4],tab0[,5]," ",tab0[,7],tab0[,6]))
tab2 <- cbind(combName=paste(tab0[,1],tab0[,2]),col2=paste(tab0[,8],tab0[,9],tab0[,10]))
fuseAnnotMatr(tab1,tab2[c(20:11,2:5),],refIni="Uniprot",refAnnotT="combName",addCol="col2")
fuseAnnotMatr(tab2[c(20:11,2:5),],tab1,refAnnotT="Uniprot",refIni="combName",addCol="col1")