Hi,
Regarding bed files, peaks were called using MASC2 peak caller, and data were come from Myc transcription factor ChIP seq dataset in K562 cell available in ENCODE projects.
first, I read bed files as data.frame object by using read.delim(), and I got this data.frame:
df <- df <- read.delim("data/wgEncodeSydhTfbsK562CmycStdAlnRep1.bed")
I execute the above code, and I got this:
track.type.narrowPeak.nextItemButton.on X X.1 X.2 X.3
1 chr1 11381 11441 MACS_peak_1 3.4
2 chr1 11553 11612 MACS_peak_2 2.06
3 chr1 13055 13114 MACS_peak_3 2.06
4 chr1 26952 27011 MACS_peak_4 2.06
5 chr1 29338 29445 MACS_peak_5 9.77
6 chr1 32374 32450 MACS_peak_6 3.4
the text of yellow mark is not correct. how can I rename it as desired.format of data.frame object such as below :
chrom start end strand score
1 chr1 11 12 + 1
2 chr1 12 13 - 2
3 chr1 13 14 + 3
4 chr1 14 15 * 4
5 chr1 15 16 . 5
then, I ran into strange error when I am gonna create GRanges object from makeGRangesFromDataFrame():
makeGRangesFromDataFrame(f1, TRUE)
Error in .find_start_end_cols(df_colnames0, start.field0, end.field0) :
cannnot determine start/end columns
how can I fix this issue? regarding my bed files, how can I get desired format of GRanges object? Thanks a lot
Best regards
Julaiti
Please UPDATE YOUR QUESTION to indicate how you obtained your BED file. Usually, the way to import BED files is to use
rtracklayer::import.bed()
.Dear Mr Martin Morgan:
I have updated my questions. I want to enable user can read bed files as data.frame then make GRanges objects after all, and this is what I want to do. Thanks a lot !!
Best regards:
Julaiti
Can you please provide a specific URL for the file that you are trying to import?
If you really want to use
read.delim
, then you're going to have to skip the UCSC track line. rtracklayer already knows how to do that and even formally represents the information from the track line. Why not just use rtracklayer?Dear Mr Martin Morgan:
bed files can be available:
http://www.bioinformatics.deib.polimi.it/genomic_computing/MSPC/packages/ENCODE_Samples.zip
Thanks a lot