This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Load BED file on UCSC

Hi everyone!

I have a BED file that I'm trying to load on UCSC but I don't understand why it's not working. My BED file looks like this:

"chr1" 3694 3695 2.0683270951919
"chr1" 8907 8908 2.0683270951919
"chr1" 9923 9924 2.0683270951919
"chr1" 17898 17899 4.13665419038381
"chr1" 18070 18071 4.13665419038381
"chr1" 19726 19727 2.0683270951919
"chr1" 19848 19849 2.0683270951919
"chr1" 20479 20480 2.75776946025587

When I try to load it, I have this error message:

Error File 'Peaks_t2_ip110.bedgraph.bed' - Unrecognized format line 1 of file: "chr1" 3694 3695 2.0683270951919 (note: chrom names are case sensitive, e.g.: correct: 'chr1', incorrect: 'Chr1', incorrect: '1')

Does anybody could explain me what is wrong with my file? Thank you, Maude

ucsc bed format

Thanks!

Unfortunately it's still not working...

 Error File 'Peaks_t2_ip110.bedgraph.bed' - Unrecognized format line 1 of file: chr1 3694 3695 2.0683270951919 (note: chrom names are case sensitive, e.g.: correct: 'chr1', incorrect: 'Chr1', incorrect: '1')

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized.

How did you modify your file? With sed or with excel or some other editor?

I modified my R script:

write.table(f,paste(path,file,".bed", sep=""), sep="\t", col.name = FALSE, row.names = FALSE, quote = FALSE)

Because when I tried directly on the terminal with

sed 's/\"//' your_file.bed > new.bed

It removed only the quote on the left part (chr1')

Sorry about that. I have modified the command to remove all instances of the quote character. sed 's/\"//g' your_file.bed > new.bed.

BTW: I was able to use the snippet you posted above with UCSC after removing the quotes.

Thanks a lot for your help. Unfortunately something is still wrong with my file

Error File 'new.bed' - Unrecognized format line 1 of file: chr1 3693 3694 2.0683270951919 (note: chrom names are case sensitive, e.g.: correct: 'chr1', incorrect: 'Chr1', incorrect: '1')

Do you think it could be because BED files on UCSC need necessary an Header?

While I was able to get your file snippet to open in UCSC (without a header) I am not sure what those numbers are in the fourth column and if they are needed.

PS. I'm not able to use the snippet I posted even after removing the quotes... so maybe my problem is not coming from my file but it's something else related to the website. I will try to figure it out. Thank you very much!

It has been fixed. In fact I'm working with C.elegans and chromosomes' name needs to be different (chr1 = chrI). Thank you!

2 answers

remove the quotes (") you have around the chromosome name. Something like this sed 's/\"//g' your_file.bed > new.bed should do it.

You don't need the quotation marks.

Log in to answer this question.