QFeatures
QFeatures copied to clipboard
Streamline assay joining with `joinAssays()`
Curently, joinAssays()
combines multiple sets into a new set by matching rownames. However, in some cases, the rownames may not be meaningful for joining and I would prefer to join based on a rowData variable. For instance, DIANN data provides a Precuror.Id
column that hold unique precursor identifier within each set. See here for example:
library(QFeatures)
x <- read.delim(MsDataHub::Report.Derks2022.plexDIA.tsv())
x[["File.Name"]] <- x[["Run"]]
qf <- readQFeaturesFromDIANN(x)
## Check if any Precursor.Id is duplicated
anyDups <- sapply(names(qf), function(i) {
any(duplicated(rowData(qf)[[i]]$Precursor.Id))
})
table(anyDups) ## Precursor.Id is unique within each set
This means that the sets in qf
could immediately be joined using joinAssays()
. However, this is not possible because the rownames do not contain meaningfull information. So currently, the solution is to manually change the rownames:
for (i in names(qf)) {
rownames(qf[[i]]) <- rowData(qf[[i]])$Precursor.Id
}
I though this could be streamlined within joinAssays()
through the addition of a by
argument. Eg:
qf <- joinAssays(qf, i = names(qf), name = "precursor", by = "Precursor.Id")