Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Changing BAM header makes BAMs "unindexable"

    Hi,
    I'm working with GTEx RNA-Seq BAM files. Their general trouble is that somehow many of them if not all have different headers. The differences are only in the number of those elements like GL000195.1 etc.
    Different headers lead to inability of several programs to work with the batch of such BAMs.
    I focus only in a couple of genes on one chromosome. So I decided to filter only the reads mapped to the genomic region of interest. Then I changed the headers of the new filtered BAMs via 'samtools reheader' removing all that GL000... lines. As a result, all the new BAMs have the same header in terms of @SQ lines. And here is a problem. I can't index these BAMs. Samtools simply produces one line of output: Segmentation fault.
    I have two questions:
    1) Could you advise me how to get indexed BAMs with the uniform (@SQ lines) headers.
    2) I don't understand why samtools couldn't index reheaded BAMs? Even if I keep in such BAMs only those reads that were mapped only to chr5 to the specific gene. What might cause a problem if in the alignment info for every read in these reheaded BAMs there are no information at all about any GL... elements (or, actually, any other chromosomes). What is so critical in the header @SQ lines for other elements that are not represented among the reads in the BAMs?

    Thanks!

  • #2
    The problem itself was solved by converting BAM->SAM->cat header SAM->new BAM (not convenient but at least something). But the question still remains.

    Comment


    • #3
      You can't just arbitrarily remove entries in the header and have it work. Alignments in a BAM file don't directly store the name of the chromosome/contig to which they align. Instead, they store an index that says, "I map to the 15th entry in the header" and things like that. So, if you shorten the header such that it only has 14 entries then the program is going to crash.

      samtools reheader should probably always display a big warning stating, "You're probably going to screw your file up! Are you sure you know what you're doing?", since it's very easy to mess things up by using it.

      Comment


      • #4
        Don't touch the @SQ lines unless you thoroughly understand the BAM structure.

        Comment


        • #5
          Thank you for the explanation!
          But if I convert a BAM file to SAM format and then change a header and then convert it back to BAM format I will get a correct file, right?

          Comment

          Latest Articles

          Collapse

          • seqadmin
            Current Approaches to Protein Sequencing
            by seqadmin


            Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
            04-04-2024, 04:25 PM
          • seqadmin
            Strategies for Sequencing Challenging Samples
            by seqadmin


            Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
            03-22-2024, 06:39 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          17 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          22 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-04-2024, 09:00 AM
          0 responses
          46 views
          0 likes
          Last Post seqadmin  
          Working...
          X