different line length in sequence

Error using samtools mpileup

samtools mpileup -uf REFERENCE.fasta SAMPLE_sorted.bam

[fai_load] build FASTA index.

[fai_build_core] different line length in sequence 'REFERENCE'.

Problem

The lines in the reference sequence fasta-file does not have all the same length.

Solutions

(1) Edit manually

Convert the reference sequence into a single line by removing all newlines "\n".

(2) Picard tool

# use Picard to normalize the reference fasta file

java -jar picard.jar NormalizeFasta I=REFERENCE.fasta O=normalized_REFERENCE.fasta

https://gatk.broadinstitute.org/hc/en-us/articles/360037067312-NormalizeFasta-Picard-