比對與過濾

R 中的 Bioconductor 入門

Paula Andrea Martinez, PhD.

Data Scientist

重複序列

  • 生物序列在自然界可能重複
  • 建庫過程(PCR)擴增
  • 針對同一樣本重複定序

移除或至少標記重複

  • 全基因體定序或外顯子定序

以門檻標記重複

  • RNA-seq 與 ChIP-seq
R 中的 Bioconductor 入門

srduplicated

library(ShortRead)

# 計算重複,TRUE 代表重複的數量 table(srduplicated(dfqsample))
FALSE  TRUE 
500   500
# 依條件過濾以移除重複 x[fun(x)]
cleanReads <- mydReads[srduplicated(mydReads) == FALSE]

# 再次計算重複 table(srduplicated(cleanReads))
FALSE
500
R 中的 Bioconductor 入門

建立自訂過濾器

srFilter 依條件過濾:x[fun(x)]

過濾範例

library(ShortRead)

# 使用自訂過濾器移除 fqsample 中的 reads # 此過濾器移除短於最小鹼基數的 reads readWidthCutOff <- srFilter(function(x) {width(x) >= minWidth}, name = "MinWidth")
minWidth <- 51
fqsample[readWidthCutOff(fqsample)]
R 中的 Bioconductor 入門

nFilter

library(ShortRead)

# 儲存過濾器,.name 可省略 myFilter <- nFilter(threshold = 10, .name = "cleanNFilter")
# 在讀取時套用過濾器 filtered <- readFastq(dirPath = "data", pattern = ".fastq", filter = myFilter) # 只會取回 N 最多 10 個的 reads filtered
R 中的 Bioconductor 入門

idFilter 與 polynFilter

library(ShortRead)

# id 過濾範例 myFilterID <- idFilter(regex = ":3:1") # 只回傳含有該正則表達式的 id # 可選參數有 .name、fixed、exclude # 在讀取時套用過濾器 filtered <- readFastq(dirPath = "data", pattern = ".fastq", filter = myFilterID)
# 用於移除 poly-A 區段的過濾器 myFilterPolyA <- polynFilter(threshold = 10, nuc = c("A")) # 回傳最多含 10 個連續 A 的序列
# 用於子集過濾 filtered[myFilterPolyA(filtered)]
R 中的 Bioconductor 入門

一起來練習吧!

R 中的 Bioconductor 入門

Preparing Video For Download...