This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plink bed files not recognized by samtools or bedtools

Hello,

I am trying to convert a .bam file to a .pileup using samtools and filtering the sites via a .bed file I obtained from plink. However, when I type the command

samtools mpileup -f ../../HG19/hg19.fasta -l ../../reference_population/Total_Reference/Total_Reference.bed 26305300.rmdup.bam

I get the error message

[bed_read] Parse error reading ../../reference_population/Total_Reference/Total_Reference.bed at line 1
samtools: Could not read file "../../reference_population/Total_Reference/Total_Reference.bed": Success

It works well if you remove the -l flag, so I tried bedtools intersect to filter the .bam file and then use samtools, but I got the error

Error: Unable to determine type for file ../../reference_population/Total_Reference/Total_Reference.bed

I have tried using both plink 1.07 and plink 1.9 and the result was the same. Can anyone shed a light on this please?

software-error next-gen

1 answer

A plink bed file is a binary PED, not a text BED - totally different... See the UCSC page for the format.

That explains a lot... Thanks! I think I would have spent another week or so searching what was going wrong xD

Log in to answer this question.