YuLab-SMU/ChIPseeker

getTagMatrix with Granges without type attribute gives an error

tiagochst opened this issue · 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.

type <- attr(windows, 'type')

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

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 (#160 (comment)).
An attribute was attached to the output of getPromoters() in order to make getTagMatrix() work properly without making the users to input more arguments.