Is there a way to do this with picard or GATK itself? I'd love to stay away from samtools if I could.
I am playing with GATK but the web site states fai as the ref file format however I have access to reference alignments as maf files. Can you help me with this?
4 answers
Purely for my future self if I google this again, the columns of a .fai file appear to be:
- chromosome name
- chromosome length
- offset of the first base of the chromosome sequence in the file
- length of the fasta lines
- some other length of the fasta lines called "line_blen" in the source code? Appears to typically (for me) be length of fasta line + 1.
ETA: Oh, Pierre already answered this over here. blen is number of bytes in each fasta line.
The FAIDX file is created by samtools faidx. The FAIDX file contains, among other things, the
- name of the reference sequence (chr1, chr2...)
- the offset of the first base of this sequence in the file
- the length of the FASTA lines
with this information, samtools can quickly access any region of the genome.
See also this post I wrote about faidx
Dear Pierre,
So if I understand right - if I need bed file from my fa.fai I can do just
awk 'OFS="\t" {print $1,$3,$2}' in.fai
? Thank you so much.
HTSlib has provided a manual page describing this format for a few years now. See man 5 faidx, also on the web at faidx(5) manual page.
Log in to answer this question.