How to generate random intervals for human genome which do not have overlap with other bed file
I want to generate 1000000 random intervals on the human genome as background sequence, so these intervals do not have overlap with my foreground sequence intervals, my solution is generate the random intervals using bedtools random, and then delete the overlap part. Do you have any better solutions? Any comment or suggestions will be appreciated?
• 3,773 views
•
link
2 answers
# Create 1 million random intervals
bedtools random -g hg38.tsv -n 1000000 > random.bed
# Shift intervals, but do not place them in the foreground regions
bedtools shuffle -i random.bed -g hg38.tsv -excl foreground.bed > background.bed
• 0 views
•
link
use your bed as a genome file?
awk '{printf("%s_%s_%s\t%d\n",$1,$2,$3,int($3)-int($2));}' your.bed > my.genome
then use 'random' to generate the new bed
use awk to decode back the coordinateq and the chromosomes
• 0 views
•
link
Log in to answer this question.