How to generate random intervals for human genome which do not have overlap with other bed file
2
1
Entering edit mode
8.9 years ago
npy179 ▴ 10

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?

genome software-error • 3.1k views
ADD COMMENT
1
Entering edit mode
8.9 years ago
James Ashmore ★ 3.5k
# 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
ADD COMMENT
0
Entering edit mode
8.9 years ago

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

ADD COMMENT

Login before adding your answer.

Traffic: 2469 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6