qmean_filter {FastqCleaner} | R Documentation

## Filter sequences by their average quality

### Description

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

### Usage

    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

    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)

[Package FastqCleaner version 1.6.0 Index]