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
              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-14-2024, 07:03 AM
            0 responses
            24 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 05-10-2024, 06:35 AM
            0 responses
            44 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 05-09-2024, 02:46 PM
            0 responses
            58 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 05-07-2024, 06:57 AM
            0 responses
            45 views
            0 likes
            Last Post seqadmin  
            Working...
            X