ChIPseeker icon indicating copy to clipboard operation
ChIPseeker copied to clipboard

getTagMatrix with Granges without type attribute gives an error

Open tiagochst opened this issue 3 years ago • 1 comments

Prerequisites

Hello, https://guangchuangyu.github.io is not reachable.

Describe your issue

If Granges does not have an attribute type, the code does not work. As far as I know, it is also not a required argument to create a GRanges. https://github.com/YuLab-SMU/ChIPseeker/blob/0e597a539bcffd1105e032d73d7365f303d64a0c/R/tagMatrix.R#L179

Code to reproduce the error:

library(ChIPseeker)
library(ChIPseeker)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(clusterProfiler)
package.version("ChIPseeker")
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

files <- getSampleFiles()
print(files)
peak <- readPeakFile(files[[4]])
peak
promoter <- getPromoters(TxDb=txdb, upstream=3000, downstream=3000)
attributes(promoter)$type <- NULL
tagMatrix <- getTagMatrix(peak, windows=promoter)
Screen Shot 2022-01-05 at 11 04 45 AM

tiagochst avatar Jan 05 '22 16:01 tiagochst

As far as I know, it is also not a required argument to create a GRanges.

Definitely, there is no need to create a Granges by adding any argument. But the attributes are added to simplify the input argument (https://github.com/YuLab-SMU/ChIPseeker/pull/160#issuecomment-936467896). An attribute was attached to the output of getPromoters() in order to make getTagMatrix() work properly without making the users to input more arguments.

MingLi-929 avatar Jan 06 '22 03:01 MingLi-929