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
            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, 05-10-2024, 06:35 AM
          0 responses
          20 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 05-09-2024, 02:46 PM
          0 responses
          26 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 05-07-2024, 06:57 AM
          0 responses
          21 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 05-06-2024, 07:17 AM
          0 responses
          21 views
          0 likes
          Last Post seqadmin  
          Working...
          X