Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baohua100
    Senior Member
    • Jun 2008
    • 103

    #1

    samtools faidx Segmentation fault

    populus@Rust:~/samtools-0.1.5c_x86_64-linux$ ./samtools faidx /media/Poplar/baohua/genome/poplar_genome.fa
    [fai_build_core] different line length in sequence 'scaffold_28'.
    Segmentation fault

    What's the meaning of defferent line length ?

    It's the standard fasta file.

    I download it from:
    ftp://ftp.jgi-psf.org/pub/JGI_data/P...asked.fasta.gz
  • nilshomer
    Nils Homer
    • Nov 2008
    • 1283

    #2
    Originally posted by baohua100 View Post
    populus@Rust:~/samtools-0.1.5c_x86_64-linux$ ./samtools faidx /media/Poplar/baohua/genome/poplar_genome.fa
    [fai_build_core] different line length in sequence 'scaffold_28'.
    Segmentation fault

    What's the meaning of defferent line length ?

    It's the standard fasta file.

    I download it from:
    ftp://ftp.jgi-psf.org/pub/JGI_data/P...asked.fasta.gz
    Can you verify that every sequence line in the FASTA has the same length?

    Comment

    • webbrewer
      Junior Member
      • Aug 2008
      • 8

      #3
      I am having this same issue. While I have verified that there are lines of different length in the sequence file, however, why should this matter?

      Comment

      • webbrewer
        Junior Member
        • Aug 2008
        • 8

        #4
        This bioperl snippet fixes the fasta:

        Code:
        use Bio::SeqIO;
        $in  = Bio::SeqIO->new(-file => "inputfilename",
                               -format => 'Fasta');
        $out = Bio::SeqIO->new(-file => ">outputfilename",
                               -format => 'Fasta');
        while ( my $seq = $in->next_seq() ) {$out->write_seq($seq); }

        Comment

        • totalnew
          Member
          • Apr 2009
          • 46

          #5
          I had this problem too, my solution was to use unix command to trim and fold the fasta file. You would have to cut the header first, and catenate it with your sorted fasta file. It perfectly solves the problem.

          Writing a shell script may be a good idea to make things easlier.

          Comment

          • maubp
            Peter (Biopython etc)
            • Jul 2009
            • 1544

            #6
            Originally posted by baohua100 View Post
            populus@Rust:~/samtools-0.1.5c_x86_64-linux$ ./samtools faidx /media/Poplar/baohua/genome/poplar_genome.fa
            [fai_build_core] different line length in sequence 'scaffold_28'.
            Segmentation fault

            What's the meaning of defferent line length ?
            I just found the same thing when there are blank lines in the FASTA file. The message "different line length" is very misleading in this case. I'll report this bug.

            Comment

            • lindseyjane
              Member
              • Apr 2009
              • 28

              #7
              Thanks very much webbrewer for your bioperl fix, it worked perfectly.

              Comment

              • maubp
                Peter (Biopython etc)
                • Jul 2009
                • 1544

                #8
                Originally posted by webbrewer View Post
                This bioperl snippet fixes the fasta
                Just for anyone interested here is the Biopython equivalent:

                Code:
                from Bio import SeqIO
                SeqIO.convert("inputfilename.fas", "fasta", "outputfilename.fas", "fasta")
                The convert function returns the number of records if you wanted that information.

                Comment

                • shinout
                  Junior Member
                  • Mar 2011
                  • 1

                  #9
                  I faced the same problem, but solved with webbrewer's code!

                  Originally posted by webbrewer View Post
                  This bioperl snippet fixes the fasta:

                  Code:
                  use Bio::SeqIO;
                  $in  = Bio::SeqIO->new(-file => "inputfilename",
                                         -format => 'Fasta');
                  $out = Bio::SeqIO->new(-file => ">outputfilename",
                                         -format => 'Fasta');
                  while ( my $seq = $in->next_seq() ) {$out->write_seq($seq); }
                  Thanks a lot!

                  Comment

                  • ardmore
                    Member
                    • Jun 2011
                    • 51

                    #10
                    Hello, I have the same problem. I found the last lines in fa file likes:
                    Code:
                    ggttagggtgtggtgtgtgggtgtgtgtgggtgtggtgtgtgtgggtgtg
                    gtgtgtgggtgtgggtgtgggtgtgggtgtgtgggtgtggtgtgtgggtg
                    tggT
                    That means the last line has not the same length with others.
                    My question is that can I manually modify instead of using a software.
                    I don't want to install too many software because of rare usage.

                    Thanks.

                    Comment

                    • michmich
                      Junior Member
                      • Nov 2011
                      • 1

                      #11
                      The problem is that your FASTA file has a blank lines in it.
                      you need to get rid of them!!!

                      you can :g/^$/d in vi/vim editor.

                      Comment

                      • jdjax
                        Member
                        • Dec 2010
                        • 23

                        #12
                        Originally posted by michmich View Post
                        The problem is that your FASTA file has a blank lines in it.
                        you need to get rid of them!!!

                        you can :g/^$/d in vi/vim editor.
                        Hello, I am coming across the same error. However I have tried that Bio script posted above and it did not work stating some error.

                        I then looked at my fasta file in vim and it does not have any blank lines in the file.

                        Does any one have a suggestion of how to fix this problem so that I can use samtools faidx common on my fasta file?

                        Thank you in advance for your help.
                        jdjax
                        Ph.d. Student
                        Åarhus University

                        Comment

                        • jdjax
                          Member
                          • Dec 2010
                          • 23

                          #13
                          Originally posted by jdjax View Post
                          Hello, I am coming across the same error. However I have tried that Bio script posted above and it did not work stating some error.

                          I then looked at my fasta file in vim and it does not have any blank lines in the file.

                          Does any one have a suggestion of how to fix this problem so that I can use samtools faidx common on my fasta file?

                          Thank you in advance for your help.
                          Figured it out on my own.
                          jdjax
                          Ph.d. Student
                          Åarhus University

                          Comment

                          • maubp
                            Peter (Biopython etc)
                            • Jul 2009
                            • 1544

                            #14
                            Originally posted by jdjax View Post
                            Figured it out on my own.
                            For the benefit of future readers, what was it about your FASTA file that faidx was breaking on? You said it wasn't blank lines.

                            Comment

                            • jdjax
                              Member
                              • Dec 2010
                              • 23

                              #15
                              Originally posted by maubp View Post
                              For the benefit of future readers, what was it about your FASTA file that faidx was breaking on? You said it wasn't blank lines.
                              It actually was blank lines. There were two blank lines at the end of my file that caused the problem.
                              jdjax
                              Ph.d. Student
                              Åarhus University

                              Comment

                              Latest Articles

                              Collapse

                              • SEQadmin2
                                Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                                by SEQadmin2



                                CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                                Despite this, “CRISPR helped turn genome editing from a specialized technique into
                                ...
                                07-31-2026, 11:01 AM
                              • SEQadmin2
                                Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                                by SEQadmin2


                                Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                                The systematic characterization of the human proteome has
                                ...
                                07-20-2026, 11:48 AM
                              • SEQadmin2
                                Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                                by SEQadmin2



                                Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                                ...
                                07-09-2026, 11:10 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, 07-31-2026, 02:55 AM
                              0 responses
                              17 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-24-2026, 12:17 PM
                              0 responses
                              15 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-23-2026, 11:41 AM
                              0 responses
                              13 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 07-20-2026, 11:10 AM
                              0 responses
                              25 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...