qmean_filter: Filter sequences by their average quality

Description Usage Arguments Value Author(s) Examples

View source: R/qmean_filter.R

Description

The program removes the sequences with a quality lower the 'minq' threshold

Usage

1
qmean_filter(input, minq, q_format = NULL, check.encod = TRUE)

Arguments

input

ShortReadQ object

minq

Quality threshold

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

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
37
require(ShortRead)

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

# create qualities of width 20 
## high quality (15 sequences)
set.seed(10)
my_qual <- random_qual(c(30,40), slength = 15, swidth = 20,
                       encod = 'Sanger')
## low quality (15 sequences)
set.seed(10)
my_qual_2 <-   random_qual(c(5,30), slength = 15, swidth = 20,
                           encod = 'Sanger')

# concatenate vectors
input_q<- c(my_qual, my_qual_2)

# create names
input_names <- seq_names(30)

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

# watch the average qualities
alphabetScore(my_read) / width(my_read)

# apply the filter
filtered <- qmean_filter(my_read, minq = 30)

# watch the average qualities
alphabetScore(my_read) / width(my_read)


# watch the filtered sequences
sread(filtered)

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