trim3q_filter: Filter sequences with low quality in 3' tails

Description Usage Arguments Value Author(s) Examples

View source: R/trim3q_filter.R

Description

The program removes from the 3' tails of the sequences a set of nucleotides showing a quality < a threshold value in a ShortReadQ object

Usage

1
2
trim3q_filter(input, rm.3qual, q_format = NULL, check.encod = TRUE,
  remove_zero = TRUE)

Arguments

input

ShortReadQ object

rm.3qual

Quality threshold for 3' tails

q_format

Quality format used for the file, as returned by check_encoding

check.encod

Check the encoding of the sequence? This argument is incompatible with q_format. Default TRUE

remove_zero

Remove zero-length sequences?

Value

Filtered ShortReadQ object

Author(s)

Leandro Roser learoser@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require('Biostrings')
require('ShortRead')

# create 6 sequences of width 20
set.seed(10)
input <- random_seq(6, 20)

# create qualities of width 15 and paste to qualities
# of length 5 used for the tails.
# for two of the sequences, put low qualities in tails

set.seed(10)
my_qual <- random_qual(c(30,40), slength = 6, swidth = 15, 
encod = 'Sanger')

set.seed(10)
tails <-   random_qual(c(30,40), slength = 6, swidth = 5, 
 encod = 'Sanger')
 
set.seed(10)
tails[2:3] <- random_qual(c(3, 20), slength = 2, 
swidth = 5,  encod = 'Sanger')
my_qual <- paste0(my_qual, tails)
input_q <- BStringSet(my_qual)
# create names
input_names <- seq_names(6)

# create ShortReadQ object
my_read <- ShortReadQ(sread = input,
quality = input_q, id = input_names)

# apply the filter 
filtered <- trim3q_filter(my_read, rm.3qual = 28)

# look at the trimmed sequences
sread(filtered)

FastqCleaner documentation built on Nov. 8, 2020, 5:05 p.m.