availableClipModes: availableClipModes

Description Usage Arguments Details Author(s) Examples

View source: R/methods-Misc.R

Description

Clip modes are used to store "views" on the sequence object. They are often used to identify adapter sequences and low-quality "ends" which will be trimmed before further analysis. Storing clipping information instead of clipped sequences is useful for avoiding loss of data while maintaining information about the appropriate nucleotides for down-stream analysis. Each clip mode defines a set of left and right clip points, one set for each read. Clip points are typically included in the SFF file, are generated by the sequence provider and are loaded into the appropriate IRanges object when the SFF file is loaded via readSff. The vendor-generated clip points are not always desireable however, so accomidations for custom clip points are also provided.

Usage

1

Arguments

object

An object of class SffReads or SffReadsQ.

Details

availableClipModes produces a list of clip modes supported by the rSFFreader package and the object being passed to it. These can include:

adapter:

defined in the SFF file, and meant to indicate positions of adapter sequence

quality:

defined in the SFF file, and meant to indicate positions of low-quality regions of the sequence

full:

uses the "interior" of quality and adapter and is the most conservative, equivalant to Roche clip points

raw:

no clipping is applied and full length reads are returned

custom:

clip points set by the user as an IRanges object. (see examples below)

Functions are provided for setting clip mode as well as extracting and setting clip points of each type from a SffReads or SffReadsQ object. The functions for getting/setting clip points all work in the same way and an example is provided in the examples section below. The functions include:

clipMode

gets/sets the adapter clip mode

adapterClip

get/set the adapter clip points as an IRanges object

customClip

get/set the custom clip points as an IRanges object

fullClip

get/set the full clip points as an IRanges object

qualityClip

get/set the quality clip points as an IRanges object

rawClip

get/set the raw clip points as an IRanges object

Currently available clipModes returned by availableClipModes is dependant on the which clipping slots (qualityIR,adapterIR, and customIR) are set (length != 0).

Author(s)

Matt Settles <msettles@uidaho.edu>

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## Load in an example dataset:
sff <- loadIonSampleData()

## Get a list of available clip modes:
availableClipModes(sff)

## Check the current clipMode. It should default to "full":
clipMode(sff)

## full clipping is the most conservative, resulting in shorter reads
hist(width(sff))
summary(width(sff))

## These reads should also be free of adapters although the first base looks suspect:
alphabetByCycle(DNAStringSet(substr(sread(sff), 1,15)), alphabet=c("A","C","T","G"))

cols <- c("green","blue","black","red","darkgrey")
leg <-  c("A","C","T","G","N")
matplot(t(alphabetByCycle(DNAStringSet(substr(sread(sff), 1,15)), alphabet=c("A","C","T","G"))), type="l", lty=1, col=cols)
legend("topright", col=cols, legend=leg, pch=18, cex=.8)

## Compare this to unclipped reads using "raw" mode:
clipMode(sff) <- "raw"
hist(width(sff),breaks=500,col="grey",xlab="Read Length",main="Raw Read Length")

alphabetByCycle(DNAStringSet(substr(sread(sff), 1,15)), alphabet=c("A","C","T","G"))

cols <- c("green","blue","black","red","darkgrey")
leg <-  c("A","C","T","G","N")
matplot(t(alphabetByCycle(DNAStringSet(substr(sread(sff), 1,15)), alphabet=c("A","C","T","G"))), type="l", lty=1, col=cols)
legend("topright", col=cols, legend=leg, pch=18, cex=.8)

## Extract clip points for further analysis:
full.clippoints <- fullClip(sff)

raw.clippoints <- rawClip(sff)

table(start(full.clippoints))
table(start(raw.clippoints))

par(mfrow=c(1,2))
hist(end(full.clippoints))
hist(end(raw.clippoints))

par(mfrow=c(1,1))
## determine how much was trimmed from each read by clipping
barplot(table(end(raw.clippoints) - end(full.clippoints)))

## Custom clip points can also be set using an IRanges object:
customClip(sff) <- IRanges(start = 1, end = 4)
clipMode(sff) <- "custom"
table(counts=as.character(sread(sff)))

msettles/rSFFreader documentation built on May 23, 2019, 7:51 a.m.