R/targetCanonicalMap.R
alamar_target_map.RdNULISAseq XML files can spell one target several ways across export dates (`TNF`, `TNF-alpha`, `tnf`). The package ships a table that maps each `alamarTargetID` to one current `targetName` and lists the historical spellings as aliases.
alamar_target_map()A data.frame with columns `alamarTargetID`, `targetName`, `current`, `note` and, when the table supplies it, `species`. One row per known spelling.
`readNULISAseq(canonicalTargets = TRUE)`, the default, rewrites every parsed target name to the current spelling this table lists for its `AlamarTargetID`. When a row carries no id, the reader looks up the parsed spelling in this table (current or alias) to recover one, then rewrites the name. The as-parsed spelling is kept in `targets$targetName_raw`. Pass `canonicalTargets = FALSE` to read names exactly as parsed.
`readNULISAseq(targetMap = )` adds `targetName -> alamarTargetID` aliases on top of this table for one read. The caller supplies only the name; the id must already be a row of this table. A row that already carries an id never consults `targetMap`.
* `alamarTargetID` and `targetName` are non-empty, carry no surrounding whitespace, and are valid UTF-8. The literal string `"NA"` is not allowed. * `current` is `TRUE` or `FALSE`. Every id has exactly one `TRUE` row. * An alias spelling (`current = FALSE`) appears in exactly one row of the whole table. * A current spelling may repeat across ids. Those ids are different targets that share a display name, for example a human and a mouse assay for `pTau-181`. * An optional fifth column `species` (for example `Human`, `Mouse`) names the species of each id. The reader uses it to choose between ids that share a spelling (see `readNULISAseq()`, argument `canonicalTargets`).
readNULISAseq, whose canonicalTargets and
targetMap arguments apply this table.
map <- alamar_target_map()
nrow(map)
#> [1] 536
head(map)
#> alamarTargetID targetName current note
#> 1 t3808 PTX3 TRUE
#> 2 t3812 PTPRS TRUE
#> 3 t3817 SIRPA TRUE
#> 4 t3829 PTN TRUE
#> 5 t3847 PSME1 TRUE
#> 6 t3900 PROS1 TRUE
# the historical spellings the reader rewrites, and what they become
aliases <- map[!map$current, c("alamarTargetID", "targetName")]
merge(aliases, map[map$current, c("alamarTargetID", "targetName")],
by = "alamarTargetID", suffixes = c("_alias", "_current"))
#> [1] alamarTargetID targetName_alias targetName_current
#> <0 rows> (or 0-length row.names)