Skip to content

Transformations non consistent #813

Description

@antagomir

The natural log (log) in transformAssay behaves differently from log2 and log10:

# Example data
library(mia)
data(peerj13075)
tse <- peerj13075

# List log transformations
trans <- list(log2=log2, log10=log10, log=log)

for (i in names(trans)) {
  f <- trans[[i]]
  tse <- transformAssay(tse, assay.type = "counts", method = i, pseudocount=1)
  # Use check sum to verify if transformAssay gives same result than manual version
  # 0 indicates match
  print(paste(i, sum(assay(tse, i) - f(assay(tse, "counts") + 1))))

}

Reason seesm to be that log uses vegan::decostand, which has different treatment for count data.

This is confusing.

Suggestion:

  • change the default behavior of log to align with log2 and log10
  • consider providing vegan::decostand version separately, for instance through method="log.decostand"
  • even better, support providing functions in the method argument (i.e. method=log2 instead of method="log2"); then one could use vegan functions or any other functions directly here.

This could be justified since pseudocount is not intended to be used as a general transformation.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions