samtools faidx输出的fai文件格式解析 | fasta转bed | fasta to bed
fai示例:
Sc0000003 2774837 10024730 60 61 Sc0000004 2768176 12845826 60 61 Sc0000005 2756750 15660150 60 61 Sc0000006 2627294 18462857 60 61 Sc0000007 2472379 21133951 60 61 Sc0000008 2452568 23647548 60 61
NAME Name of this reference sequence LENGTH Total length of this reference sequence, in bases OFFSET Offset within the FASTA file of this sequence's first base LINEBASES The number of bases on each line LINEWIDTH The number of bytes in each line, including the newline
http://www.htslib.org/doc/faidx.html
offset比较让人费解,其实就是 bytes starting from zero,文件层次的属性,一般不需要关注。
有时需要将fasta转为bed,就是统计长度就好了,但是利用samtools faidx这个功能,速度奇快,再配合一行Linux命令就搞定。
awk '{print $1, 1, $2}' file | sed -e 's/ /\t/g' > out
一个问题:bam,bed,gtf的位置都是从1开始的吗?