I have 2 datasets 1. control and other is 2. RA and I am trying to find overlapping chip seq peaks in theses 2 datasets with the script below:
#To read peak tables#
macspeaks<- read.table("MYCN_ControlPeaks.txt", header=TRUE, sep="\t", stringsAsFactors=FALSE)
head (macspeaks)
macspeaks.RA<- read.table("MYCN_RAPeaks.txt", header=TRUE, sep="\t", stringsAsFactors=FALSE)
head (macspeaks.RA)
--------------------
# function to convert table into a IRanges#`
Control.peaks = RangedData(IRanges(start=macspeaks$Start, end=macspeaks$End, names=paste(macspeaks$Chr,macspeaks$Start,sep=":")),strand="*")
head (Control.peaks)
RA.peaks = RangedData(IRanges(start=macspeaks.RA$Start, end=macspeaks.RA$End, names=paste(macspeaks.RA$Chr,macspeaks.RA$Start,sep=":")),strand="*")
head (RA.peaks)
-----------------------
#to find overlapping peaks in control and RA#
t1 =findOverlapsOfPeaks (Control.peaks, RA.peaks, maxgap=0L, minoverlap=1L, NameOfPeaks="Control","RA", select="all", annotate=1)
r = t1$OverlappingPeaks
pie(table(r$overlapFeature))
as.data.frame(t1$MergedPeaks)
-------------------------
While running it I am getting the following error in the find overlapping peaks
+ t1 =findOverlapsOfPeaks (Control.peaks, RA.peaks, maxgap=0L, minoverlap=1L, NameOfPeaks="Control","RA", select="all", annotate=1)
Error in findOverlapsOfPeaks(Control.peaks, RA.peaks, maxgap = 0L, minoverlap = 1L, :
The length of input peaks list should no more than 5
> r = t1$OverlappingPeaks
Error in t1$OverlappingPeaks :
object of type 'closure' is not subsettable
> pie(table(r$overlapFeature))
Error in eval(expr, envir, enclos) : object 'r' not found
> as.data.frame(t1$MergedPeaks)
Error in as.data.frame(t1$MergedPeaks) :
error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': Error in t1$MergedPeaks : object of type 'closure' is not subsettable
I am still in the learning stage of R and have very limited knowledge.
Kindly help to solve the problem.
Thank you
Thanks will try and get back to you.
Thanks,
Debbie