Entering edit mode
5.8 years ago
samlambrechts299
▴
170
Dear Biostars,
I have 45 directories, each containing 2500 bam and 2500 bam.bai files. Each bam file represents alignment results from aligning (shotgun metagenomic) sequences to a reference fasta file. Many of the bam files are empty and only contain the header and no matching/aligned reads. Is there a way to remove these bam files that don't contain matching reads?
Cheers,
Sam
Works perfectly! Thank you!
May I suggest to use
samtools view -H ${F}
so only the header will be extracted and inspectioned ?no because there is always a header.