Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dawe
    Senior Member
    • Apr 2009
    • 258

    #1

    Looking for best strategy to realign BAM files

    Hi all, I was given a set of BAM files (100 Gb each) that I would like to realign using bwa. Problem is, I would like to have the best speed for doing this.
    At the moment start from chunked fastq files and send a single bwa alignment for each node of my cluster, I achieve good parallelism and speed.
    When starting from BAM files I have two options:
    1- convert BAM to fastq -> split fastq in chunks -> align in the same way
    2- feed bwa with BAM files
    If I go for (2) I cannot really parallelize the whole process, unless I can split bam files into chunks which must contain both pairs for each fragment. The only way to do this, I guess, is to sort by read name my BAM files and then split. I don't have an idea about the time required and the space for the newly sorted file
    If I go for (1) I can use picard SamToFastq but it takes ~25s every 100k reads to convert... each of my BAM files contains 130M reads, it would take more than a week only to convert.

    Does anybody want to spend two cents on this with an advice?
    thanks

    d
  • xied75
    Senior Member
    • Feb 2012
    • 129

    #2
    Is your data PE or SE?

    In fact you can split BAM directly, no matter compressed or not, it was using bgzip format. I believe there are tools for this.

    I would prefer feed BWA BAM files and having multiple BWA instances.

    my two pence.

    dong

    Comment

    • dpryan
      Devon Ryan
      • Jul 2011
      • 3478

      #3
      Yikes, any way you do this will require you to reorder things by read for bwa to run efficiently (I was unaware that one could even directly feed bwa a BAM file). Honestly, I suspect you'd be best off using one of the parallel versions of samtools to sort the monster BAM file by read name. I hope that there's only one alignment reported for each read, otherwise you have to take that into account if you then make a fastq file (maybe bwa knows how to deal with that in a BAM file).

      If you're familiar with programming, you could split the BAM file (don't forget to put a header on each of the split files!) and then sort them on different cluster nodes (not being familiar with how your cluster is made, it may be simpler to just use one of the parallel versions of samtools instead) until eventually merging them.

      Comment

      • dawe
        Senior Member
        • Apr 2009
        • 258

        #4
        Originally posted by xied75 View Post
        Is your data PE or SE?

        In fact you can split BAM directly, no matter compressed or not, it was using bgzip format. I believe there are tools for this.

        I would prefer feed BWA BAM files and having multiple BWA instances.

        my two pence.

        dong
        These are PE data. I've started a bwa realignment directly from BAM, using bwa threads in alignment. sampe step will take ages, though...
        thanks

        d

        Comment

        • xied75
          Senior Member
          • Feb 2012
          • 129

          #5
          Originally posted by dawe View Post
          These are PE data. I've started a bwa realignment directly from BAM, using bwa threads in alignment. sampe step will take ages, though...
          thanks

          d
          Yes because sampe is single thread no matter how powerful your machine is and one instance will eat >6GB memory so making run multiple instances also difficult unless you have 128GB something.

          Turn on -P will eat more memory, but should run faster.

          My Windows bwa can do multithread sampe, I suggested people could use my way to modify the Linux version, seems nobody interested to take on this job. If I could have some free time I might do it myself.

          Best,

          dong

          Comment

          Latest Articles

          Collapse

          • SEQadmin2
            Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
            by SEQadmin2



            CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

            Despite this, “CRISPR helped turn genome editing from a specialized technique into
            ...
            07-31-2026, 11:01 AM
          • SEQadmin2
            Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
            by SEQadmin2


            Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

            The systematic characterization of the human proteome has
            ...
            07-20-2026, 11:48 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Yesterday, 10:35 AM
          0 responses
          7 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 08-06-2026, 07:41 AM
          0 responses
          25 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 08-03-2026, 10:13 AM
          0 responses
          45 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-31-2026, 02:55 AM
          0 responses
          48 views
          0 reactions
          Last Post SEQadmin2  
          Working...