bedtools igv

Tool: bedtools igv (aka bedToIgv)
Version: v2.26.0
Summary: Creates a batch script to create IGV images
at each interval defined in a BED/GFF/VCF file.
Usage: bedtools igv [OPTIONS] -i <bed/gff/vcf>
Options:

  • -path The full path to which the IGV snapshots should be written.
  • (STRING) Default: ./
  • -sess The full path to an existing IGV session file to be
  • loaded prior to taking snapshots.
  • (STRING) Default is for no session to be loaded.
  • -sort The type of BAM sorting you would like to apply to each image.
  • Options: base, position, strand, quality, sample, and readGroup
  • Default is to apply no sorting at all.
  • -clps Collapse the aligned reads prior to taking a snapshot.
  • Default is to no collapse.
  • -name Use the “name” field (column 4) for each image’s filename.
  • Default is to use the “chr:start-pos.ext”.
  • -slop Number of flanking base pairs on the left & right of the image.
    • (INT) Default = 0.
  • -img The type of image to be created.
  • Options: png, eps, svg
  • Default is png.

Notes:
(1) The resulting script is meant to be run from within IGV.
(2) Unless you use the -sess option, it is assumed that prior to
running the script, you’ve loaded the proper genome and tracks.

bedtools merge

Bedtools merge 用于合并位于同一个bed/gff/vcf 文件中的重叠区域。
Bedtools merge [OPTION] –i <bed/gff/vcf>
Options:

  • -S +/- 必须相同(正负)链的区域才合并(软件默认不考虑正负链特征)
  • -n 报告合并的区域数量,没有被合并则1
  • -d 两个独立区域间距小于(等于)该值时将被合并为一个区域(这个参数可能比较实用)
  • -nms 报告被合并区域的名称
  • -scores 报告几个被合并特征区域的scores(sum,min,max,mean,median,mode,antimoe)

合并bed文件的bash小脚本,来自https://www.zxzyl.com/archives/793

  1. #! /bin/bash
  2. # 1)合并所有传入脚本中的bed文件,并生成一个中间文件
  3. cat $@ | sort -k1,1 -k2,2n > bedtools.in.sorted.bed
  4. # 2)合并中间文件,并输出到标准输出流中,供下一步处理
  5. bedtools merge -i bedtools.in.sorted.bed
  6. # 3)删除中间文件
  7. rm bedtools.in.sorted.bed

通过管道灵活的使用bedtools

bedtools中的强大的分析能力来自于将多个工具“链接”在一起的能力,以便用非常少的编程来构建相当复杂的分析。

例如在biostar上有人提问
given a.bam and b.regions.bed. how to get the parts of b.regions.bed that are not covered by a.bam ?

一个得票最高的答案就是使用bedtools来实现:
bedtools genomecov -ibam aln.bam -bga | awk '$4==0' |bedtools intersect -a regions -b - > foo

作者:lakeseafly;链接:https://www.jianshu.com/p/3f9f231072c6

Bedtools宇宙衍生出的几个R语言包

  1. 《bedtoolsr》包

简要教程:R语言版本的bedtools,bedtoolsr

  1. 《valr》包

valr包的说明书:https://cran.r-project.org/web/packages/valr/valr.pdf
文章发表地址:https://f1000research.com/articles/6-1025/v1
刘博(网名:二货潜)对这个R包很欣赏