hello everyone!
i am using this command
samtools view -bh -F 2 FILE.bam mt > out.bam
to get the discordant reads(one end aligns to mitochondria and the other to chromosome) and also those reads that align to (both ends) mitochondria only. out put file is a bam file. but when i want get fastq out of this bam file using command
bamToFastq -i out.bam -fq out.1.fq -fq2 out.2.fq
it shows that there are so many reads that are marked as pairs but the but the other pair is not in the bam file. the error looks like this
*WARNING: Query HWI-ST170_235:2:22:12110:179082#0 is marked as paired, but it's mate does not occur next to it in your BAM file. Skipping.
can anyone plz tell what,s going wrong.
I also had this error message, and the problem in my case was that my bam file wasn't sorted by read names. To fix the issue I did the following:
1. Sort your bam file by read names:
Note: if you now examine your new bam file (
samtools view myBamFile.sortedByName | less -S
), you should see that it is sorted by read names and that read pairs are next to each other.2. Run bamtofastq on your new bam file
This answer is wrong and doesn't work. Don't use it.
Hi, I sorted my unmapped .bam files using samtools and got the my_file_unmapped.qsort files using the command $ samtools sort -n my_file_unmapped.bam -o my_file_unmapped.qsort -O BAM But, now when I am trying to run bedtools bamtofastq, it is returning similar warning, WARNING: Query is marked as paired, but its mate does not occur next to it in your BAM file.
I am getting this same warning message on namesorted BAM file. I think the issue has to do with multi-mapping reads. bedtools seems to be giving a warning for any multi-mapping read that isn't immediately adjacent to its paired read (like a multi-mapper next to another line with itself mapped to another genomic location). It does look like the reads are ending up in the FASTQ file when both pairs are present, but these warning messages are pretty annoying. I'm guessing this is a bug (/feature) in bedtools.
Not sure this has to do with multi-mapping reads. I've tried filtering out multimapping reads from bwa-generated bams (samtools view -bq 1 bam_file) but the issue recurs regardless.
I had this issue and it turned out to just be multimapped reads which produced the error.
Did it affect the bamtofastq output file? if so how did you solve the problem? Thanks