ChIPpeakAnno-problem exporting data due to "arguments imply differing number of rows"
4
0
Entering edit mode
jmKeith • 0
@jmkeith-11960
Last seen 2.4 years ago

Hello,

I have been doing a three way analysis of ChIP-Seq data (histone modifications) using ChIPpeakAnno and I am having difficulty exporting my data.  I am able to find overlapping peaks for my three peak files, but am unable to write out the file using any "write" function that I have tried due to the differing numbers of rows.  I get this same error while trying to export my enrichedGO data file as well.  I have searched around and am unable to configure a solution so if anyone can help me out, I'd really appreciate it!

I am able to call the correct object from the overlappingPeaks object and can print it out in R, but am unable to export.

Script:

>Ol <- findOverlapsOfPeaks(d3.p300.TGR, d3.k4m1.TGR,d3.k27Ac.TGR, maxgap = 1000, minoverlap = 1L, ignore.strand = TRUE, connectedPeaks = "min")

>annotated.overlaplist <- Ol$overlappingPeaks >annotated.overlaplist > write.table(annotated.overlaplist,"C:/Users/jkeith/Desktop/R/annotatedoverlaps.txt") Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 30641, 251, 117 Many thanks for any assistance. chippeakanno • 2.1k views ADD COMMENT 1 Entering edit mode Ou, Jianhong ★ 1.2k @ou-jianhong-4539 Last seen 10 weeks ago United States Hi, Because the annotated.overlaplist is a list, you'd better export the results like this, null <- mapply(write.table, annotated.overlaplist, gsub("\\/+", ".", paste0("annotated.overlaplist_", names(annotated.overlaplist), ".txt")))  Let me known if you still have any question. ADD COMMENT 1 Entering edit mode Julie Zhu ★ 4.3k @julie-zhu-3596 Last seen 10 weeks ago United States FYI, Ol$overlappingPeaks does not contain the peaks common to all of the three input peak list. Peaks common to all three peak list are stored in Ol$peaklist, which is also a list. Are you interested in obtaining the merged peaks or the original input peak lists paired with overlapping peaks in the other input peak list(s)? Ol$peaklist contains the merged peaks as well as peaks unique to any input list.

Ol <- findOverlapsOfPeaks(d3.p300.TGR, d3.k4m1.TGR,d3.k27Ac.TGR, maxgap = 1000, minoverlap = 1L, ignore.strand = TRUE, connectedPeaks = "min")

Function getEnrichedGO also returns a named list with the following three components assuming enriched.GO contains the result from getEnrichedGO.

#'mf': enriched molecular function

enriched.GO$mf #'bp': enriched biological process enriched.GO$bp

#enriched cellular component

enriched.GO$cc Best, Julie ADD COMMENT 0 Entering edit mode Thanks very much! ADD REPLY 0 Entering edit mode jmKeith • 0 @jmkeith-11960 Last seen 2.4 years ago Hi, Again, thank you for your help. I've tried the script that you sent, but what I get is an almost entirely blank object. > overlapping <- mapply(write.table, annotated.overlaplist, gsub("\\/+", ".", paste0("annotated.overlaplist_", names(annotated.overlaplist), ".txt"))) > overlapping$d3.k4m1.TGR///d3.k27Ac.TGR
NULL

$d3.p300.TGR///d3.k27Ac.TGR NULL$d3.p300.TGR///d3.k4m1.TGR
NULL

I'm not sure how to fix this problem.

0
Entering edit mode

Check your working path, there should be several text files there.

0
Entering edit mode
jmKeith • 0
@jmkeith-11960
Last seen 2.4 years ago

In contrast, my annotated.overlaplist list object is the full list at 7MB --the first few lines are below.

> annotated.overlaplist
\$d3.k4m1.TGR///d3.k27Ac.TGR
peaks1     seqnames     start
d3.k27Ac.TGR__X00003_d3.k4m1.TGR__X00002 d3.k27Ac.TGR__X00003         chr1   4774643
d3.k27Ac.TGR__X00015_d3.k4m1.TGR__X00007 d3.k27Ac.TGR__X00015         chr1   6373096
d3.k27Ac.TGR__X00018_d3.k4m1.TGR__X00008 d3.k27Ac.TGR__X00018         chr1   6443451
d3.k27Ac.TGR__X00019_d3.k4m1.TGR__X00008 d3.k27Ac.TGR__X00019         chr1   6444261
d3.k27Ac.TGR__X00020_d3.k4m1.TGR__X00010 d3.k27Ac.TGR__X00020         chr1   6457086
d3.k27Ac.TGR__X00020_d3.k4m1.TGR__X00011 d3.k27Ac.TGR__X00020         chr1   6457086

Thanks again

0
Entering edit mode

I think I've got it--thank you for pointing out the fact that I was trying to write out a list, without thinking about the fact that it's a list!

This is the script that I've used-

>lapply(annotated.overlaplist, function(x) write.table( data.frame(x), 'annotated.overlaplist.txt'  , append= T, sep=',' ))

Traffic: 336 users visited in the last hour
FAQ
API
Stats

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