This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BEDtools intersect unable to open file

Maybe someone experienced this before (BEDtools v.2.26.0)

Having a folder with a BED file and a number of VCF file, aiming to intersect:

bedtools intersect -c -a tmp.bed -b *.vcf > counted.txt

Error message on macOS 10.12.5:

"Error: Unable to open file RG142.snp.LOH_Ex1KG_sorted.vcf. Exiting."

The same command with the exact same commands files works perfectly fine on our CentOS HPC cluster. As I have no idea where to start debugging, suggestions are appreciated.

bedtools macos centos

what are the outputs of:

file RG142.snp.LOH_Ex1KG_sorted.vcf

and

head -n1 RG142.snp.LOH_Ex1KG_sorted.vcf
RG142.snp.LOH_Ex1KG_sorted.vcf: ASCII text, with very long lines
##fileformat=VCFv4.1

Output is the same on macOS and CentOS.

My bash_profile contains:

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

1 answer

Another way:

$ for fn=`ls *.vcf`; do convert2bed --input=vcf --sort-tmpdir=$PWD ${fn} > ${fn}.bed; done
$ bedmap --count tmp.bed <(bedops -u *.vcf.bed) > counted.txt
$ rm *.vcf.bed

Log in to answer this question.