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
        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 on Modified Bases...
        Yesterday, 07:01 AM
      • 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

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      39 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      41 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 09:21 AM
      0 responses
      35 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-04-2024, 09:00 AM
      0 responses
      55 views
      0 likes
      Last Post seqadmin  
      Working...
      X