bedtools是一款非常強大的用于處理bed,vcf,gff等格式資料的工具,該軟體由猶他大學的Quinlan實驗室開發,但是目前bedtools主要提供的是在linux,unxi等作業系統環境下的“命令列”運行方式,然而,對于想要使用R語言進行bedtools命令操作的科研人員來說就顯得比較麻煩,今天,我就給大家介紹一款由北卡羅來納大學教堂山分校開發的R語言版本的bedtools--bedtoolsr,話不多說,直接上干貨,
- 安裝bedtoolsr
install.packages("devtools")
devtools::install_github("PhanstielLab/bedtoolsr") # 首次使用需要安裝
- 加載bedtoolsr
library(bedtoolsr)
- 生成測驗資料
A.bed <- data.frame(chr = c("chr1", "chr1", "chr3"), start = c(10, 100, 50), end = c(40, 150, 110))
B.bed <- data.frame(chr = c("chr1", "chr5"), start = c(20, 60), end = c(35, 80))
print(A.bed)
# chr start end
#1 chr1 10 40
#2 chr1 100 150
#3 chr3 50 110
print(B.bed)
# chr start end
#1 chr1 20 35
#2 chr5 60 80
- 呼叫方法,這里主要介紹兩種,bedtoolsr的函式跟bedtools的方法幾乎是一一對應的,甚至函式名,引數名幾乎都一樣,因此,可以即便是新手,也可以快速入手bedtoolsr,下面以intersect方法為例,講解呼叫方法,
#呼叫方法一
bt.intersect(a = A.bed, b = B.bed)
#output
# V1 V2 V3
#1 chr1 20 35
#呼叫方法二
bedtoolsr::bt.intersect(a = A.bed, b = B.bed)
#output
# V1 V2 V3
#1 chr1 20 35
#intersect所有引數
# a,
# b,
# wa = NULL,
# wb = NULL,
# loj = NULL,
# wo = NULL,
# wao = NULL,
# u = NULL,
# c = NULL,
# C = NULL,
# v = NULL,
# ubam = NULL,
# s = NULL,
# S = NULL,
# f = NULL,
# F = NULL,
# r = NULL,
# e = NULL,
# split = NULL,
# g = NULL,
# nonamecheck = NULL,
# sorted = NULL,
# names = NULL,
# filenames = NULL,
# sortout = NULL,
# bed = NULL,
# header = NULL,
# nobuf = NULL,
# iobuf = NULL,
# output = NULL
- bedtoolsr中所有的函式
| 函式名 | 函式名 | 函式名 |
|---|---|---|
| bt.annotate | bt.bamtobed | bt.bamtofastq |
| bt.bed12tobed6 | bt.bedpetobam | bt.bedtobam |
| bt.closest | bt.cluster | bt.closest |
| bt.cluster | bt.complement | bt.coverage |
| bt.expand | bt.fisher | bt.flank |
| bt.genomecov | bt.getfasta | bt.groupby |
| bt.igv | bt.intersect | bt.jaccard |
| bt.links | bt.makewindows | bt.map |
| bt.maskfasta | bt.merge | bt.multicov |
| bt.multiinter | bt.nuc | bt.overlap |
| bt.pairtobed | bt.pairtopair | bt.random |
| bt.reldist | bt.sample | bt.shift |
| bt.shuffle | bt.slop | bt.sort |
| bt.spacing | bt.split | bt.subtract |
| bt.summary | bt.tag | bt.unionbedg |
| bt.window |
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/261625.html
標籤:R
