Header Leaderboard Ad

Collapse

samtools mpipeup error: different line length in sequence 'chr1'.

Collapse

Announcement

Collapse

SEQanswers June Challenge Has Begun!

The competition has begun! We're giving away a $50 Amazon gift card to the member who answers the most questions on our site during the month. We want to encourage our community members to share their knowledge and help each other out by answering questions related to sequencing technologies, genomics, and bioinformatics. The competition is open to all members of the site, and the winner will be announced at the beginning of July. Best of luck!

For a list of the official rules, visit (https://www.seqanswers.com/forum/sit...wledge-and-win)
See more
See less
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • samtools mpipeup error: different line length in sequence 'chr1'.

    hi,
    I am new about samtools and bioinformatics, these days I try to call an SNP using bwa and samtools.everything went well, but at the last step, there is an error:
    [fai_load] build FASTA index.
    [fai_build_core] different line length in sequence 'chr1'.
    [afs] 0:0.000
    and my command is : samtools mpileup -uf ref.fa input.rmdup.bam |bcftools view -vcg ->test.raw.vcf
    This is probably a dumb question, but what could be causing this?

    thanks

  • #2
    hi mihuzx ,
    Did you sort & index the bam file before going to mpileup by using

    samtools sort aln.bam aln.sorted
    samtools index aln.sorted.bam

    Comment


    • #3
      Originally posted by mihuzx View Post
      hi,
      I am new about samtools and bioinformatics, these days I try to call an SNP using bwa and samtools.everything went well, but at the last step, there is an error:
      [fai_load] build FASTA index.
      [fai_build_core] different line length in sequence 'chr1'.
      [afs] 0:0.000
      and my command is : samtools mpileup -uf ref.fa input.rmdup.bam |bcftools view -vcg ->test.raw.vcf
      This is probably a dumb question, but what could be causing this?

      thanks
      The "different line length" error will generally mean that some of the lines in your reference sequence are longer/shorter than others. It's OK for the last line of a chromosome/contig to be shorter, but the others need to be the same length. If you're curious why this is the case, it's result of how indexing and random seeking of fasta files by samtools works (basically, the index gives the length of the chromosome, the number of nucleotides in each line and a chromosome offset, which is sufficient to calculate a offset position in a file for seeking). The solution, then is to just fix the fasta file. The "NormalizeFasta" command from Picard tools should be able to due this.

      Comment


      • #4
        Originally posted by dpryan View Post
        The "different line length" error will generally mean that some of the lines in your reference sequence are longer/shorter than others. It's OK for the last line of a chromosome/contig to be shorter, but the others need to be the same length. If you're curious why this is the case, it's result of how indexing and random seeking of fasta files by samtools works (basically, the index gives the length of the chromosome, the number of nucleotides in each line and a chromosome offset, which is sufficient to calculate a offset position in a file for seeking). The solution, then is to just fix the fasta file. The "NormalizeFasta" command from Picard tools should be able to due this.
        thanks for your advice. this is the exact solution to my problem.
        thanks to everyone.

        Comment

        Latest Articles

        Collapse

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 06-01-2023, 08:56 PM
        0 responses
        8 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 06-01-2023, 07:33 AM
        0 responses
        8 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-31-2023, 07:50 AM
        0 responses
        4 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 05-26-2023, 09:22 AM
        0 responses
        10 views
        0 likes
        Last Post seqadmin  
        Working...
        X