Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BAM speed: i/o, uncompress, etc.

    Is anybody familiar with the relative speeds of .bam file i/o and decompression? My algorithm is bottlenecking when I try to load reads from a .bam file.

    Using BAMTools, I jump to certain, specific locations in the genome, and load the reads in a small region there (this involves decompression). I do this many, many times, loading many reads.

    I am thinking it may be more efficient to create a mini-BAM file (only the regions of concern), then load this into memory (cache it), and then search and load the reads. But will the required decompressing from the compressed .bam format still make things too slow?

  • #2
    What data structure are you using to store the "loaded reads"?
    Seeking to an indexed bam file, reading in and uncompromising the data should not be a big problem.

    Comment


    • #3
      You could try using an uncompressed BAM file (use the samtools view -u option), and see if that helps.

      Also does BAMtools attempt to cache any of the data to avoid repeated reading and decompressing the same BGZF blocks?

      Comment


      • #4
        Originally posted by Richard Finney View Post
        What data structure are you using to store the "loaded reads"?
        Seeking to an indexed bam file, reading in and uncompromising the data should not be a big problem.
        I am using the BamTools::BamAlignment data structure (std::string for qualities, read name, sequence, etc. bunch of ints and some bools)

        Comment


        • #5
          If you're on a linux box I'd advise "strace -o trace.out -T program args" to list the system calls and times taken. This can help a lot in seeing what takes up the time.

          Generally random access is always going to be slow as disk seeks are typically slow. Some filesystems are better than others here too. Ultimately if you're doing a LOT of random access it may prove faster to copy it off a slow storage and onto something quick before doing the random I/O, eg a solid-state drive, or at the very least /tmp so the OS can do a better job of caching local data without making assumptions on networked I/O.

          A quick test: is it faster to do a full "samtools view filename.bam > /dev/null" than to do your random I/O? If so then seeking is probably your bottleneck.

          Do you have the option to sort the random access prior to running the algorithm? I.e. to ensure the small portions you're reading are always sequential.

          Comment


          • #6
            I/O is a big bottleneck. I would not recommend using uncompressed SAMs because then you have even more data to move around. Is your tool parallelized? If so BAM reading could be a bottleneck because bamtools implements its IO serially.

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Recent Advances in Sequencing Analysis Tools
              by seqadmin


              The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
              05-06-2024, 07:48 AM
            • seqadmin
              Essential Discoveries and Tools in Epitranscriptomics
              by seqadmin




              The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
              04-22-2024, 07:01 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 07:03 AM
            0 responses
            15 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 05-10-2024, 06:35 AM
            0 responses
            36 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 05-09-2024, 02:46 PM
            0 responses
            43 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 05-07-2024, 06:57 AM
            0 responses
            38 views
            0 likes
            Last Post seqadmin  
            Working...
            X