Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Segmentation Fault sorting a BAM file

    Hi,

    I mapped paired end reads with Bowtie2 to produce a SAM file. Any reason why the following happens???

    I run the following commands:

    samtools view -bS myfile.sam > myfile.bam
    samtools sort myfile.bam myfile.sorted

    I get the following output:


    [samopen] SAM header is present: 25 sequences.
    [bam_sort_core] merging from 87 files...
    [bam_header_read] EOF marker is absent. The input is probably truncated.
    [bam_header_read] bgzf_check_EOF: Invalid argument
    [bam_header_read] invalid BAM binary header (this is not a BAM file).
    Segmentation fault

    Thanks!

  • #2
    One guess is it is running out of space wherever the temporary files are, resulting in a truncated temporary file and thus the EOF marking missing warning.

    Comment


    • #3
      It turns out you were right! Thanks for responding. It was due to a memory issue. However, I got a new error this time.
      After generating the sam file I ran the following codes, the goal being to create a sam file that is namesorted and containing a region of chr4 only.



      Code:
      samtools view -bS myfile.sam > myfile.bam
      samtools sort myfile.bam myfile.sorted
      samtools index myfile.sorted.bam
      samtools view myfile.sorted.bam 'chr4: 1-1000000' -o myfileextracted.sorted.bam
      samtools sort -n myfileextracted.sorted.bam myfile.namesorted
      samtools view myfile.namesorted > myfilenamesorted.sam
      I got the following errors though:


      Code:
      [bam_sort_core] merging from 87 files...
      [bam_header_read] EOF marker is absent. The input is probably truncated.
      [bam_header_read] invalid BAM binary header (this is not a BAM file).
      [bam_sort_core] truncated file. Continue anyway.
      Segmentation fault
      It seems to have gone on to try to write the sorted bam file but the size of the sorted bam file is significantly smaller than the original (17.1 gb vs 14.3 gb). Any thoughts on why this may be happening???

      Comment


      • #4
        This has been discussed before. See this thread: http://seqanswers.com/forums/showthread.php?t=13652

        Originally posted by kjsalimian View Post

        It seems to have gone on to try to write the sorted bam file but the size of the sorted bam file is significantly smaller than the original (17.1 gb vs 14.3 gb). Any thoughts on why this may be happening???

        Comment


        • #5
          A sorted BAM file should be smaller than an unsorted BAM file, however if samtools merge crashed it is quite likely that the file is incomplete.

          One simple check would be to count the number of reads in the input and output BAM files.

          Comment


          • #6
            Originally posted by kjsalimian View Post
            It turns out you were right! Thanks for responding. It was due to a memory issue. However, I got a new error this time.
            After generating the sam file I ran the following codes, the goal being to create a sam file that is namesorted and containing a region of chr4 only.



            Code:
            samtools view -bS myfile.sam > myfile.bam
            samtools sort myfile.bam myfile.sorted
            samtools index myfile.sorted.bam
            samtools view myfile.sorted.bam 'chr4: 1-1000000' -o myfileextracted.sorted.bam
            samtools sort -n myfileextracted.sorted.bam myfile.namesorted
            samtools view myfile.namesorted > myfilenamesorted.sam
            I got the following errors though:


            Code:
            [bam_sort_core] merging from 87 files...
            [bam_header_read] EOF marker is absent. The input is probably truncated.
            [bam_header_read] invalid BAM binary header (this is not a BAM file).
            [bam_sort_core] truncated file. Continue anyway.
            Segmentation fault
            It seems to have gone on to try to write the sorted bam file but the size of the sorted bam file is significantly smaller than the original (17.1 gb vs 14.3 gb). Any thoughts on why this may be happening???
            I got the similar wrong!
            I didn't have [bam_header_read] EOF marker is absent. The input is probably truncated.
            But I directly got
            [bam_header_read] invalid BAM binary header (this is not a BAM file).
            [bam_sort_core] truncated file. Continue anyway.
            Segmentation fault(core dumped)

            could anyone tell me how to deal with this problem! I did another SEQanswers:http://seqanswers.com/forums/showthread.php?t=44875

            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...
              04-22-2024, 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, Yesterday, 10:49 AM
            0 responses
            17 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-25-2024, 11:49 AM
            0 responses
            24 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-24-2024, 08:47 AM
            0 responses
            20 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-11-2024, 12:08 PM
            0 responses
            62 views
            0 likes
            Last Post seqadmin  
            Working...
            X