... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: ChIPQC |
2 | 2 |
Type: Package |
3 | 3 |
Title: Quality metrics for ChIPseq data |
4 |
-Version: 1.23.0 |
|
4 |
+Version: 1.23.1 |
|
5 | 5 |
Author: Tom Carroll, Wei Liu, Ines de Santiago, Rory Stark |
6 | 6 |
Maintainer: Tom Carroll <[email protected]>, Rory Stark <[email protected]> |
7 | 7 |
Description: Quality metrics for ChIPseq data. |
... | ... |
@@ -24,11 +24,11 @@ ChIPQC = function(experiment, annotation, chromosomes, samples, |
24 | 24 |
consensus=FALSE, bCount=FALSE, mapQCth=15, blacklist=NULL, |
25 | 25 |
profileWin=400,fragmentLength=125,shifts=1:300,...) { |
26 | 26 |
|
27 |
- if(class(experiment)=="character" || class(experiment)=="data.frame") { |
|
27 |
+ if(sum(class(experiment)=="character") || sum(class(experiment)=="data.frame")) { |
|
28 | 28 |
experiment = dba(sampleSheet=experiment,bCorPlot=FALSE,peakCaller="bed") |
29 | 29 |
} |
30 | 30 |
|
31 |
- if(class(experiment)!="DBA") { |
|
31 |
+ if(!sum(class(experiment)=="DBA")) { |
|
32 | 32 |
stop("experiment must be either a samplesheet filename or a DBA (DiffBind) object.") |
33 | 33 |
} |
34 | 34 |
|
... | ... |
@@ -70,7 +70,7 @@ ChIPQC = function(experiment, annotation, chromosomes, samples, |
70 | 70 |
|
71 | 71 |
if(!missing(annotation)) { |
72 | 72 |
if(!is.null(annotation) && missing(samples)) { |
73 |
- if(class(annotation)!="list") { |
|
73 |
+ if(!sum(class(annotation)=="list")) { |
|
74 | 74 |
message('Compiling annotation...') |
75 | 75 |
annotation = getAnnotation(annotation,AllChr=chromosomes) |
76 | 76 |
} |
... | ... |
@@ -80,7 +80,7 @@ ChIPQC = function(experiment, annotation, chromosomes, samples, |
80 | 80 |
blacklist = makeGRangesFromDataFrame(blacklist,ignore.strand=TRUE) |
81 | 81 |
message("Using default blacklist for hg19...") |
82 | 82 |
} |
83 |
- } else if(class(annotation)=="character") { |
|
83 |
+ } else if(sum(class(annotation)=="character")) { |
|
84 | 84 |
annotation = list(version=annotation) |
85 | 85 |
} else { |
86 | 86 |
annotation = list(version="none") |
... | ... |
@@ -129,10 +129,10 @@ ChIPQC = function(experiment, annotation, chromosomes, samples, |
129 | 129 |
setNull <- TRUE |
130 | 130 |
peaks <- NA |
131 | 131 |
|
132 |
- if(class(consensus) == "GRanges") { |
|
132 |
+ if(sum(class(consensus) == "GRanges")) { |
|
133 | 133 |
useConsensus <- TRUE |
134 | 134 |
} else { |
135 |
- if(class(consensus) == "logical") { |
|
135 |
+ if(sum(class(consensus) == "logical")){ |
|
136 | 136 |
if(consensus == TRUE) { |
137 | 137 |
useConsensus <- TRUE |
138 | 138 |
} else { |
... | ... |
@@ -146,7 +146,7 @@ ChIPQC = function(experiment, annotation, chromosomes, samples, |
146 | 146 |
if(useConsensus == TRUE) { |
147 | 147 |
addcontrols <- TRUE |
148 | 148 |
addconsensus <- TRUE |
149 |
- if(class(consensus) == "GRanges") { |
|
149 |
+ if(sum(class(consensus) == "GRanges")) { |
|
150 | 150 |
peaks <- consensus |
151 | 151 |
setNull <- FALSE |
152 | 152 |
} else { |
... | ... |
@@ -219,7 +219,7 @@ ChIPQC = function(experiment, annotation, chromosomes, samples, |
219 | 219 |
errors = FALSE |
220 | 220 |
for(i in 1:length(samples)) { |
221 | 221 |
sample = samples[[i]] |
222 |
- if(class(sample) != "ChIPQCsample") { |
|
222 |
+ if(!sum(class(sample) == "ChIPQCsample")) { |
|
223 | 223 |
message("Error in sample ",names(samples)[i],": ",sample[1]) |
224 | 224 |
errors = TRUE |
225 | 225 |
} |
... | ... |
@@ -25,7 +25,7 @@ makeSummarySection <- function(object){ |
25 | 25 |
summarySection <- newSection( "QC Summary" ); |
26 | 26 |
|
27 | 27 |
metrics <- QCmetrics(object) |
28 |
- if(class(object)=="ChIPQCexperiment"){ |
|
28 |
+ if(sum(class(object)=="ChIPQCexperiment")){ |
|
29 | 29 |
metrics <- metrics[,!colnames(metrics) %in% c("ReadLenCC","RIBL","Map%","Filt%","ReadLen")] |
30 | 30 |
allMetadata <- QCmetadata(object) |
31 | 31 |
metadata <- allMetadata[,c("ID","Tissue","Factor","Condition","Replicate")] |
... | ... |
@@ -136,7 +136,7 @@ makeMFDSection <- function(object,riblPlot,gfePlot){ |
136 | 136 |
"Total Dup%", |
137 | 137 |
"Pass MapQ Filter%", |
138 | 138 |
"Pass MapQ Filter and Dup%") |
139 |
- if(class(object)=="ChIPQCexperiment"){ |
|
139 |
+ if(sum(class(object)=="ChIPQCexperiment")){ |
|
140 | 140 |
allMetadata <- QCmetadata(object) |
141 | 141 |
metadata <- allMetadata[,c("ID","Tissue","Factor","Condition","Replicate")] |
142 | 142 |
|
... | ... |
@@ -54,11 +54,11 @@ sampleQC <- function(bamFile,bedFile=NULL,blklist=NULL,ChrOfInterest=NULL,GeneAn |
54 | 54 |
txdb <- NULL |
55 | 55 |
GeneAnnotationTotalSizes <- NULL |
56 | 56 |
|
57 |
- if(class(GeneAnnotation)!="list" & !is.null(GeneAnnotation)) { |
|
57 |
+ if(!sum(class(GeneAnnotation)=="list") & !is.null(GeneAnnotation)) { |
|
58 | 58 |
GeneAnnotation = getAnnotation(GeneAnnotation,AllChr=names(ChrLengths)) |
59 | 59 |
|
60 | 60 |
} |
61 |
- if(class(GeneAnnotation)=="list"){ |
|
61 |
+ if(sum(class(GeneAnnotation)=="list")){ |
|
62 | 62 |
if(length(GeneAnnotation)>1) { |
63 | 63 |
GeneAnnotation <- GeneAnnotation[!names(GeneAnnotation) %in% "version"] |
64 | 64 |
GeneAnnotation <- lapply(GeneAnnotation,function(x)reduce(GetGRanges(x,names(ChrLengths)))) |
... | ... |
@@ -193,7 +193,7 @@ sampleQC <- function(bamFile,bedFile=NULL,blklist=NULL,ChrOfInterest=NULL,GeneAn |
193 | 193 |
}else{ |
194 | 194 |
SSDBL <- NULL |
195 | 195 |
} |
196 |
- if(class(GeneAnnotation)=="list"){ |
|
196 |
+ if(sum(class(GeneAnnotation)=="list")){ |
|
197 | 197 |
#GRangesOfInterestListGA <- GRangesList() |
198 | 198 |
noVersionGeneAnnotation <- GeneAnnotation[!names(GeneAnnotation)=="version"] |
199 | 199 |
GRangesOfInterestListGF <- GRangesList() |
... | ... |
@@ -324,7 +324,7 @@ sampleQC <- function(bamFile,bedFile=NULL,blklist=NULL,ChrOfInterest=NULL,GeneAn |
324 | 324 |
SSDBLAv <- as.numeric(NA) |
325 | 325 |
} |
326 | 326 |
|
327 |
- if(class(GeneAnnotation)=="list" & !is.null(GFCountsMatrix)){ |
|
327 |
+ if(sum(class(GeneAnnotation)=="list") & !is.null(GFCountsMatrix)){ |
|
328 | 328 |
#CountsInFeatures <-vector("list",length=ncol(GFCountsMatrix)) |
329 | 329 |
CountsInFeatures <- as.list(apply(GFCountsMatrix,2,function(x)sum(x,na.rm=TRUE))) |
330 | 330 |
names(CountsInFeatures) <- colnames(GFCountsMatrix) |
... | ... |
@@ -423,15 +423,15 @@ GetGRanges <- function(LoadFile,AllChr=NULL,ChrOfInterest=NULL,simple=FALSE,sepr |
423 | 423 |
# require(Rsamtools) |
424 | 424 |
# require(GenomicRanges) |
425 | 425 |
|
426 |
- if(class(LoadFile) == "GRanges"){ |
|
426 |
+ if(sum(class(LoadFile) == "GRanges")) { |
|
427 | 427 |
RegionRanges <- LoadFile |
428 | 428 |
if(simplify){ |
429 | 429 |
RegionRanges <- GRanges(seqnames(RegionRanges),ranges(RegionRanges)) |
430 | 430 |
} |
431 | 431 |
}else{ |
432 |
- if(class(LoadFile) == "character"){ |
|
432 |
+ if(sum(class(LoadFile) == "character")){ |
|
433 | 433 |
RangesTable <- read.delim(LoadFile,sep=sepr,header=TRUE,comment.char="#") |
434 |
- }else if(class(LoadFile) == "matrix"){ |
|
434 |
+ } else if(sum(class(LoadFile) == "matrix")) { |
|
435 | 435 |
RangesTable <- as.data.frame(LoadFile) |
436 | 436 |
} else{ |
437 | 437 |
RangesTable <- as.data.frame(LoadFile) |
... | ... |
@@ -6,7 +6,7 @@ listadd = function(a,b){ |
6 | 6 |
} |
7 | 7 |
|
8 | 8 |
list2matrix = function(vlist,bNAasZero=TRUE) { |
9 |
- if(class(vlist)=="list"){ |
|
9 |
+ if(sum(class(vlist)=="list")){ |
|
10 | 10 |
maxlen = max(sapply(vlist,length)) |
11 | 11 |
vlist = lapply(vlist,function(x){extend(x,maxlen,bNAasZero)}) |
12 | 12 |
res = matrix(0,maxlen,length(vlist)) |
... | ... |
@@ -16,7 +16,7 @@ list2matrix = function(vlist,bNAasZero=TRUE) { |
16 | 16 |
colnames(res) = names(vlist) |
17 | 17 |
rownames(res) = 1:nrow(res) |
18 | 18 |
return(res) |
19 |
- }else{ |
|
19 |
+ } else { |
|
20 | 20 |
return(vlist) |
21 | 21 |
} |
22 | 22 |
} |