匹配与筛选

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 中的读取 # 此筛选器移除短于最小碱基数的读取 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) # 仅保留最多含 10 个 N 的读取 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...