Coerce non-positive size factors to positive values based on the number of detected features.
1 2 3 4 5 6 7 8
A numeric vector containing size factors for all libraries.
A numeric vector of the same length as
Argument passed to
Integer scalar specifying the number of robustness iterations.
Numeric scalar specifying the multiple of MADs to use for the tricube bandwidth in robustness iterations.
Further arguments to pass to
This function will first fit a non-linear curve of the form
y = ax/(1 + bx)
size.factors for all positive size factors.
This is a purely empirical expression, chosen because it is passes through the origin, is linear near zero and asymptotes at large
The fitting is done robustly with iterations of tricube weighting to eliminate outliers.
We then consider the number of detected features for all samples with non-positive size factors.
This is treated as
y and used to solve for
x based on the curve fitted above.
The result is the “cleaned” size factor, which must always be positive for
y < a/b.
y > a/b, there is no solution so the cleaned size factor is defined as the largest positive value in
Negative size factors can occasionally be generated by
computeSumFactors, see the documentation there for more details.
By coercing them to positive values, we can proceed to normalization and downstream analyses.
Here, we use the number of detected features as this is more robust to differential expression that would cause biases in the library size.
Of course, it is not theoretically guaranteed to yield the correct size factor, but a rough guess is better than a negative value.
A numeric vector identical to
size.factors but with all non-positive size factors replaced with fitted values from the curve.
computeSumFactors, which can occasionally generate negative size factors.
nls, which performs the curve fitting.
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.