Last active
November 3, 2024 17:01
-
-
Save taoliu/2469050 to your computer and use it in GitHub Desktop.
bedGraph to bigWig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check commands: slopBed, bedGraphToBigWig and bedClip | |
which bedtools &>/dev/null || { echo "bedtools not found! Download bedTools: <http://code.google.com/p/bedtools/>"; exit 1; } | |
which bedGraphToBigWig &>/dev/null || { echo "bedGraphToBigWig not found! Download: <http://hgdownload.cse.ucsc.edu/admin/exe/>"; exit 1; } | |
which bedClip &>/dev/null || { echo "bedClip not found! Download: <http://hgdownload.cse.ucsc.edu/admin/exe/>"; exit 1; } | |
# end of checking | |
if [ $# -lt 2 ];then | |
echo "Need 2 parameters! <bedgraph> <chrom info>" | |
exit | |
fi | |
F=$1 | |
G=$2 | |
bedtools slop -i ${F} -g ${G} -b 0 | bedClip stdin ${G} ${F}.clip | |
LC_COLLATE=C sort -k1,1 -k2,2n ${F}.clip > ${F}.sort.clip | |
bedGraphToBigWig ${F}.sort.clip ${G} ${F/bdg/bw} | |
rm -f ${F}.clip ${F}.sort.clip |
Hi shannon i don’t really know about the question you described . sorry that i could not be helpful. good day!
| |
bernie
|
|
***@***.***
|
签名由网易邮箱大师定制
On 08/26/2022 ***@***.***> wrote:
@ShannonTown commented on this gist.
Hi I have some questions about this script, first, I ran the original script and ran into the error about "Overlapping regions in a BedGraph file", then I made some modifications according to the last post in here and was able to make the bw file. I don't really understand what the codes do....but I was able to make it work.. Do you have further suggestions regarding "Overlapping regions in a BedGraph file"?
In the bw file, I noticed that the "binning" is larger than the original bedgraph, is it possible to keep the original "binning"?
Thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi I have some questions about this script, first, I ran the original script and ran into the error about "Overlapping regions in a BedGraph file", then I made some modifications according to the last post in here and was able to make the bw file. I don't really understand what the codes do....but I was able to make it work.. Do you have further suggestions regarding "Overlapping regions in a BedGraph file"?
In the bw file, I noticed that the "binning" is larger than the original bedgraph, is it possible to keep the original "binning"? It is changed because there's a "bedtool merge" step in the modification (which is to solve the overlapping region error?)?
Thank you!