Trying to quickly remove reads samtools flagstat deems as unpaired from BAM file? Thanks.
Have you searched Biostars (use external google search) for past threads? There has to be something available already.
remove unpaired files = reads that are not part of a paired-end experiment ?
samtools view -f 1 -b -o out.bam in.bam
Yes just for BAM files already processed for removal of duplicates (Picard) and ChrM and ChrUN reads.