matching: Remove left and right full and partial patterns

Description Usage Arguments Value Author(s) Examples

Description

This set of programs are internal, and the function adapter_filter is recommended for trimming. The programs can remove adapters and partial adapters from 3' and 5'. The adapters can be anchored or not. When indels are allowed, the error rate consists in the edit distance. IUPAC simbols are allowed. The methods use the trimLRPatterns function of the Biostrings package, with some additions to take into account e.g., partial adaptors. IUPAC symbols are allowed in all the cases. The present function also removes partial adapters, without the need of additional steps (for example, creating a padded adapter with 'Ns', etc). A similar result to the output of trimLRPatterns can be obtained with the option anchored = TRUE. When several matches are found, the function removes the subsequence that starts in the first match when cutRseq is used, or ends in the last match when cutLseq is used.

Usage

1
2
3
4
5
6
7
cutRseq(subject, Rpattern, with.indels = FALSE, fixed = "subject",
  error_rate = 0.2, anchored = TRUE, ranges = FALSE, checks = TRUE,
  min_match_flank = 2L, ...)

cutLseq(subject, Lpattern, with.indels = FALSE, fixed = "subject",
  error_rate = 0.2, anchored = TRUE, ranges = FALSE,
  min_match_flank = 3L, checks = TRUE, ...)

Arguments

subject

DNAString or DNAStringSet object

Rpattern

3' pattern, DNAString object

with.indels

Allow indels?

fixed

Parameter passed to trimLRPatterns Default 'subject', ambiguities in the pattern only are interpreted as wildcard. See the argument fixed in trimLRPatterns

error_rate

Error rate (value in [0, 1]). The error rate is the proportion of mismatches allowed between the adapter and the aligned portion of the subject. For a given adapter A, the number of allowed mismatches between each subsequence s of A and the subject is computed as: error_rate * L_s, where L_s is the length of the subsequence s.

anchored

Can the adapter or partial adapter be within the sequence? (anchored = FALSE) or only in the terminal regions of the sequence? (anchored = TRUE). Default TRUE (trim only flanking regions)

ranges

Return ranges? Default FALSE

checks

Perform internal checks? Default TRUE

min_match_flank

Do not trim in flanks of the subject, if a match has min_match_flank of less length. Default 1L (only trim with >=2 coincidences in a flank match)

...

additional parameters passed to trimLRPatterns

Lpattern

5' pattern, DNAString object

Value

Edited DNAString or DNAStringSet 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
library(Biostrings)

subject <- DNAStringSet(c('ATCATGCCATCATGAT',
'CATGATATTA', 'TCATG', 'AAAAAA', 'AGGTCATG'))

Lpattern <- Rpattern <- 'TCATG'

FastqCleaner:::cutLseq(subject, Lpattern)
FastqCleaner:::cutLseq(subject, Lpattern, ranges = TRUE)
FastqCleaner:::cutRseq(subject, Rpattern)


FastqCleaner:::cutLseq(subject, Lpattern, anchored = FALSE)
FastqCleaner:::cutLseq(subject, Lpattern,  error_rate = 0.2)
FastqCleaner:::cutLseq(subject, Lpattern,  error_rate = 0.2, 
with.indels = TRUE)

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