I want ChIP peaks that overlap gene TSSs. However, output from ChIPpeakAnno returns peaks that do not overlap, which requires extra filtering. Is there a better way?
ChIP_peaks_annoTSS <- annotatePeakInBatch(res1_ChIP,
AnnotationData = genes(TxDb.Mmusculus.UCSC.mm10.knownGene),
output = "overlapping",
featureType = "TSS",
select = "all",
ignore.strand = TRUE,
FeatureLocForDistance = "TSS")
ChIP_peaks_annoTSS <- addGeneIDs(annotatedPeak=ChIP_peaks_annoTSS,
orgAnn = "org.Mm.eg.db",
feature_id_type = "entrez_id",
IDs2Add = "symbol") %>% as.data.frame()
fromOverlappingOrNearest column = Overlapping, when insideFeature shows inside or overlapEnd, which is NOT TSS.
So then, I filter from insideFeature column to get TSS overlaps, like:
TSSpatterns = c("overlapStart","includeFeature")
ChIP_peaks_annoTSS <- filter(ChIP_peaks_annoTSS, grepl(paste(TSSpatterns, collapse="|"), insideFeature))
ChIP_peaks_annoTSS_cond <- condenseMatrixByColnames(as.matrix(as.data.frame(ChIP_peaks_annoTSS)), "peak")
Can you show me the proper way?