ChIPseeker icon indicating copy to clipboard operation
ChIPseeker copied to clipboard

Error in annotatePeak with custom annotation

Open daniazi opened this issue 8 years ago • 3 comments

Hi,

I am getting an strange error while trying to annotate genomic sites (chr, start, end as the input) with chipseeker. I tried something like below:

library(biomaRt) annot.txdb = makeTxDbFromBiomart("ENSEMBL_MART_ENSEMBL", dataset="hsapiens_gene_ensembl")

y <- with(genomic.sites, GRanges(seqnames = chr, ranges = IRanges(pos, pos))) library("ChIPseeker") library("org.Hs.eg.db") ann = annotatePeak(y, TxDb = annot.txdb, annoDb = "org.Hs.eg.db", assignGenomicAnnotation = T, genomicAnnotationPriority = c("5UTR", "3UTR", "Exon", "Intron", "Intergenic"), addFlankGeneInfo = FALSE)

and it gives me the following error:

Error in [<-.data.frame(*tmp*, -genicIndex, "Intergenic", value = TRUE) : replacement has 1 row, data has 0 In addition: Warning messages: 1: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 2: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 3: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 4: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 5: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.)

Can you please help me what is wrong here?

daniazi avatar Mar 23 '16 12:03 daniazi

The 2 combined objects have no sequence levels in common.

it seems that the y has preceding chr in seqnames, like chr1 while annot.txdb doesn't (e.g. 1 for chr1).

GuangchuangYu avatar Mar 23 '16 13:03 GuangchuangYu

Thanks Guang. It is working now. However, I was wondering that regions annotated as 3UTR and 5UTR had no gene information like we get for exon and intron. Is it possible to add gene name when a region is annotated as 3/5'UTR? This will be a great help.

daniazi avatar Mar 28 '16 22:03 daniazi

Hi Guang, I met the same problem. I want to know how should I modify this problem. Thanks so much!

file <- readPeakFile("larvae1019_peaks.bed") file GRanges object with 16164 ranges and 2 metadata columns: seqnames ranges strand | V4 V5 <Rle> <IRanges> <Rle> | [1] Aqu2.1.00004_001 33-210 * | MACS_peak_1 66.47 [2] Aqu2.1.00006_001 29-169 * | MACS_peak_2 173.58 [3] Aqu2.1.00073_001 3-99 * | MACS_peak_3 106.99 [4] Aqu2.1.00083_001 6-109 * | MACS_peak_4 160.58 [5] Aqu2.1.00085_001 2-357 * | MACS_peak_5 376.23 ... ... ... ... . ... ... [16160] Aqu2.1.44712_001 2179-3669 * | MACS_peak_16160 277.26 [16161] Aqu2.1.44715_001 128-1150 * | MACS_peak_16161 218.64 [16162] Aqu2.1.44715_001 1229-1583 * | MACS_peak_16162 78.51 [16163] Aqu2.1.44715_001 1633-1758 * | MACS_peak_16163 77.31 [16164] Aqu2.1.44718_001 104-376 * | MACS_peak_16164 159.92 -------** seqinfo: 12077 sequences from an unspecified genome; no seqlengths txdb TxDb object: Db type: TxDb Supporting package: GenomicFeatures Data source: Amphimedon_queenslandica.Aqu1.45.gff3 Organism: NA Taxonomy ID: NA miRBase build ID: NA Genome: NA transcript_nrow: 43745 exon_nrow: 218228 cds_nrow: 214336 Db created by: GenomicFeatures package from Bioconductor Creation time: 2019-10-22 14:52:39 +1000 (Tue, 22 Oct 2019) GenomicFeatures version at creation time: 1.32.3 RSQLite version at creation time: 2.1.2 DBSCHEMAVERSION: 1.2 x = annotatePeak(file, tssRegion=c(-3000, 3000), TxDb=txdb)

preparing features information... 2019-10-22 3:27:34 PM identifying nearest features... 2019-10-22 3:27:34 PM calculating distance from peak to TSS... 2019-10-22 3:27:34 PM assigning genomic annotation... 2019-10-22 3:27:34 PM Error in [<-.data.frame(*tmp*, tssIndex, "Promoter", value = TRUE) : replacement has 1 row, data has 0 In addition: Warning messages: 1: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 2: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 3: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 4: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.) 5: In .Seqinfo.mergexy(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.)****

hfyuanuq avatar Oct 22 '19 05:10 hfyuanuq