Skip to content

Commit

Permalink
refactored paste(..., sep="") to paste0(...)
Browse files Browse the repository at this point in the history
pdschmid committed Oct 28, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 44b3c19 commit 8d9efde
Showing 37 changed files with 250 additions and 258 deletions.
6 changes: 3 additions & 3 deletions R/02references.R
Original file line number Diff line number Diff line change
@@ -119,10 +119,10 @@ setMethod("buildRefDir", "EzRef", function(.Object, genomeFile, genesFile, genom
genomeInfoList = cleanGenomeFiles(genomeFile, genesFile)
writeXStringSet(genomeInfoList$genomeSeq, .Object@refFastaFile)
ezWriteGff(genomeInfoList$gtf, .Object@refFeatureFile)
cmd = paste(paste("../../../", SAMTOOLS, sep=""), "faidx", .Object@refFastaFile)
cmd = paste0(paste("../../../", SAMTOOLS), "faidx", .Object@refFastaFile)
ezSystem(cmd)
cmd = paste("java -jar", paste("../../../", file.path(PICARD_DIR, "picard-1.119.jar"), sep=""), "CreateSequenceDictionary",
paste("R=", .Object@refFastaFile, sep=""), paste("O=", sub(".fa$", ".dict", .Object@refFastaFile), sep=""))
cmd = paste0("java -jar", paste0("../../../", file.path(PICARD_DIR, "picard-1.119.jar")), "CreateSequenceDictionary",
paste0("R=", .Object@refFastaFile), paste("O=", sub(".fa$", ".dict", .Object@refFastaFile)))
ezSystem(cmd)
setwd(cd)
})
4 changes: 2 additions & 2 deletions R/03plotter.R
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ EzPlotter =
if (ezIsSpecified(file)) {
filename = file
} else {
filename = paste(name, ".png", sep="")
filename = paste0(name, ".png")
}

if (!inherits(plotWidth, "uninitializedField")){
@@ -53,7 +53,7 @@ EzPlotter =
if (ezIsSpecified(file)) {
filename = file
} else {
filename = paste(name, ".pdf", sep="")
filename = paste0(name, ".pdf")
}

if (!inherits(plotWidth, "uninitializedField")){
4 changes: 2 additions & 2 deletions R/app-BamPreview.R
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@ ezMethodBamPreview = function(input=NA, output=NA, param=NA, htmlFile="00index.h
}

bamMeta = input$meta[ , !input$columnHasTag("File")]
bamMeta[["BAM [File]"]] = paste(cwd, "/", input$getNames(), "/", input$getNames(), ".bam", sep="")
bamMeta[["BAI [File]"]] = paste(cwd, "/", input$getNames(), "/", input$getNames(), ".bam.bai", sep="")
bamMeta[["BAM [File]"]] = paste0(cwd, "/", input$getNames(), "/", input$getNames(), ".bam")
bamMeta[["BAI [File]"]] = paste0(cwd, "/", input$getNames(), "/", input$getNames(), ".bam.bai")
bamMeta[["Read Count"]] = round(bamMeta[["Read Count"]] / param$subsampleReads)
bamOutput = EzDataset(meta=bamMeta)
bamParam = param
12 changes: 6 additions & 6 deletions R/app-RnaBamStats.R
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ getPosErrorFromBam = function(bamFile, param){
chromSel = names(seqLengths)[which.max(seqCounts)]

result = list()
chromFn = file.path(param$ezRef["refChromDir"], paste(chromSel, ".fa", sep=""))
chromFn = file.path(param$ezRef["refChromDir"], paste0(chromSel, ".fa"))
stopifnot(!is.null(chromFn))
targetGenome = readDNAStringSet(chromFn)[[1]]
ezWriteElapsed(job, "read reference genome done")
@@ -218,7 +218,7 @@ getStatsFromBamParallel = function(seqLengths, param, bamFile, sm, nReads, gff=N
chromResults = ezMclapply(seqNames, getStatsFromBamSingleChrom, param, bamFile, sm, nReads, gff, repeatsGff,
mc.preschedule=FALSE, mc.cores=ezThreads())
if (param$saveImage){
save(chromResults, file=paste(sm, "-chromResults.RData", sep=""))
save(chromResults, file=paste0(sm, "-chromResults.RData"))
}
gc()
result = list()
@@ -576,7 +576,7 @@ ezPosSpecErrorRate = function(bam, ReferenceGenome, nMaxReads=100000){
noOfS = as.integer(sub("S", "", clipCigar))
noOfS[is.na(noOfS)] = 0
nEndClipped = noOfH + noOfS
bam$seq = paste(Xbegin, bam$seq, Xend, sep="")
bam$seq = paste0(Xbegin, bam$seq, Xend)

seqChar = strsplit(as.character(bam$seq),"")
readLength = sapply(seqChar, length)
@@ -622,12 +622,12 @@ ezPosSpecErrorRate = function(bam, ReferenceGenome, nMaxReads=100000){
getJunctionPlotsFromBam = function(bamFile, param){
pngFiles = list()
## do the junction annotation
outputJunction = paste("junction-", Sys.getpid(),sep="")
outputJunction = paste0("junction-", Sys.getpid())
bed = getReferenceFeaturesBed(param)
stopifnot(!is.null(bed))
cmd = paste(JUNCTION_ANNOTATION, "--mapq=1", "-i", bamFile, "-o", outputJunction, "-r", bed)
res = ezSystem(cmd, stopOnFailure=FALSE)
junctionFile = paste(outputJunction, ".junction.xls", sep="")
junctionFile = paste0(outputJunction, ".junction.xls")
if (res == 0 && length(readLines(junctionFile)) > 1){
juncsTable = read.table(junctionFile, header=TRUE)
junctions = table(juncsTable$annotation) / length(juncsTable$annotation) *100
@@ -664,7 +664,7 @@ getJunctionPlotsFromBam = function(bamFile, param){
}

## do the cleaning
file.remove(list.files(path=".", pattern=paste(outputJunction, ".+", sep="")))
file.remove(list.files(path=".", pattern=paste0(outputJunction, ".+")))
return(pngFiles)
}

8 changes: 4 additions & 4 deletions R/app-chipStats.R
Original file line number Diff line number Diff line change
@@ -127,8 +127,8 @@ EzAppChipStats <-

galp2gal = function(galp){
system('echo Function galp2gal, conversion of paired-end data into single end data... \n')
betweenPairCigar = paste(abs(start(right(galp)) - end(left(galp)) + 1), "N", sep="")
galcigar = paste(cigar(left(galp)), betweenPairCigar, cigar(right(galp)), sep="")
betweenPairCigar = paste0(abs(start(right(galp)) - end(left(galp)) + 1), "N")
galcigar = paste0(cigar(left(galp)), betweenPairCigar, cigar(right(galp)))
gal = GAlignments(
seqnames = seqnames(galp),
pos = start(left(galp)),
@@ -181,7 +181,7 @@ fragmentSize = function(myBam, isPaired = F){
system('echo sample_fragmentSize calculated, plotting... \n')
png(file=paste(names(myBam),"_fragmentSize.png",sep=''))
d = density(sample_fragmentSize)
plot(d, main=names(myBam),xlab=paste("Median of FragmentSize:",medianFS,sep=""))
plot(d, main=names(myBam),xlab=paste0("Median of FragmentSize:",medianFS))
polygon(d, col="red", border="black")
legend("topright",c(names(myBam)))
dev.off()
@@ -357,7 +357,7 @@ binMyBam = function(cov, binLength, sampleName){
MyBins = c(MyBins,rep(runValue(cov[[i]]),runLength(cov[[i]])))
}
}
write.table(MyBins,paste(sampleName,'_',binLength,'_BinData.txt',sep=""),col.names=F,quote=F,sep='\t')
write.table(MyBins,paste0(sampleName,'_',binLength,'_BinData.txt'),col.names=F,quote=F,sep='\t')
}

clusterData = function(data, distmethod='pearson', clustermethod='ward', title = title){
14 changes: 7 additions & 7 deletions R/app-countQC.R
Original file line number Diff line number Diff line change
@@ -116,11 +116,11 @@ runNgsCountQC = function(dataset, htmlFile="00index.html", param=param, rawData=
if (!is.null(seqAnno)){
combined = cbind(seqAnno[rownames(combined), ,drop=FALSE], combined)
}
countFile = paste(ezValidFilename(param$name), "-raw-count.txt", sep="")
countFile = paste0(ezValidFilename(param$name), "-raw-count.txt")
ezWrite.table(rawData$counts, file=countFile, head="Feature ID", digits=4)
signalFile = paste(ezValidFilename(param$name), "-normalized-signal.txt", sep="")
signalFile = paste0(ezValidFilename(param$name), "-normalized-signal.txt")
ezWrite.table(combined, file=signalFile, head="Feature ID", digits=4)
rpkmFile = paste(ezValidFilename(param$name), "-rpkm.txt", sep="")
rpkmFile = paste0(ezValidFilename(param$name), "-rpkm.txt")
ezWrite.table(getRpkm(rawData), file=rpkmFile, head="Feature ID", digits=4)
if (param$doZip){
dataFiles =c(zipFile(countFile), zipFile(signalFile), zipFile(rpkmFile))
@@ -163,22 +163,22 @@ runNgsCountQC = function(dataset, htmlFile="00index.html", param=param, rawData=

pngName = "sampleCorrelation-AllPresent.png"
try({ezCorrelationPlot(png=pngName, cor(x, use="complete.obs"), cond=conds, condLabels=conds,
main=paste("all present genes (", sum(isValid), ")", sep=""), sampleColors=sampleColors)})
main=paste0("all present genes (", sum(isValid), ")"), sampleColors=sampleColors)})
pngNames[1, 1] = pngName

pngName = "sampleCorrelation-AllPresentNormalized.png"
try({ezCorrelationPlot(png=pngName, cor(xNormed, use="complete.obs"), cond=conds, condLabels=conds,
main=paste("all present genes (", sum(isValid), ") gene-wise normalized", sep=""))})
main=paste0("all present genes (", sum(isValid), ") gene-wise normalized"))})
pngNames[1,2] = pngName

pngName = "sampleCorrelation-TopGenes.png"
try({ezCorrelationPlot(png=pngName, cor(x[topGenes,], use="complete.obs"), cond=conds, condLabels=conds,
main=paste("top genes (", length(topGenes), ")", sep=""))})
main=paste0("top genes (", length(topGenes), ")"))})
pngNames[2,1] = pngName

pngName = "sampleCorrelation-TopGenesNormalized.png"
try({ezCorrelationPlot(png=pngName, cor(xNormed[topGenes,], use="complete.obs"), cond=conds, condLabels=conds,
main=paste("top genes (", length(topGenes), ") gene-wise normalized", sep=""))})
main=paste0("top genes (", length(topGenes), ") gene-wise normalized"))})
pngNames[2,2] = pngName

ezWrite("<h2>Sample correlation</h2>", con=html)
2 changes: 1 addition & 1 deletion R/app-edgerTwoGroups.R
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ runGfold = function(rawData, scalingFactors, isSample, isRef){
if (is.null(gene_name)) gene_name = "NA"
gfoldData = data.frame(gene_name=gene_name, count=rawData$counts[, sampleName], rawData$seqAnno$width,
rawData$rpkm[, sampleName], row.names=rownames(rawData$seqAnno), check.names=FALSE, stringsAsFactors=FALSE)
gfoldFile = paste(sampleName, ".read_cnt", sep="")
gfoldFile = paste0(sampleName, ".read_cnt")
ezWrite.table(gfoldData, file=gfoldFile, col.names = FALSE)
return(gfoldFile)
}
26 changes: 13 additions & 13 deletions R/app-fastQC.R
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@ ezMethodFastQC = function(input=NA, output=NA, param=NA, htmlFile="00index.html"
samples = rownames(dataset)
files = c()
for (sm in samples){
files[paste(sm, "_R1", sep="")] = input$getFullPaths(param,"Read1")[sm]
files[paste0(sm, "_R1")] = input$getFullPaths(param,"Read1")[sm]
if (!is.null(dataset$Read2)){
files[paste(sm, "_R2", sep="")] = input$getFullPaths(param,"Read2")[sm]
files[paste0(sm, "_R2")] = input$getFullPaths(param,"Read2")[sm]
}
}
nFiles = length(files)
@@ -53,7 +53,7 @@ ezMethodFastQC = function(input=NA, output=NA, param=NA, htmlFile="00index.html"
plotPages = sub(".png", ".html", plots)
for (i in 1:length(plots)){
plotHtml = openBsdocReport(title=paste("FASTQC:", plotPages[i]))
png = paste("<img src=", reportDir, "/Images/", plots[i], ">", sep="")
png = paste0("<img src=", reportDir, "/Images/", plots[i], ">")
tbl = ezMatrix(png, rows=names(files), cols=names(plots)[i])
plotHtml = addTableToReport(tbl, plotHtml)
closeBsdocReport(plotHtml, plotPages[i])
@@ -81,15 +81,15 @@ ezMethodFastQC = function(input=NA, output=NA, param=NA, htmlFile="00index.html"
for (i in 1:nFiles){
smy = ezRead.table(file.path(reportDir[i], "summary.txt"), row.names=NULL, header=FALSE)
if (i == 1){
rowNames = paste("<a href=", reportDir, "/fastqc_report.html>", names(files), "</a>", sep="")
rowNames = paste0("<a href=", reportDir, "/fastqc_report.html>", names(files), "</a>")
colNames = ifelse(smy[[2]] %in% names(plotPages),
paste("<a href=", plotPages[smy[[2]]], ">", smy[[2]], "</a>", sep=""),
paste0("<a href=", plotPages[smy[[2]]], ">", smy[[2]], "</a>"),
smy[[2]])
tbl = ezMatrix("", rows=rowNames, cols=colNames)
}
href = paste(reportDir[i], "/fastqc_report.html#M", 0:(ncol(tbl)-1), sep="")
img = paste(reportDir[i], "/Icons/", statusToPng[smy[[1]]], sep="")
tbl[i, ] = paste("<a href=", href, "><img src=", img, "></a>", sep="")
href = paste0(reportDir[i], "/fastqc_report.html#M", 0:(ncol(tbl)-1))
img = paste0(reportDir[i], "/Icons/", statusToPng[smy[[1]]])
tbl[i, ] = paste0("<a href=", href, "><img src=", img, "></a>")
}
html = addTableToReport(tbl, html)

@@ -119,7 +119,7 @@ ezMethodFastQC = function(input=NA, output=NA, param=NA, htmlFile="00index.html"
ezSessionInfo()
html = addParagraph(html, pot("sessionInfo.txt", hyperlink = "sessionInfo.txt"))
closeBsdocReport(html, htmlFile)
ezSystem(paste("rm -rf ", paste(reportDir, ".zip", sep="", collapse=" ")))
ezSystem(paste("rm -rf ", paste0(reportDir, ".zip", collapse=" ")))
return("Success")
}

@@ -229,7 +229,7 @@ plotQualityMatrixAsHeatmap = function(qualMatrixList, isR2=FALSE, xScale=1, ySca
for(nm in names(index)){
idx = index[[nm]]
## Plot the color key for the average quality heatmap R1_1
colorKeyFile = paste("averageReadsQuality-Key_", nm, ".png", sep="")
colorKeyFile = paste0("averageReadsQuality-Key_", nm, ".png")
by.label = 1
at=seq(from=minPercent, to=maxPercent, by=by.label)
ezColorLegend(file=colorKeyFile, colorRange=c(minPercent, maxPercent),
@@ -255,13 +255,13 @@ plotQualityMatrixAsHeatmap = function(qualMatrixList, isR2=FALSE, xScale=1, ySca
result = result / resultCount
avgQual = signif(prop.table(result,2) * 100, digits=3)
pngFileName = plotQualityHeatmap(sqrt(avgQual), colorRange=c(minPercent, maxPercent),
pngFileName=paste("averageReadsQuality-heatmap_", nm, ".png", sep=""),
pngFileName=paste0("averageReadsQuality-heatmap_", nm, ".png"),
colors=colorsGray, main=paste("averageReadsQuality", nm, sep="_"),
xScale=xScale, yScale=yScale)
pngTable["Average", nm] = pngFileName

## plot the difference quality heatmap for R1_1
colorKeyFile = paste("diffReadsQuality-Key_", nm, ".png", sep="")
colorKeyFile = paste0("diffReadsQuality-Key_", nm, ".png")
at=seq(from=minDiff, to=maxDiff, by=by.label)
ezColorLegend(file=colorKeyFile, colorRange=c(minDiff, maxDiff), colors=ezRedBlueScale(256),
vertical=FALSE, height=200*xScale, width=400*yScale, by.label=by.label, at=at, labels=as.character(at))
@@ -270,7 +270,7 @@ plotQualityMatrixAsHeatmap = function(qualMatrixList, isR2=FALSE, xScale=1, ySca
qm = qualMatrixList[[sampleName]]
diffResult = signif(prop.table(qm,2)*100, digits=3) - avgQual[1:nrow(qm), 1:ncol(qm)]
pngFileName = plotQualityHeatmap(diffResult, colorRange=c(minDiff, maxDiff),
pngFileName=paste("diffReadsQuality-heatmap_", sampleName, ".png", sep=""),
pngFileName=paste0("diffReadsQuality-heatmap_", sampleName, ".png"),
colors=ezRedBlueScale(256), main=paste("diffReadsQuality", sampleName, sep="_"),
xScale=xScale, yScale=yScale)
pngTable[sampleName, nm] = pngFileName
4 changes: 2 additions & 2 deletions R/app-fastqscreen.R
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ EzAppFastqScreen <-

## NOTEP: all 5 functions below get only called once each in ezMethodFastqScreen()
executeFastqscreenCMD = function(param, files){
confFile = paste(FASTQSCREEN_CONF_DIR, param$confFile, sep="")
confFile = paste0(FASTQSCREEN_CONF_DIR, param$confFile)
opt = ""
if (param$nReads > 0){
opt = paste(opt, "--subset", ezIntString(param$nReads))
@@ -63,7 +63,7 @@ executeFastqscreenCMD = function(param, files){
executeBowtie2CMD = function(param, files){
countFiles = character()
for (nm in names(files)){
countFiles[nm] = paste(nm, "-counts.txt", sep="")
countFiles[nm] = paste0(nm, "-counts.txt")
bowtie2options = param$cmdOptions
if(!param$paired){
cmd = paste(file.path(BOWTIE2_DIR,'bowtie2'),"-x",REFSEQ_mRNA_REF,
Loading

0 comments on commit 8d9efde

Please sign in to comment.