Closed RiboRings closed 1 year ago
Examples:
When negative values are present but pseudocount = TRUE, error arises because pseudocount should be set manually.
data("GlobalPatterns", package = "mia")
tse <- GlobalPatterns
assay(tse, "neg_counts") <- assay(tse, "counts") - 2
tse <- transformAssay(tse,
method = "relabundance",
assay.type = "neg_counts",
pseudocount = TRUE)
# Error: The assay contains some negative values. 'pseudocount' must be specified manually.
tse <- transformAssay(tse,
method = "relabundance",
assay.type = "neg_counts",
pseudocount = 4)
# Warning message:
# The assay contains some negative values. Applying a pseudocount may produce meaningless data.
When pseudocount = TRUE, applied value is returned as message
tse <- transformAssay(tse,
method = "relabundance",
pseudocount = TRUE)
# A pseudocount of 1 was applied.
Warning when only positive values but pseudocount = TRUE or positive number
tse <- transformAssay(tse,
method = "clr",
assay.type = "relabundance",
pseudocount = TRUE)
# Warning message:
# The assay contains only positive values. Applying a pseudocount is not necessary.
When negative values present but pseudocount = 0, FALSE or TRUE
tse <- transformAssay(tse,
method = "log10",
assay.type = "clr",
pseudocount = FALSE)
# Error: The assay contains negative values and log10 transformation is being applied without
# pseudocount.`pseudocount` must be specified manually.
Hi!
This PR is meant to simplify pseudocount selection for transformations that need a pseudocount, as discussed in this OMA issue.
The option TRUE of
transformAssay
sets pseudocount to smallest positive value of assay, whereas FALSE sets it to 0.