What To Do About Negative Strand Coordinates In A Chip-Seq Peak Calling Analysis
5
0
Entering edit mode
8.6 years ago
kanwarjag ★ 1.1k

I ran MACS fro calling Chipseq and bed file showed ch1 -41 256 . Hiow can I convert into positive coordinates as the downstream analysis tools are giving error that it cannot be negative.

Thanks

coordinates • 3.3k views
2
Entering edit mode
8.6 years ago
biorepine ★ 1.5k

As Istvan said remove them.

Try this (It gives all the regions that have no negative numbers on the first strand)

awk '{if ($2>=0) print$0}' input.bed >> output.bed

2
Entering edit mode
8.6 years ago

Dont remove the peaks, replace the -ve co-ordinates by 0.

This comes under off end chromosome reads. Either use an established tool like bedclip.

Another post explaining it http://biofeed.tumblr.com/post/16758640444/ngs-chip-seq-bedclip-to-clip-out-off-end-chromosome

or use this awk script, it replaces -ve coordinates in 2nd column by 0, but doesn't removes them.

awk '{ if( $2 ~ /^-/ ){sub($2,0, $2); print$0;}else{print \$0}}' file.bed >out.bed


Cheers

0
Entering edit mode

Sukhdeep Could you please check with in above URL link for bedclip is not working

0
Entering edit mode

Check again, I was editing it at the same time :)

1
Entering edit mode
8.6 years ago

This is most likely a data processing mistake where someone corrected the binding location by shifting the 5' end to indicate midpoints but forgot to account for data on the reverse strand that may have been closer than a half fragment width to the chromosome start. Similarly you may have start sites on the positive strand that are past the chromosome ends but those don't stand out that much.

Filter out this data (remove them).

1
Entering edit mode
8.6 years ago

I would set the -41 to 0 rather than remove the peak. And for those that go beyond the end of the chromosome, set to the end of the chromosome.

1
Entering edit mode
8.6 years ago
Ian 5.8k

The wig file from MACS sometimes has a similar issue. If you convert wig to bigWig (using UCSC's wigToBigWig) then be sure to use the '-clip' flag.