Hi there. So I'm working with paired sam/bam files, filtering and subsetting them. I have noticed in some step of the filtering I have lost the flag "properly paired" when checking with samtools flagstat. And apparently a software (danpos) is requiring this field in samtools flagstat to be filled.
Is there any way to manually add it? Made a quick look but didn't find anything. I know that they are properly paired because they are coming from a a larger bam file with all properly paired-reads... So I'm getting this from samtools flagstat:
7261380 + 0 in total (QC-passed reads + QC-failed reads)
0 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
7261380 + 0 mapped (100.00% : N/A)
7261380 + 0 paired in sequencing
3630690 + 0 read1
3630690 + 0 read2
0 + 0 properly paired (0.00% : N/A)
7261380 + 0 with itself and mate mapped
0 + 0 singletons (0.00% : N/A)
0 + 0 with mate mapped to a different chr
0 + 0 with mate mapped to a different chr (mapQ>=5)
And I would like to get also 7261380 as properly paired.
Thanks for your feedback!
How did you do the filtering? Please add all code to reproduce. In general
samtools fixmate
can set paired-end flags.Thanks for your answer. I don't have the code for the creation of this file, but I believe the function splitBam in the ATACSeqQC Bioconductor package was used, to get mononucleosome bam files from the whole file. I think it's probably an issue of the tags provided to that function. I have tried samtools fixmate with default parameters but the output is the same, it's not filling the "properly paired" field. Any other suggestion? Thanks for your help
Yes, find out how the file was produced and then check the documentation of the underlying tool/function towards altering flags.