I am trying to use htseq-count on both files in which the mates are mapped and files in which the mates are not mapped. The files with mapped mates seem to run fine but the one without mates always come up with an error such as the one below. I've tried separating the reads with unmapped mates using the * in the seventh sam column and using -f 8 in samtools. I am getting the same result either way. Looking at the reads it is complaining about as well as a couple of reads previous I cannot see anything about the read(s) that should precipitate this problem. The particular read involved in the error below is pasted below the error.
Thanks for any help you can offer.
Error occured in line 9165885 of file RWBL1A/RWBL1A_mate_unmapped.sam.
Error: 'pair_alignments' needs a sequence of paired-end alignments
[Exception type: ValueError, raised in init.py:606]
HS2:241:C0W6TACXX:3:1101:10004:129413 153 chr18 72772696 50 16M1075N84M * 0 0 AGGCTCTAAAGGAAAGGGTGGAGAGATTCAACCAGTTAGCGTGAAGGTTGGAGATAAAGTTCTTCTCCCAGAATATGGAGGCACCAAAGTAGTTCTAGAT CDDDDDDDDDDDDDBDEDEFFFFFEHHFHEEHJJJIJJJJJIIJJJJIIJJJJJJJJJJJHIGGIHJJJJIJIIJIJJJJJIGIJJJHHHHHFFFFF@C@ MD:Z:100 XG:i:0 NH:i:1 NM:i:0 XM:i:0 XO:i:0 AS:i:0 XS:A:+
I would expect this error to occur if there is an unpaired read in your SAM file, i.e., a read with flag bit 0 cleared. Could you post the two surrounding lines as well?