Created
July 16, 2020 16:55
-
-
Save jluebeck/387f90d809d05631ba12aecde1223c5c to your computer and use it in GitHub Desktop.
Using bedtools, create a new bed file which is the union of multiple bed files. Takes as input a file containing a list of bed files.
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 | |
cat $1 | while read f; | |
do | |
cat $f >> fullbed.bed | |
done | |
sort -k1,1 -k2,2n fullbed.bed > fullbed.sorted.bed | |
rm fullbed.bed | |
bedtools merge -i fullbed.sorted.bed > merged_bed_union.bed | |
rm fullbed.sorted.bed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment