Remove overlapping genes and remove genes with distance < 5000kb
Hello,
I'm working on a file .bed. I would like to create a new file without genes that are overlapping. I have the coordinates of the beginning and the end of the genes. For example:
gene1 start = 1 end = 10
gene2 start=5 end = 7
gene3 start = 9 end = 12
gene4 start = 10 end = 15
I would like to remove all these genes.
And in a second time, i would like to remove genes that they have a distance of less than 5000kb between them.
I tried to do Rstudio and Python script, but I did not succeed. I also tried to do the two steps in one.
If someone have an idea with a script or maybe an other tool ?
Thanks
A
• 2,163 views
•
link
1 answer
I finally succeed ! I used : $bedtools cluster -i A.bed -d 5000 to obtained any features that overlap or are within 5000 base pairs. And with Panda i remove all the duplicates !
• 0 views
•
link
Log in to answer this question.
have a look at bedtools intersect
Yes i did that, but i only have one file
use the file twice for -a and -b
I'm sorry but i didn't see how it's work. If i use the file twice, it return an error message " No input file given"
Thanks for the code ! I understand that "exclude.txt" contain the names of the genes that i don't want. But how to collect all the "good" genes ?
man
join -v 1When i tried on my bed file, i put awk '($4!=$10)' because i have 6 column, and i obtained an aberrant result (to much genes exclude). I think the command doesn't take into account the different chromosomes. The genes were already sorted so i didn't apply the first command.
I tested to change awk and cut, but the result remains aberrant.
Maybe the solution is simple but it's the first time i work with bash commands and bedtools. I searched the meaning of all parameters but i didn't understand all yet