I am trying to obtain coverage of a sub sequence in order to predict the accuracy of a contig. At the moment I am using Minimap2 along with a python script to get this done. This is my approach
# obtain mappings
minimap2 -a <refpath> <readspath> > out.txt
Then I wrote a python code to read this file and obtain mappings that lies between [1:j]
i being the start and j being the end of the sequence indices. Also in order to accommodate mismatches from the cigar string I take sum of all the matches and mismatches (certain tolerance yet to be decided). Then the following steps are followed as we would do to get point coverage.
samtools sort out.txt > out.sorted.txt
samtools depth out.sorted.txt > out.txt
However, I am not happy with the results. Because the coverage should be (ideally);
But the observed values are strange. I need help to obtain coverage. Any better ways? Thanks in advance :)