Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Fixing BAM file header. Getting "truncated file. Aborting" error

    Hello.

    I have a BAM file that I need to filter and then update the header for.

    These are my commands:

    Code:
    samtools view -@ 32  -h -b -f 2 -T /data/hs37d5.fa \
      -o samp1234.clean.bam \
      bam.files/samp1234.bam \
      1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 X Y MT
    
    samtools view -H samp1234.clean.bam | \
      grep -v -e 'SN:GL' -e 'SN:NC' -e 'SN:hs37d5' \
      > samp1234.corrected.sam
    
    samtools reheader samp1234.corrected.sam \
      samp1234.clean.bam > samp1234.clean.reheaded.bam
    
    samtools sort -@ 32 \
      -o samp1234.clean.reheaded.sorted.bam \
      samp1234.clean.reheaded.bam

    The first 3 commands execute without any problems.
    Using
    Code:
    samtools view -h samp1234.clean.reheaded.bam | less -S
    I can see that the new BAM file does indeed contain the correct header.

    However every time I run the sorting command I get the error message:
    Code:
    samtools sort: truncated file. Aborting
    The samp1234.clean.reheaded.bam file seems to be fine in every regard. I can't seem to find a fault with it .

    Performing the reheading step in place doesn't seem to help nor does the -P option

    Does anyone have a suggestion of what I'm doing wrong?

    In case it helps I'm using samtools version 1.4-5-g692e058 (using htslib 1.4-5-g10bc1a7)

    Thanks in advance for any and all help.

  • #2
    Consider the answer given in this thread: https://www.biostars.org/p/289770/

    Comment


    • #3
      Thanks for pointing me to that post!
      I'm still having issues but I'll work with the suggested command there.

      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, 06:57 AM
      0 responses
      12 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 05-06-2024, 07:17 AM
      0 responses
      16 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 05-02-2024, 08:06 AM
      0 responses
      19 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-30-2024, 12:17 PM
      0 responses
      24 views
      0 likes
      Last Post seqadmin  
      Working...
      X