Problems with GRanges promoter list for EnrichedHeatmap
1
1
Entering edit mode
7.8 years ago

I am trying to use the package EnrichedHeatmap on Bioconductor. I want to make my own promoters list in GRanges. The demo promoters list for EnrichedHeatmap is of the format:

## GRanges object with 5 ranges and 0 metadata columns:
##                      seqnames               ranges strand
##                         <Rle>            <IRanges>  <Rle>
##    ENSG00000141956.9    chr21 [43299591, 43299591]      -
##   ENSG00000141959.12    chr21 [45719934, 45719934]      +
##    ENSG00000142149.4    chr21 [33245628, 33245628]      +
##   ENSG00000142156.10    chr21 [47401651, 47401651]      +
##    ENSG00000142166.8    chr21 [34696734, 34696734]      +
##   -------
##   seqinfo: 1 sequence from an unspecified genome; no seqlengths

I make my promoters list with:

library(biomaRt)
mart = useMart(biomart = "ENSEMBL_MART_ENSEMBL",
               dataset = "hsapiens_gene_ensembl")
filterlist <- c(1:22, 'X', 'Y')
ds = useDataset('hsapiens_gene_ensembl', mart = mart)
egs = getBM(attributes = c('ensembl_gene_id', 'external_gene_name', 'chromosome_name', 'start_position', 'end_position', 'strand'), 
            filters = 'chromosome_name',
            values = filterlist,
            mart = ds)
egs$TSS = ifelse(egs$strand ==1, egs$start_position, egs$end_position)
head(egs)
promoter_regions = GRanges(egs$ensembl_gene_id,
                           seqnames = Rle(paste0('chr', egs$chromosome_name)),
                           ranges = IRanges(start = egs$TSS - 2000, end = egs$TSS + 2000),
                           strand = Rle(rep("*", nrow(egs))))
head(promoter_regions)

However, my gene id keeps getting added to the last column:

GRanges object with 6 ranges and 1 metadata column:
      seqnames                 ranges strand |            gene
         <Rle>              <IRanges>  <Rle> |     <character>
  [1]     chr1 [111039834, 111043834]      * | ENSG00000252760
  [2]     chr1 [143437605, 143441605]      * | ENSG00000252830
  [3]     chr1 [ 75785889,  75789889]      * | ENSG00000207241
  [4]     chr1 [204725991, 204729991]      * | ENSG00000251861
  [5]     chr1 [211673630, 211677630]      * | ENSG00000117650
  [6]     chr1 [240152772, 240156772]      * | ENSG00000202041
  -------

Hence I get the following error while using

mat_438M <- normalizeToMatrix(BW_438M, promoter, value_column = "coverage", extend = 2000, mean_mode = "w0", w = 50)
Error in tapply(w * v, mtch[, 2], sum, na.rm = TRUE) : 
  arguments must have same length

How can I correct this? Alternatively, what other packages are there that take bigwig files and make heatmaps and profiles? ChIPseeker keeps throwing errors for bigwig files.

ChIP-Seq GRanges R Bioconductor EnrichedHeatmap • 2.3k views
ADD COMMENT
1
Entering edit mode
7.8 years ago
zwdzwd ▴ 120

You may want to set the names explicitly, since extra positional arguments will be treated as metadata.

promoter_regions = GRanges(seqnames = Rle(paste0('chr', egs$chromosome_name)),
                       ranges = IRanges(start = egs$TSS - 2000, end = egs$TSS + 2000),
                       strand = Rle(rep("*", nrow(egs))))
names(promoter_regions) <- egs$ensembl_gene_id
head(promoter_regions)

outputs

## GRanges object with 6 ranges and 0 metadata columns:
##                   seqnames                 ranges strand
##                     <Rle>              <IRanges>  <Rle>
##  ENSG00000252760     chr1 [111039834, 111043834]      *
##  ENSG00000252830     chr1 [143437605, 143441605]      *
##  ENSG00000207241     chr1 [ 75785889,  75789889]      *
##  ENSG00000251861     chr1 [204725991, 204729991]      *
##  ENSG00000117650     chr1 [211673630, 211677630]      *
##  ENSG00000202041     chr1 [240152772, 240156772]      *
 -------
 seqinfo: 24 sequences from an unspecified genome; no seqlengths
ADD COMMENT

Login before adding your answer.

Traffic: 3285 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6