git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ShortRead@33712 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
Package: ShortRead |
2 | 2 |
Type: Package |
3 | 3 |
Title: Base classes and methods for high-throughput short-read sequencing data. |
4 |
-Version: 0.1.51 |
|
5 |
-Author: Martin Morgan |
|
4 |
+Version: 0.1.52 |
|
5 |
+Author: Martin Morgan, Michael Lawrence, Simon Anders |
|
6 | 6 |
Maintainer: Biocore Team c/o BioC user list <bioconductor@stat.math.ethz.ch> |
7 | 7 |
Description: Base classes, functions, and methods for representation of |
8 | 8 |
high-throughput, short-read sequencing data. |
... | ... |
@@ -149,16 +149,14 @@ setClass("AlignedRead", contains="ShortReadQ", |
149 | 149 |
setClass(".Solexa", contains=".ShortReadBase", |
150 | 150 |
representation=representation("VIRTUAL")) |
151 | 151 |
|
152 |
-setClass("SolexaPath", contains=".Solexa", |
|
152 |
+setClass("SolexaPath", contains=c("ExperimentPath", ".Solexa"), |
|
153 | 153 |
representation=representation( |
154 |
- experimentPath="character", |
|
155 | 154 |
dataPath="character", |
156 | 155 |
scanPath="character", |
157 | 156 |
imageAnalysisPath="character", |
158 | 157 |
baseCallPath="character", |
159 | 158 |
analysisPath="character"), |
160 | 159 |
prototype=prototype( |
161 |
- experimentPath=NA_character_, |
|
162 | 160 |
scanPath=NA_character_, |
163 | 161 |
dataPath=NA_character_, |
164 | 162 |
imageAnalysisPath=NA_character_, |
... | ... |
@@ -76,7 +76,9 @@ setGeneric("read454", |
76 | 76 |
standardGeneric("read454")) |
77 | 77 |
|
78 | 78 |
setGeneric("readBaseQuality", |
79 |
- function(dirPath, seqPattern=character(0), prbPattern=character(0), ...) |
|
79 |
+ function(dirPath, |
|
80 |
+ seqPattern=character(0), prbPattern=character(0), |
|
81 |
+ ...) |
|
80 | 82 |
standardGeneric("readBaseQuality"), signature="dirPath") |
81 | 83 |
|
82 | 84 |
setGeneric("length") |
... | ... |
@@ -107,14 +107,17 @@ polyn <- function(nucleotides, n) |
107 | 107 |
x |
108 | 108 |
} |
109 | 109 |
|
110 |
-.make_getter <- function(slots, where=topenv(parent.frame())) { |
|
110 |
+.make_getter <- |
|
111 |
+ function(slots, where=topenv(parent.frame()), verbose=FALSE) |
|
112 |
+{ |
|
111 | 113 |
slots <- .nameAll(slots) |
112 | 114 |
nms <- names(slots) |
113 | 115 |
ok <- !sapply(nms, exists, where) |
114 |
- if (!all(ok)) |
|
116 |
+ if (verbose && !all(ok)) |
|
115 | 117 |
.throw(SRError("InternalError", |
116 | 118 |
"getter '%s' already exists", |
117 | 119 |
paste(nms[!ok], collapse=", "))) |
120 |
+ slots <- slots[ok] |
|
118 | 121 |
for (i in seq_along(slots)) { |
119 | 122 |
func <- eval(substitute(function(object, ...) slot(object, SLOT), |
120 | 123 |
list(SLOT=slots[i]))) |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
setMethod(".srValidity", "ExperimentPath", function(object) { |
2 | 2 |
msg <- NULL |
3 |
- if (length(basePath(object))!=1) |
|
4 |
- msg <- c(msg, "ExperimentPath 'basePath' must be character(1)") |
|
3 |
+ if (length(experimentPath(object))!=1) |
|
4 |
+ msg <- c(msg, "ExperimentPath 'experimentPath' must be character(1)") |
|
5 | 5 |
if (is.null(msg)) TRUE else msg |
6 | 6 |
}) |
7 | 7 |
|
... | ... |
@@ -15,19 +15,30 @@ setMethod(".srValidity", "ExperimentPath", function(object) { |
15 | 15 |
} |
16 | 16 |
|
17 | 17 |
.checkPath <- function(path) { |
18 |
- nm <- deparse(substitute(path)) |
|
19 |
- if (length(path)==0) { |
|
20 |
- warning(nm, " not defined") |
|
21 |
- } else { |
|
22 |
- for (p in path) |
|
23 |
- if (!file.exists(p)) |
|
24 |
- warning(nm, " '", p, "' does not exist") |
|
25 |
- } |
|
18 |
+ nm <- deparse(substitute(path)) |
|
19 |
+ if (length(path)==0) { |
|
20 |
+ warning(nm, " not defined") |
|
21 |
+ } else { |
|
22 |
+ for (p in path) |
|
23 |
+ if (!file.exists(p)) |
|
24 |
+ warning(nm, " '", p, "' does not exist") |
|
25 |
+ } |
|
26 | 26 |
} |
27 | 27 |
|
28 |
-.make_getter(slotNames("ExperimentPath")) |
|
28 |
+ExperimentPath <- function(experimentPath, ...) { |
|
29 |
+ new("ExperimentPath", basePath=experimentPath, ...) |
|
30 |
+} |
|
29 | 31 |
|
30 |
-setMethod("show", "ExperimentPath", function(object) { |
|
32 |
+experimentPath <- basePath <- function(object, ...) { |
|
33 |
+ slot(object, "basePath") |
|
34 |
+} |
|
35 |
+ |
|
36 |
+basePath <- function(object, ...) { |
|
37 |
+ .Deprecated("experimentPath") |
|
38 |
+ experimentPath(object, ...) |
|
39 |
+} |
|
40 |
+ |
|
41 |
+.show_additionalPathSlots <- function(object) { # for derived classes |
|
31 | 42 |
catPath <- function(nm) { |
32 | 43 |
vals <- do.call(nm, list(object)) |
33 | 44 |
vals <- substr(basename(vals), 1, 15) |
... | ... |
@@ -35,20 +46,26 @@ setMethod("show", "ExperimentPath", function(object) { |
35 | 46 |
sep="") |
36 | 47 |
cat(nm, ": ", paste(vals, collapse=", "), "\n", sep="") |
37 | 48 |
} |
38 |
- callNextMethod() |
|
39 |
- cat("basePath: ", basePath(object), "\n", sep="") |
|
40 | 49 |
slts <- slotNames(object) |
41 | 50 |
for (slt in slts[slts!="basePath"]) catPath(slt) |
51 |
+} |
|
52 |
+ |
|
53 |
+setMethod("show", "ExperimentPath", function(object) { |
|
54 |
+ callNextMethod() |
|
55 |
+ cat("experimentPath: ", experimentPath(object), "\n", sep="") |
|
42 | 56 |
}) |
43 | 57 |
|
44 |
-setMethod("detail", "ExperimentPath", function(object, ...) { |
|
58 |
+.detail_additionalPathSlots <- function(object) { |
|
45 | 59 |
catPath <- function(nm) { |
46 | 60 |
fnms <- do.call(nm, list(object)) |
47 | 61 |
cat(nm, ":\n ", paste(fnms, collapse="\n "), sep="") |
48 | 62 |
cat("\n") |
49 | 63 |
} |
50 |
- callNextMethod() |
|
51 |
- cat("basePath:\n ", basePath(object), "\n", sep="") |
|
52 | 64 |
slts <- slotNames(object) |
53 | 65 |
for (slt in slts[slts!="basePath"]) catPath(slt) |
66 |
+} |
|
67 |
+ |
|
68 |
+setMethod("detail", "ExperimentPath", function(object, ...) { |
|
69 |
+ callNextMethod() |
|
70 |
+ cat("experimentPath:\n ", experimentPath(object), "\n", sep="") |
|
54 | 71 |
}) |
... | ... |
@@ -62,3 +62,13 @@ setMethod("sampleNames", "RochePath", .sampleNames_RochePath) |
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
setMethod("runNames", "RochePath", .runNames_RochePath) |
65 |
+ |
|
66 |
+setMethod("show", "RochePath", function(object) { |
|
67 |
+ callNextMethod() |
|
68 |
+ .show_additionalPathSlots(object) |
|
69 |
+}) |
|
70 |
+ |
|
71 |
+setMethod("detail", "RochePath", function(object, ...) { |
|
72 |
+ callNextMethod() |
|
73 |
+ .detail_additionalPathSlots(object) |
|
74 |
+}) |
... | ... |
@@ -15,13 +15,13 @@ setMethod(".srValidity", "SolexaPath", function(object) { |
15 | 15 |
} |
16 | 16 |
|
17 | 17 |
SolexaPath <- function(experimentPath, |
18 |
- dataPath=.solexaPath(experimentPath, "Data"), |
|
19 |
- scanPath=.solexaPath(dataPath, "GoldCrest"), |
|
20 |
- imageAnalysisPath=.solexaPath(dataPath, "^C"), |
|
21 |
- baseCallPath=.solexaPath(imageAnalysisPath, |
|
22 |
- "^Bustard"), |
|
23 |
- analysisPath=.solexaPath(baseCallPath, |
|
24 |
- "^GERALD"), |
|
18 |
+ dataPath=.solexaPath(experimentPath, "Data"), |
|
19 |
+ scanPath=.solexaPath(dataPath, "GoldCrest"), |
|
20 |
+ imageAnalysisPath=.solexaPath(dataPath, "^C"), |
|
21 |
+ baseCallPath=.solexaPath(imageAnalysisPath, |
|
22 |
+ "^Bustard"), |
|
23 |
+ analysisPath=.solexaPath(baseCallPath, |
|
24 |
+ "^GERALD"), |
|
25 | 25 |
..., verbose=FALSE) { |
26 | 26 |
checkPath <- function(path) { |
27 | 27 |
nm <- deparse(substitute(path)) |
... | ... |
@@ -41,7 +41,8 @@ SolexaPath <- function(experimentPath, |
41 | 41 |
checkPath(baseCallPath) |
42 | 42 |
checkPath(analysisPath) |
43 | 43 |
} |
44 |
- new("SolexaPath", ..., experimentPath=experimentPath, |
|
44 |
+ new("SolexaPath", ..., |
|
45 |
+ basePath=experimentPath, |
|
45 | 46 |
dataPath=dataPath, scanPath=scanPath, |
46 | 47 |
imageAnalysisPath=imageAnalysisPath, baseCallPath=baseCallPath, |
47 | 48 |
analysisPath=analysisPath) |
... | ... |
@@ -107,27 +108,11 @@ setMethod("qa", "SolexaPath", .qa_SolexaPath) |
107 | 108 |
setMethod("report", "SolexaPath", .report_SolexaPath) |
108 | 109 |
|
109 | 110 |
setMethod("show", "SolexaPath", function(object) { |
110 |
- catPath <- function(nm) { |
|
111 |
- vals <- do.call(nm, list(object)) |
|
112 |
- vals <- substr(basename(vals), 1, 15) |
|
113 |
- vals <- paste(vals, ifelse(nchar(vals)==15, "...", ""), |
|
114 |
- sep="") |
|
115 |
- cat(nm, ": ", paste(vals, collapse=", "), "\n", sep="") |
|
116 |
- } |
|
117 | 111 |
callNextMethod() |
118 |
- cat("experimentPath: ", experimentPath(object), "\n", sep="") |
|
119 |
- slts <- slotNames("SolexaPath") |
|
120 |
- for (slt in slts[slts!="experimentPath"]) catPath(slt) |
|
112 |
+ .show_additionalPathSlots(object) |
|
121 | 113 |
}) |
122 | 114 |
|
123 | 115 |
setMethod("detail", "SolexaPath", function(object, ...) { |
124 |
- catPath <- function(nm) { |
|
125 |
- fnms <- do.call(nm, list(object)) |
|
126 |
- cat(nm, ":\n ", paste(fnms, collapse="\n "), sep="") |
|
127 |
- cat("\n") |
|
128 |
- } |
|
129 | 116 |
callNextMethod() |
130 |
- cat("experimentPath:\n ", experimentPath(object), "\n", sep="") |
|
131 |
- slts <- slotNames("SolexaPath") |
|
132 |
- for (slt in slts[slts!="experimentPath"]) catPath(slt) |
|
117 |
+ .detail_additionalPathSlots(object) |
|
133 | 118 |
}) |
134 | 119 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,63 @@ |
1 |
+\name{ExperimentPath-class} |
|
2 |
+\docType{class} |
|
3 |
+\alias{ExperimentPath-class} |
|
4 |
+% constructors |
|
5 |
+\alias{ExperimentPath} |
|
6 |
+% etc |
|
7 |
+\alias{show,ExperimentPath-method} |
|
8 |
+\alias{detail,ExperimentPath-method} |
|
9 |
+ |
|
10 |
+\title{"ExperimentPath" class representing a file hierarchy of data |
|
11 |
+ files} |
|
12 |
+ |
|
13 |
+\description{ |
|
14 |
+ |
|
15 |
+ Short read technologies often produce a hierarchy of output files. The |
|
16 |
+ content of the hierarchy varies. This class represents the root of the |
|
17 |
+ file hierarchy. Specific classes (e.g., |
|
18 |
+ \code{\linkS4class{SolexaPath}}) represent different technologies. |
|
19 |
+ |
|
20 |
+} |
|
21 |
+\section{Objects from the Class}{ |
|
22 |
+ |
|
23 |
+ Objects from the class are created by calls to the constructor: |
|
24 |
+ |
|
25 |
+ \code{ExperimentPath(experimentPath)} |
|
26 |
+ |
|
27 |
+ \describe{ |
|
28 |
+ \item{experimentPath}{\code{character(1)} object pointing to the |
|
29 |
+ top-level directory of the experiment; see specific technology |
|
30 |
+ classes for additional detail.} |
|
31 |
+ \item{verbose=FALSE}{(optional) logical vector which, when |
|
32 |
+ \code{TRUE} results in warnings if paths do not exist.} |
|
33 |
+ } |
|
34 |
+ All paths must be fully-specified. |
|
35 |
+} |
|
36 |
+\section{Slots}{ |
|
37 |
+ \code{ExperimentPath} has one slot, containing a fully |
|
38 |
+ specified path to the corresponding directory (described above). |
|
39 |
+ \describe{ |
|
40 |
+ \item{\code{basePath}}{See above.} |
|
41 |
+ } |
|
42 |
+ The slot is accessed with \code{basePath} or \code{experimentPath}. |
|
43 |
+} |
|
44 |
+\section{Extends}{ |
|
45 |
+ Class \code{"\linkS4class{.ShortReadBase}"}, directly. |
|
46 |
+} |
|
47 |
+\section{Methods}{ |
|
48 |
+ Methods include: |
|
49 |
+ \describe{ |
|
50 |
+ |
|
51 |
+ \item{show}{\code{signature(object = "ExperimentPath")}: briefly |
|
52 |
+ summarize the file paths of \code{object}.} |
|
53 |
+ |
|
54 |
+ \item{detail}{\code{signature(object = "ExperimentPath")}: summarize |
|
55 |
+ file paths of \code{object}.} |
|
56 |
+ } |
|
57 |
+} |
|
58 |
+ |
|
59 |
+\author{Michael Lawrence} |
|
60 |
+\examples{ |
|
61 |
+showClass("ExperimentPath") |
|
62 |
+} |
|
63 |
+\keyword{classes} |
... | ... |
@@ -23,6 +23,7 @@ |
23 | 23 |
% FastqQuality |
24 | 24 |
\alias{width,FastqQuality-method} |
25 | 25 |
\alias{show,FastqQuality-method} |
26 |
+\alias{alphabet,FastqQuality-method} |
|
26 | 27 |
\alias{alphabetFrequency,FastqQuality-method} |
27 | 28 |
\alias{alphabetByCycle,FastqQuality-method} |
28 | 29 |
\alias{srsort,FastqQuality-method} |
... | ... |
@@ -109,6 +110,10 @@ |
109 | 110 |
The following methods are defined on specific classes: |
110 | 111 |
|
111 | 112 |
\describe{ |
113 |
+ \item{alphabet}{\code{signature(x = "FastqQuality")}: |
|
114 |
+ Return a character vector of valid quality characters. |
|
115 |
+ } |
|
116 |
+ |
|
112 | 117 |
\item{alphabetFrequency}{\code{signature(stringSet = "FastqQuality")}: |
113 | 118 |
|
114 | 119 |
Apply \code{\link[Biostrings]{alphabetFrequency}} to quality |
... | ... |
@@ -3,7 +3,13 @@ |
3 | 3 |
\alias{IntegerQuality} |
4 | 4 |
\alias{MatrixQuality} |
5 | 5 |
\alias{FastqQuality} |
6 |
+\alias{FastqQuality,BStringSet-method} |
|
7 |
+\alias{FastqQuality,character-method} |
|
8 |
+\alias{FastqQuality,missing-method} |
|
6 | 9 |
\alias{SFastqQuality} |
10 |
+\alias{SFastqQuality,BStringSet-method} |
|
11 |
+\alias{SFastqQuality,character-method} |
|
12 |
+\alias{SFastqQuality,missing-method} |
|
7 | 13 |
|
8 | 14 |
\title{Construct objects indicating read or alignment quality} |
9 | 15 |
\description{ |
... | ... |
@@ -22,7 +28,10 @@ SFastqQuality(quality, ...) |
22 | 28 |
\arguments{ |
23 | 29 |
\item{quality}{An object used to initialize the data |
24 | 30 |
structure. Appropriate objects are indicated in the constructors |
25 |
- above.} |
|
31 |
+ above for Numeric, Integer, and Matrix qualities. For |
|
32 |
+ \code{FastqQuality} and \code{SFastqQuality}, methods are defined |
|
33 |
+ for \code{\linkS4class{BStringSet}}, \code{character}, and |
|
34 |
+ \code{missing}.} |
|
26 | 35 |
|
27 | 36 |
\item{...}{Additional arguments, currently unused.} |
28 | 37 |
} |
... | ... |
@@ -14,6 +14,7 @@ |
14 | 14 |
\alias{alignData} |
15 | 15 |
% Solexa |
16 | 16 |
\alias{experimentPath} |
17 |
+\alias{basePath} |
|
17 | 18 |
\alias{dataPath} |
18 | 19 |
\alias{scanPath} |
19 | 20 |
\alias{imageAnalysisPath} |
... | ... |
@@ -47,6 +48,7 @@ alignQuality(object, ...) |
47 | 48 |
alignData(object, ...) |
48 | 49 |
## Solexa |
49 | 50 |
experimentPath(object, ...) |
51 |
+basePath(object, ...) |
|
50 | 52 |
dataPath(object, ...) |
51 | 53 |
scanPath(object, ...) |
52 | 54 |
imageAnalysisPath(object, ...) |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{qa} |
2 | 2 |
\alias{qa} |
3 |
+\alias{qa,character-method} |
|
3 | 4 |
|
4 | 5 |
\title{Perform quality assessment on short reads} |
5 | 6 |
|
... | ... |
@@ -17,21 +18,20 @@ qa(dirPath, ...) |
17 | 18 |
|
18 | 19 |
\arguments{ |
19 | 20 |
|
20 |
- \item{dirPath}{A character vector or other object locating the data |
|
21 |
- for which quality assessment is to be performed. See help pages for |
|
22 |
- defined methods (by evaluating the example code, below) for details |
|
23 |
- of available methods.} |
|
21 |
+ \item{dirPath}{A character vector or other object (e.g., |
|
22 |
+ \code{\link{SolexaPath}}; see \code{showMethods}, below) locating |
|
23 |
+ the data for which quality assessment is to be performed. See help |
|
24 |
+ pages for defined methods (by evaluating the example code, below) |
|
25 |
+ for details of available methods.} |
|
24 | 26 |
|
25 | 27 |
\item{\dots}{Additional arguments used by methods.} |
26 | 28 |
} |
27 | 29 |
|
28 | 30 |
\details{ |
29 |
- The following general method is defined, in addition to those for |
|
30 |
- specific objects: |
|
31 |
+ The following methods are defined: |
|
31 | 32 |
\itemize{ |
32 | 33 |
\item{ |
33 | 34 |
\code{dirPath="character", pattern="character", type="SolexaExport", ...}}{ |
34 |
- |
|
35 | 35 |
Quality assessment is performed on all files in directory |
36 | 36 |
\code{dirPath} whose file name matches \code{pattern}. The type of |
37 | 37 |
analysis performed is based on the \code{type} argument. |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{report} |
2 | 2 |
\alias{report} |
3 |
+\alias{report,character-method} |
|
3 | 4 |
|
4 | 5 |
\title{Summarize quality assessment results into a report} |
5 | 6 |
|
... | ... |
@@ -29,6 +30,15 @@ report(x, ..., dest = tempfile(), type = "pdf") |
29 | 30 |
report types depend on the type of object \code{x}.} |
30 | 31 |
} |
31 | 32 |
|
33 |
+\details{ |
|
34 |
+ The following methods are defined: |
|
35 |
+ \itemize{ |
|
36 |
+ \item{ |
|
37 |
+ \code{dirPath="character", ..., dest=tempfile(), type="pdf"} |
|
38 |
+ }{This method is used internally} |
|
39 |
+ } |
|
40 |
+} |
|
41 |
+ |
|
32 | 42 |
\value{ |
33 | 43 |
This function is invoked for its side effect; the return value is the |
34 | 44 |
name of the directory or file where the report was created. |