I have BAM files in the external hard drive. Want to convert them into BED. Am using
cd /media/amit/LaCie/mdc_work/chigozie/pool1/bam
for x in *.bam ; do
echo "print current:$x";
bedtools bamToBed -i "$x" > "${x%.bam}.bed";
done
echo "done"
it writes the BED files in the directory, but they are all empty. My BEDtools is installed in
/home/amit/miniconda3/bin/bedtools
Can someone tell me where I am going wrong? regards.
Empty
bed
files could be caused bybam
files with no reads. Thebam
files could still have non-zero file size due to headers. Find the number of reads in thebam
file usingsamtools
:or
sambamba
:This should output into STDIN the number of reads in the
bam
file. Both of these could be installed usingconda
, for example like so: