I have a summarizedExperiment with ChIP and input counts and I'd like to use the filterWindows function.
> s641 class: RangedSummarizedExperiment dim: 10030 2 metadata(48): spacing width ... shift final.ext assays(1): counts rownames: NULL rowData names(1): mappableFractionPerRange colnames(2): 641_H3K9me3_1 641_input_1 colData names(8): bam.files totals ... channel rep
I try to use filterWindows as described in the manual but it results in an error!
filter.stat <- filterWindows(data = s641[,1],
background = s641[,2],
type='control',
prior.count=5,
norm.fac = list(s641[,1], s641[,2]))
Error in if (any(lib.size == 0L)) warning("Zero library size detected.") : missing value where TRUE/FALSE needed
> colData(s641)$totals [1] 9787604 24606244
Can someone help me?
I use filter=0 in windowCounts, because I had to parallelize and filter!=0 would result in SummarizedExperiment instances with different row counts that couldn't be joined afterwards:
If I understand correctly I should now filter out those bins that have an average(Log)CPM below a certain threshold, to "emulate" the filter argument in windowCounts?
I used the following 'workaround':
which works!?
filter=0
.filter
argument inwindowCounts
. The only purpose of thefilter
argument is to avoid running out of RAM, by tossing out near-empty windows while reads are being counted from the BAM files. Proper filtering is done usingfilterWindows
to account for different library sizes, log-enrichment over background, etc.s641
that have zero counts in both libraries. (In fact, this is the only way I can reproduce the error message in your original post.) I don't know how you got fromSE
tos641
, but check how many bins have all-zero counts. These shouldn't be present from a standardwindowCounts
call.