Thank you! I know many people just includes codes from samtools or picard. But that needs includes many files. I just want to take position, sequence and error information from bamfile. I try to write very simple codes by myself.
I have read the bam format from http://samtools.github.io/hts-specs/SAMv1.pdf
I am confused why I can not read bam file correctly.
It works! Thank you so much!