Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adrian
    Member
    • Oct 2009
    • 90

    #1

    samtools mpileup segmentation fault

    hi:

    I clearly do not understand behavior of samtools mpileup. it is frustrating at times for not knowing the exact reasons for segmentation fault.

    1. is seg-fault in mpileup related to a bam file? If so how do I know why it segfaults?

    here is my segfault:
    samtools mpileup -d 100000 -f hg19.fasta -g bc1.bam | bcftools view -e -g -c -v -N -i -1 -I -

    (here I clearly gave -I -- to avoid indels)

    chr3 10183782 . T G 5.29 . // info truncated///
    [afs] 0:1003.293 1:3.825 2:8.882
    Segmentation fault


    2. I take a different bam file and enforce -I -- I get segfault with a different message. In a previous analysis this bam file went through bcftools pipe.

    [bcf_sync] incorrect number of fields (6 != 5) at 2:10191496
    [afs] 0:1438.765 1:13.635 2:23.601
    Segmentation fault


    Is this due to corrput bcftools or samtools.




    3. Cannot exactly understand the reason for segfault in both 1 and 2.


    Is this because I have some problem in bam file or bcftools got corrputed somehow?

    This bam is generated through (PGM) tmap aligner.



    thanks for your help.

    -Adrian
  • yina
    Junior Member
    • Jul 2009
    • 6

    #2
    Notice that it´s necesary to sort the bam file before calling the pileup:

    samtools sort alignment.bam > alignment.sort

    hope it helps
    Last edited by yina; 05-24-2012, 10:25 AM.

    Comment

    • swbarnes2
      Senior Member
      • May 2008
      • 910

      #3
      Rather than piping into bcftools, why don't you try just making a pileup file. Then you'll know whether or not bcftools is respnsible.

      One quick thing worth checking: remake the reference index with samtools faidx, and confirm that it gets made with no error. mpileup will check to see if the file exists, and it will make it if it doesn't see a file with the right name, but if the index file was made wrongly, mpileup won't know what to do.

      Comment

      • bioman1
        Member
        • May 2012
        • 80

        #4
        Hi,
        I think first you can create mpileup file without error and then try for bcftools.
        Follows these steps

        1.samtools faidx reference.fa (this will produce reference.fai file)
        2.samtools import reference.fai sample.sam sample.sam.bam
        3.samtools sort sample.sam.bam sample.sorted.bam
        4.samtools index sample.sorted.bam sample.sorted.bam.bai
        5.samtools mpileup reference.fa sample.sorted.bam.mpileup

        Please be careful in giving file extensions

        For tyring bcfltools you must need both sorted.bam & bam.bai file

        I hope this helps

        Comment

        • swbarnes2
          Senior Member
          • May 2008
          • 910

          #5
          Originally posted by bioman1 View Post
          Hi,
          I think first you can create mpileup file without error and then try for bcftools.
          Follows these steps

          1.samtools faidx reference.fa (this will produce reference.fai file)
          2.samtools import reference.fai sample.sam sample.sam.bam
          3.samtools sort sample.sam.bam sample.sorted.bam
          4.samtools index sample.sorted.bam sample.sorted.bam.bai
          5.samtools mpileup reference.fa sample.sorted.bam.mpileup

          Please be careful in giving file extensions

          For tyring bcfltools you must need both sorted.bam & bam.bai file

          I hope this helps
          samtool import is deprecated, and you don't actually need an .bam index to run mpileup. And running sort like that will make a file called sample.sorted.bam.bam. And you forgot to specify a input .bam in your pileup command.

          Comment

          • cmmay1
            Junior Member
            • Jan 2012
            • 1

            #6
            Segmentation error FIX

            When you try the command, samtools faidx ref.fasta
            You may get this error message: [fai_build_core] different line length in sequence 'scaffold50'. Segmentation fault.

            Use sed '/^$/d' myFile > tt to reformat the linebreaks.

            You can reformat text files in the BASH using several SED commands such as cut/sort/replace/find.

            Comment

            • melop
              Member
              • Jan 2012
              • 22

              #7
              I'm extremely annoyed by this problem too.
              The problem seems to have been caused by bcftools when it's trying to convert the uncompressed bcf output from samtools mpileup. This might be caused by some unknown glitches in the bam file. It's extremely hard to pinpoint the problematic read though because usually it takes days to get to that point and when it hangs there's no record of where it stopped. Disabling indel calling by supplying -I seems to solve some but not all "incorrect number of field" error.
              The bottom line is: if there's a glitch in the bam file or the uncompressed bcf output, bcftools should just give a warning, make a record of it instead of failing altogether wasting several days of computation. Someone should improve the source code.

              Comment

              • figo1019
                Member
                • Jun 2012
                • 32

                #8
                Originally posted by melop View Post
                I'm extremely annoyed by this problem too.
                The problem seems to have been caused by bcftools when it's trying to convert the uncompressed bcf output from samtools mpileup. This might be caused by some unknown glitches in the bam file. It's extremely hard to pinpoint the problematic read though because usually it takes days to get to that point and when it hangs there's no record of where it stopped. Disabling indel calling by supplying -I seems to solve some but not all "incorrect number of field" error.
                The bottom line is: if there's a glitch in the bam file or the uncompressed bcf output, bcftools should just give a warning, make a record of it instead of failing altogether wasting several days of computation. Someone should improve the source code.
                I am also fed up of similar error
                [afs] 0:99774.498 1:110.438 2:115.064
                [bcf_sync] incorrect number of fields (4 != 5) at 15:16294867

                Have you found the reason for it . If you can share that that would be a great help

                Regards

                Comment

                • melop
                  Member
                  • Jan 2012
                  • 22

                  #9
                  Unfortunately I haven't found a solution for it. Perhaps try remaking the bam files would help?

                  Originally posted by figo1019 View Post
                  I am also fed up of similar error
                  [afs] 0:99774.498 1:110.438 2:115.064
                  [bcf_sync] incorrect number of fields (4 != 5) at 15:16294867

                  Have you found the reason for it . If you can share that that would be a great help

                  Regards

                  Comment

                  Latest Articles

                  Collapse

                  • SEQadmin2
                    Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                    by SEQadmin2



                    Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                    Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                    ...
                    10-14-2026, 09:55 AM
                  • SEQadmin2
                    New Genomics Technologies Take Aim at Long-Standing Limits
                    by SEQadmin2


                    Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                    We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                    ...
                    09-28-2026, 10:25 AM

                  ad_right_rmr

                  Collapse

                  News

                  Collapse

                  Topics Statistics Last Post
                  Started by SEQadmin2, Yesterday, 11:13 AM
                  0 responses
                  16 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, Yesterday, 10:48 AM
                  0 responses
                  15 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 10-15-2026, 10:52 AM
                  0 responses
                  35 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 10-14-2026, 05:39 AM
                  0 responses
                  42 views
                  0 reactions
                  Last Post SEQadmin2  
                  Working...