This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to apply bedtools intersect function with GNU parallel for bacth BED file comparison?

Here is my code:

parallel bedtools intersect -a g7.bed -b {} -wao > {}.bedtools_intersections_results_complete ::: *.bed

I want to compare all .bed files in the directory to a predone g7.bed file with drug resistance mutations therein. Need help on how to apply GNU parallel correctly. Thx. Your forum is very useful.

bedtools parallel intersection

1 answer

ls *.bed | parallel "bedtools intersect -a g7.bed -b {} -wao > {.}_.bedtools_intersections_results_complete"

The {} means that the exact file is used that comes from the ls-pipe. {.} will remove the file suffix, so ".bed".

Log in to answer this question.