Get startedGet started for free

Extract a sample from a fastq file

It is your turn to draw a sample piece from a sequence of many reads.

You will use the same file you've read in the previous exercise. This file has 500 reads, each of 50 bp. The file path is stored in an object called f.

Using FastqSampler(con = file_path, n = length), set.seed(), and yield() you can subset 100 reads from your sequence file.

This exercise is part of the course

Introduction to Bioconductor in R

View Course

Exercise instructions

  • Load ShortRead.
  • Use set.seed() with value 1234.
  • Use FastqSampler() with the small fastq file located in f and select 100 reads.
  • Use yield() to generate the sub sequence.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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
___
Edit and Run Code