This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bed file run macs error

I have wig file downloaded from GEO, and since MACS doesn't accept wig file, so I convert it to bed file using wig2bed command. And my bed file looks like this:

chr1    3002399    3002499    id-1    0.110000
chr1    3016999    3017099    id-2    0.110000
chr1    3017099    3017199    id-3    0.110000
chr1    3017199    3017299    id-4    0.110000
chr1    3018699    3018799    id-5    0.110000
chr1    3018799    3018899    id-6    0.110000
chr1    3018899    3018999    id-7    0.110000
chr1    3018999    3019099    id-8    0.110000
chr1    3021699    3021799    id-9    0.110000
chr1    3021799    3021899    id-10    0.110000

But when I run MACS, I get empty output. Is that because the 4th column?

If it is, can someone tell me how to remove it? I tried to use

cut -f 1-3,5 H3K4me1_mef.bed >H3K4me1_mef.bed

and

cat H3K4me1_mef.bed |awk '{print $1 "\t" $2 "\t" $3 "\t" $5}' >H3K4me1_mef.bed

Neither of them works. Is that because they are not separated by tab? But they looks like tab separated.

Thank you for any idea!!!

chip-seq macs

1 answer

You might save some time by looking at the MACS readme. Seems your BED is missing the required sixth column with strand information. Scroll down to the -f/--format section in the link for more info.

You don't want to remove that fourth column. But just for grins: your command should have worked for a tab-delimited file. It probably won't for a space-delimited file. For a situation where you have multiple separating spaces between columns, I think the easiest course of action is to use:

sed -e 's/[[:blank:]]\+/\t/g' H3K4me1_mef.bed | cut -f 1-3,5 - > H3K4me1_mef_test.bed

This converts all of the interstitial whitespace to a single tab, which cut then handles happily.

Log in to answer this question.