Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gio79
    Junior Member
    • Nov 2013
    • 2

    #1

    Bam to Fastq on discordant mate pairs

    Hi all!

    I am trying to convert a BAM file from a paired-end alignment back to Fastq (Read1.fq and Read2.fq).

    The BAM file I'm working on actually contains ONLY discordant pairs that have been filtered from the original BAM file (that's because I am interested ONLY in discordant pairs).

    I have tried this on my sorted (-n) bam file:

    bedtools bamtofastq -i alnSORTED.bam -fq read1.fq -fq2 read2.fq

    but I get the following error message:

    Query HISEQ:272AJYACXX:2:1110:4931:73600 is marked as paired, but it's mate does not occur next to it in your BAM file. Skipping.

    So apparently Bedtools skips the discordant pairs...but I need to work only on them!
    Any possible solution?

    Thank you in advance!
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    I'm guessing that you used tophat to do the alignments, it's known to create these sorts of situations (unless you specified --no-mixed, if only one read of a pair is mapped, the unmapped read is excluded from the alignment file). The thing is, the BAM file is telling bedtools that the reads are paired, so it needs to write them as such to the fastq files or else the files will become out of sync (the Nth read in read1.fq needs to be the mate of the Nth read in read2.fq). If these alignments are from tophat, then you might be to filter the unmapped.bam to extract the missing mates and then just merge them back in.

    If instead you want to treat the reads as single-end, you could just:
    Code:
    samtools view alnSORTED.bam | awk '{OFS="\n"}{print $1,$10,"+",$11}' > reads.fq
    Last edited by dpryan; 11-08-2013, 01:47 AM.

    Comment

    • Gio79
      Junior Member
      • Nov 2013
      • 2

      #3
      Hi dpryan,

      The bam file was produced with bwa-mem.
      For this original BAM file, flagstat counted something around 600.000 discordant mate pairs ("with mate mapped on different chromosome"), that I then filtered out in a new BAM file containing exclusively such pairs, so I have no "unmapped.bam"!

      I will try to use the data by ignoring the pairing information and see what happens...
      thanks and best regards!

      Comment

      • dpryan
        Devon Ryan
        • Jul 2011
        • 3478

        #4
        Ah, if this was done with bwa-mem then these are chimeric alignments. I'm not surprised that bedtools doesn't yet deal with them.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
          by SEQadmin2




          NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification, detection...
          Today, 06:46 AM
        • SEQadmin2
          Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
          by SEQadmin2



          Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

          Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
          ...
          10-14-2026, 09:55 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-28-2026, 09:57 AM
        0 responses
        24 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-28-2026, 09:51 AM
        0 responses
        15 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 11:13 AM
        0 responses
        68 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 10:48 AM
        0 responses
        48 views
        0 reactions
        Last Post SEQadmin2  
        Working...