從 fastq 檔擷取樣本
換你來從大量 reads 的序列中取出一小段樣本。
你會使用上一個練習中讀取的同一個檔案。這個檔案包含 500 筆 reads,每筆長度為 50 bp。檔案路徑已儲存在名為 f 的物件中。
使用 FastqSampler(con = file_path, n = length)、set.seed() 和 yield(),你可以從這個序列檔中擷取 100 筆 reads。
本練習屬於課程
R 中的 Bioconductor 入門
練習說明
- 載入
ShortRead。 - 使用
set.seed(),值設為1234。 - 以
FastqSampler()搭配變數f指向的小型 fastq 檔,並選取 100 筆 reads。 - 使用
yield()產生子序列。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Load ShortRead
library(ShortRead)
# Set a seed for sampling
___
# Use FastqSampler with f and select 100 reads
fs <- ___(con = ___, ___ = ___)
# Generate new sample yield
my_sample <- ___
# Print my_sample
___