I filter out unwanted chromosomes or assemblies using:
sambamba view -f bam -F "ref_name =~ /^chr[0-9XY]/" $BAM > $BAMout
This works and removes the reads from those chromosomes. However, when I check the BAM header, there is still a record of the chromosomes/assemblies I filtered out, which is cumbersome since those records will be passed on to downstream tools (like qualimap). Is there a way to set sambamba to remove those header records from which I am filtering out reads ?