美文网首页
samtools 的介绍

samtools 的介绍

作者: 线断木偶人 | 来源:发表于2019-04-19 14:19 被阅读0次

samtools 的文档说明http://www.htslib.org/doc/samtools.html
很详细!

中文介绍:
https://www.cnblogs.com/xiaofeiIDO/p/6805373.html
https://www.jianshu.com/p/15f3499a6469
https://www.plob.org/article/7112.html#viewSource

Program: samtools (Tools for alignments in the SAM format)
Version: 1.9 (using htslib 1.9)

Usage:   samtools <command> [options]

Commands:
  -- Indexing
     dict           create a sequence dictionary file
     faidx          index/extract FASTA
     fqidx          index/extract FASTQ
     index          index alignment

  -- Editing
     calmd          recalculate MD/NM tags and '=' bases
     fixmate        fix mate information
     reheader       replace BAM header
     targetcut      cut fosmid regions (for fosmid pool only)
     addreplacerg   adds or replaces RG tags
     markdup        mark duplicates

  -- File operations
     collate        shuffle and group alignments by name
     cat            concatenate BAMs
     merge          merge sorted alignments
     mpileup        multi-way pileup
     sort           sort alignment file
     split          splits a file by read group
     quickcheck     quickly check if SAM/BAM/CRAM file appears intact
     fastq          converts a BAM to a FASTQ
     fasta          converts a BAM to a FASTA

  -- Statistics
     bedcov         read depth per BED region
     depth          compute the depth
     flagstat       simple stats
     idxstats       BAM index stats
     phase          phase heterozygotes
     stats          generate stats (former bamcheck)

  -- Viewing
     flags          explain BAM flags
     tview          text alignment viewer
     view           SAM<->BAM<->CRAM conversion
     depad          convert padded BAM to unpadded BAM

重点介绍几个

Usage: samtools view [options] <in.bam>|<in.sam>|<in.cram> [region ...]

Options:
  -b       output BAM
  -C       output CRAM (requires -T)
  -1       use fast BAM compression (implies -b)
  -u       uncompressed BAM output (implies -b)
  -h       include header in SAM output
  -H       print SAM header only (no alignments)
  -c       print only the count of matching records
  -o FILE  output file name [stdout]
  -U FILE  output reads not selected by filters to FILE [null]
  -t FILE  FILE listing reference names and lengths (see long help) [null]
  -L FILE  only include reads overlapping this BED FILE [null]
  -r STR   only include reads in read group STR [null]
  -R FILE  only include reads with read group listed in FILE [null]
  -q INT   only include reads with mapping quality >= INT [0]
  -l STR   only include reads in library STR [null]
  -m INT   only include reads with number of CIGAR operations consuming
           query sequence >= INT [0]
  -f INT   only include reads with all  of the FLAGs in INT present [0]
  -F INT   only include reads with none of the FLAGS in INT present [0]
  -G INT   only EXCLUDE reads with all  of the FLAGs in INT present [0]
  -s FLOAT subsample reads (given INT.FRAC option value, 0.FRAC is the
           fraction of templates/read pairs to keep; INT part sets seed)
  -M       use the multi-region iterator (increases the speed, removes
           duplicates and outputs the reads as they are ordered in the file)
  -x STR   read tag to strip (repeatable) [null]
  -B       collapse the backward CIGAR operation
  -?       print long help, including note about region specification
  -S       ignored (input format is auto-detected)
      --input-fmt-option OPT[=VAL]
               Specify a single input file format option in the form
               of OPTION or OPTION=VALUE
  -O, --output-fmt FORMAT[,OPT[=VAL]]...
               Specify output format (SAM, BAM, CRAM)
      --output-fmt-option OPT[=VAL]
               Specify a single output file format option in the form
               of OPTION or OPTION=VALUE
  -T, --reference FILE
               Reference sequence FASTA FILE [null]
  -@, --threads INT
               Number of additional threads to use [0]
将sam文件转换成bam文件
$ samtools view -bS abc.sam > abc.bam
$ samtools view -b -S abc.sam -o abc.bam
#提取比对到参考序列上的比对结果
$ samtools view -bF 4 abc.bam > abc.F.bam
 
#提取paired reads中两条reads都比对到参考序列上的比对结果,只需要把两个4+8的值12作为过滤参数即可
$ samtools view -bF 12 abc.bam > abc.F12.bam
 
#提取没有比对到参考序列上的比对结果
$ samtools view -bf 4 abc.bam > abc.f.bam
 
#提取bam文件中比对到caffold1上的比对结果,并保存到sam文件格式
$ samtools view abc.bam scaffold1 > scaffold1.sam
 
#提取scaffold1上能比对到30k到100k区域的比对结果
$ samtools view abc.bam scaffold1:30000-100000 > scaffold1_30k-100k.sam
 
#根据fasta文件,将 header 加入到 sam 或 bam 文件中
$ samtools view -T genome.fasta -h scaffold1.sam > scaffold1.h.sam

相关文章

  • samtools 的介绍

    samtools 的文档说明http://www.htslib.org/doc/samtools.html很详细!...

  • samtools使用介绍:

    编者按 samtools也是生物信息从业人员必须掌握的一个工具,二代测序几乎每个分析流程等中都要用到samtool...

  • 我用到的Samtools介绍

    记录一下我用到的samtools的用法。 samtools的说明文档:http://samtools.source...

  • samtools常用命令及参数解读

    samtools的说明文档:http://samtools.sourceforge.net/samtools.sh...

  • samtools

    samtools的说明文档:http://samtools.sourceforge.net/samtools.sh...

  • 2019-04-28samtools

    samtools的说明文档:http://samtools.sourceforge.net/samtools.sh...

  • bam文件介绍

    bam 文件介绍 https://samtools.github.io/hts-specs/SAMv1.pdfht...

  • SAM, Sequence Alignment/Map form

    前言 本文介绍了SAM 格式 字段说明, 以及相关术语解释详细介绍参见SAM标准说明http://samtools...

  • 2018-08-10

    $ samtools samtools: error while loading shared libraries...

  • Samtools 命令详解

    samtools 命令详解samtools 常用命令总结samtools view 重要参数释义: -b:输出ba...

网友评论

      本文标题:samtools 的介绍

      本文链接:https://www.haomeiwen.com/subject/hdmqgqtx.html