0
4 months ago by
Germany

Hi all, So I got several bed files as created by MACS2. I am loading them as list with the following:

peaks <- as.list(c("K002000291_97925.narrowPeak",
"K002000291_97926.narrowPeak",
"K002000291_97927.narrowPeak",
"K002000291_97928.narrowPeak",
"K002000291_97929.narrowPeak",
"K002000299_99400.narrowPeak",
"K002000299_99401.narrowPeak",
"K002000299_99402.narrowPeak",
"K002000299_99403.narrowPeak"))
peaks
$K002000291_97925 [1] "K002000291_97925.narrowPeak"$K002000291_97926
[1] "K002000299_99400.narrowPeak"


this are the same structure as the provided sample files, but not gziped:

files=getSampleFiles()
files
$ARmo_0M [1] "R/x86_64-pc-linux-gnu-library/3.6/ChIPseeker/extdata/GEO_sample_data/GSM1174480_ARmo_0M_peaks.bed.gz"$ARmo_1nM
[1] "R/x86_64-pc-linux-gnu-library/3.6/ChIPseeker/extdata/GEO_sample_data/GSM1174481_ARmo_1nM_peaks.bed.gz"


but when I convert them to the GRanges I got the following error:

peak=readPeakFile(peaks)
'file' must be a character string or connection


If I use only one part of the list, all is good:

peak=readPeakFile(Goettingen_peaks[[1]])
peak
GRanges object with 34719 ranges and 7 metadata columns:
seqnames            ranges strand |     MACS_peak_1      X111        .  X7.32948 X14.79510 X11.12669
<Rle>         <IRanges>  <Rle> |        <factor> <integer> <factor> <numeric> <numeric> <numeric>
[1]     chr1       11329-11448      * |     MACS_peak_2        25        .   3.76954   5.24804   2.56086
[2]     chr1       28998-29387      * |     MACS_peak_3       152        .  10.23664  19.19137  15.22631
[3]     chr1     714087-714492      * |    MACS_peak_10        27        .   4.34309   5.50985   2.78392


but then I am getting another error as also seen in the https://support.bioconductor.org/p/119149/:

covplot(peak = peak, weightCol="V5")
Error in .normarg_shift_or_weight(weight, "weight", x) :
'weight' must be a numeric vector, a single string, or a list-like object


any help would be appreciated.

modified 4 months ago • written 4 months ago by theodore.georgomanolis0

Looks like the readPeakFile only takes one file at a time? I wrote a for loop to read all the files into Granges format.

Yu also provided a link to use GRangesList instead, which will solve the problem https://guangchuangyu.github.io/2016/02/covplot-supports-grangeslist/