I have a .narrowPeak file of Pol IIthat has called peaks using MACS2 and has annotated the peaks using HOMER. I am attempting to visualize the peaks using the covplot command in the Bioconductor package "ChIPseeker". I've looked at the user manual and seen that the 'readpeakfile' command is what I'm looking for (I think) but i've been unable to get it to work. Could anyone help me on how the command line would look so that I can accomplish what I'm trying to do?
Could you give examples of how you've attempted to get it to work? i.e. post the specific series of commands you attempted (avoiding unwanted personal information).
From the manual, it looks like you can either import a peak file using readPeakFile (I suspect you need to specify as="GRanges"), or you can directly specify the peak file when invoking the covplot command.
Are you sure that your path to the peak file is correct?
The tricky bit is gettting the syntax right for specifying peakfile (as seen on page 24 in the readPeakFile section).
So I'm pretty sure my problem is that I need to specify the narrowPeak file as an object which I am unsure how to do.
And what's the error that you get?
It looks like the parameters you are setting are correct (and in fact, are mostly the defaults, so you don't even need to set them). I'm wondering if it's the way you are specifying the path to the file is correct. In the manual, the examples use the "system.file" command, maybe try that and see what the exact format of the file path that is saved.
You might just need quotes around your file path?
Edit: I think that if you specified the path to your .narrowPeak file using file.path, that should work. Could be wrong.
system.file
(as used in the ChIPseeker examples) seems to just return a character vector of the path.Error is:
I'm pretty sure it's the way I'm specifying the path file ... i've tried setting
but that doesn't seem to be working either so I'm probably using it wrong.
EDIT: Tried using
path.file("home/data/Pol-II-Chip.MACS2_peaks.narrowPeak")
and then running the script again but received the same error except now it says:I actually got it to work, but now whenever I attempt
I get the following:
I suspect that the weightCol parameter is supposed to specify the name of your GRanges metadata column, or the column name of your file.
1) Do you have a column in your file with the title "score"?
2) Have you tried importing your MACS data as a GenomicRanges, then running covplot with that object?
readPeakFile
to convert to GRanges doesn't seem to work on .txt files.EDIT: I ran the covplot data but without a weightCol all the peaks were of identical heights.
Probably the simplest thing (in the short run) is to read in your .narrowPeak file as a data.frame, then construct a GenomicRanges object from it, with the score column specified as metadata. Then, run covplot on your GRanges, and specify the weight column by name.
can't seem to construct the Genomic Ranges Object. I'm pretty bad at syntax in general.
I'm trying to follow this guide.
As a larf, imported a bed file (tab-delimited) with some additional columns into a
data.frame
.My recommendation is to put a header line into your file, then import a
data.frame
as follows:Because my bed file had headers, I put
header=TRUE
This makes a data.frame, where each column (variable) has a different name, which can be seen here when I type
To make a GRanges, I typed
Where I used the column name from each data frame variable (e.g. chromosomes are
peaks$chrom
, because that's what my column header name was). This generated a GRanges object, This is what it looks like: