lgatto / pRoloc

A unifying bioinformatics framework for organelle proteomics
http://lgatto.github.io/pRoloc/
15 stars 13 forks source link

Is the QSep@xnorm really needed? #102

Closed sgibb closed 7 years ago

sgibb commented 7 years ago

The current implementation of the QSep class contains the xnorm slot. While being small in size (memory usage) its information is IMHO redundant because it could be easily and fast computed by x/diag(x), e.g. qsep could be implemented as follows:

qsep <- function(object, norm = TRUE) {
    stopifnot(inherits(object, "QSep"))
    if (norm) object@x/diag(object@x)
    else object@x
}
lgatto commented 7 years ago

It is a space/computation trade-off. I waste more memory, but you need to do a (short) computation every time the normalised data is accessed. In the grand scheme of things, both gains/losses are negligible here.

sgibb commented 7 years ago

Correct, I am thought that computation of xnorm would be more rare event than data storing and an easier data structure would be beneficial. But as you said it isn't really important here. Feel free to close the issue.