A faidx-indexed FASTA format file or a FASTA format file
2
0
Entering edit mode
9.3 years ago

Hi all,

I have a question about the usage of samtools mpileup, -f. From the samtools documentation (http://samtools.sourceforge.net/samtools.shtml), the option of samtools mpileup, -f, indicates the input is a faidx-indexed reference file in the FASTA format. But I found that many people didn't use the faidx-indexed reference file, e.g., here (http://samtools.sourceforge.net/mpileup.shtml) the author just used a FASTA file, ref.fa, but not a faidx-indexed reference file such as ref.fa.fai:

samtools mpileup -uf ref.fa aln1.bam aln2.bam | bcftools view -bvcg - > var.raw.bcf

However, the author said at the beginning: "Suppose we have reference sequences in ref.fa, indexed by samtools faidx".

My question is what file we should use? ref.fasta.fai or ref.fasta?

Could you please help me with this question? Thank you very much in advance.

Sincerely

SNP • 7.0k views
ADD COMMENT
2
Entering edit mode
9.3 years ago

The fasta file is indexed but what that means is that there is a second file the index that is next to the original file.

So one would list the original file but the programs will access both the original file and this second index file with the same name and with the .fai extension. Confusing but kind of a standard in bioinformatics indexing.

This is because we need to keep the original files in text mode.

ADD COMMENT
0
Entering edit mode

Thank you for your help. But I am still not clear what file I should list in the command line. Do you mean even if I list a FASTA format file in a command line just like this:

samtools mpileup -f ref.fa

The SAMtools works actually on the faidx-indexed file? Thanks.

ADD REPLY
0
Entering edit mode

Yes. The assumption is file is accompanied by file.fai.

ADD REPLY
0
Entering edit mode
9.3 years ago

You should first index the the ref.fa with faidx (to create ref.fa.fai in the same directory as ref.fa), then use ref.fa on the command line for mpileup. Both files are required.

ADD COMMENT

Login before adding your answer.

Traffic: 1976 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6