For a given data set calculate the per-sample coverage adjustments. Hector Corrada's group proposed calculating the sum of the coverage for genes below a given sample quantile. In this function, we calculate the sample quantiles of interest by sample, and then the sum of the coverage for bases below or equal to quantiles of interest. The resulting values are transformed log2(x
scalefac)
sampleDepth(collapsedFull, probs = c(0.5, 1), scalefac = 32, ...)
The full coverage data collapsed by sample as produced by collapseFullCoverage.
Number(s) between 0 and 1 representing the quantile(s) of interest. For example, 0.5 is the median.
Number added to the sample coverage adjustments before the log2 transformation.
Arguments passed to other methods and/or advanced arguments. Advanced arguments:
If TRUE
basic status updates will be printed along
the way.
If TRUE
only the nonzero counts are used to
calculate the library size adjustment. Default: TRUE
.
If TRUE
the sample coverage adjustements are
centered. In some cases, this could be helpful for interpretation purposes.
Default: FALSE
.
A matrix (vector of length(probs) == 1
) with the library size depth
adjustments per sample to be used in makeModels. The number of rows
corresponds to the number of quantiles used for the sample adjustments.
Paulson, J. N., Stine, O. C., Bravo, H. C. & Pop, M. Differential abundance analysis for microbial marker-gene surveys. Nat. Methods (2013). doi:10.1038/nmeth.2658
## Collapse the coverage information
collapsedFull <- collapseFullCoverage(list(genomeData$coverage),
verbose = TRUE
)
#> 2023-05-07 06:01:37.901308 collapseFullCoverage: Sorting fullCov
#> 2023-05-07 06:01:37.903856 collapseFullCoverage: Collapsing chromosomes information by sample
## Calculate library size adjustments
sampleDepths <- sampleDepth(collapsedFull, probs = c(0.5, 1), verbose = TRUE)
#> 2023-05-07 06:01:37.905912 sampleDepth: Calculating sample quantiles
#> 2023-05-07 06:01:37.91241 sampleDepth: Calculating sample adjustments
sampleDepths
#> ERR009101 ERR009102 ERR009105 ERR009107 ERR009108 ERR009112 ERR009115
#> 50% 8.366322 7.954196 9.379378 8.596190 8.523562 8.179909 6.129283
#> 100% 8.614710 7.977280 10.939579 9.194757 8.894818 8.321928 6.129283
#> ERR009116 ERR009131 ERR009138 ERR009144 ERR009145 ERR009148 ERR009151
#> 50% 8.233620 7.266787 8.400879 8.044394 6.72792 7.366322 9.134426
#> 100% 8.611025 7.491853 8.748193 8.888743 6.72792 8.475733 9.845490
#> ERR009152 ERR009153 ERR009159 ERR009161 ERR009163 ERR009164 ERR009167
#> 50% 8.044394 8.262095 8.991522 7.000000 6.72792 7.285402 9.214319
#> 100% 9.103288 8.741467 9.957102 8.475733 6.72792 7.754888 11.016112
#> SRR031812 SRR031835 SRR031867 SRR031868 SRR031900 SRR031904 SRR031914
#> 50% 6.066089 6.285402 5 5 5 6.285402 5
#> 100% 6.066089 6.285402 5 5 5 6.285402 5
#> SRR031936 SRR031958 SRR031960
#> 50% 5 5 5
#> 100% 5 5 5