sam2tsv主要可以将sam文件转为tab分割的tsv文件
sam2tsv安装
git clone "https://github.com/lindenb/jvarkit.git"
cd jvarkit
./gradlew sam2tsv
或者使用conda安装
conda install -c hcc jvarkit-sam2tsv
Usage: sam2tsv [options] Files Options: -h, --help print help and exit --helpFormat What kind of help. One of [usage,markdown,xml]. -o, --output Output file. Optional . Default: stdout -r, -R, --reference Indexed fasta Reference file. This file must be indexed with samtools faidx and with picard CreateSequenceDictionary -N, --skip-N Skip 'N' operator Default: false --version print version and exit
使用方法:
java -jar dist/sam2tsv.jar -R genome.fa test.bam
#Read-Name Flag MAPQ CHROM READ-POS0 READ-BASE READ-QUAL REF-POS1 REF-BASE CIGAR-OP
r001 163 30 ref 0 T . 7 T M
r001 163 30 ref 1 T . 8 T M
r001 163 30 ref 2 A . 9 A M
r001 163 30 ref 3 G . 10 G M
r001 163 30 ref 4 A . 11 A M
r001 163 30 ref 5 T . 12 T M
r001 163 30 ref 6 A . 13 A M
r001 163 30 ref 7 A . 14 A M
r001 163 30 ref 8 A . . . I
r001 163 30 ref 9 G . . . I
#sam2tsv can read data from a linux pipe.
samtools view -h input.bam | java -jar dist/sam2tsv.jar