Skip to content

Commit 6f36e2f

Browse files
committed
change print() to message()
1 parent 6db530d commit 6f36e2f

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

R/annotation-data-helper.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ parseTxdb <- function(txdb, file, species) {
299299
if (!(ext %in% c('gtf', 'sqlite', 'gff3'))) {
300300
stop('File path must link to a GTF/GFF or TxDb object')
301301
}
302-
print('Parsing input file...')
302+
message('Parsing input file...')
303303
if (ext == 'sqlite') {
304304
txdb <- AnnotationDbi::loadDb(file)
305305
} else if (ext %in% c('gtf', 'gff3')) {

R/annotation-data.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ preparePromoterAnnotation <- function(txdb, file, species) {
2929
promoterAnnotation <- PromoterAnnotation()
3030

3131
### Reduce first exons to identify transcripts belonging to each promoter
32-
print('Extract exons by transcripts...')
32+
message('Extract exons by transcripts...')
3333
transcriptRanges <- getTranscriptRanges(txdb, species)
3434
exonRangesByTx <- getExonRangesByTx(txdb, species = species)
3535
transcriptRanges$TxWidth <- vapply(width(exonRangesByTx),
@@ -43,12 +43,12 @@ preparePromoterAnnotation <- function(txdb, file, species) {
4343
transcriptRanges$TXNAME)]
4444

4545
## Identify overlapping first exons by gene and annotate with promoter ids
46-
print('Identify overlapping first exons for each gene...')
46+
message('Identify overlapping first exons for each gene...')
4747
exonReducedRanges <- getReducedExonRanges(exonRanges.firstExon,
4848
exonRanges.firstExon.geneId)
4949

5050
### Prepare the id mapping transcripts, TSSs, promoters and genes ###
51-
print('Prepare mapping between transcripts, tss, promoters and genes...')
51+
message('Prepare mapping between transcripts, tss, promoters and genes...')
5252
tssCoordinates <- getTssRanges(transcriptRanges)
5353
revmapTMP <- as.vector(exonReducedRanges$revmap)
5454
txName.all <- exonRanges.firstExon$tx_name[unlist(revmapTMP)]
@@ -70,7 +70,7 @@ preparePromoterAnnotation <- function(txdb, file, species) {
7070
'tssId', 'promoterId', 'geneId')
7171

7272
### Prepare the annotated intron ranges to be used as input for junction read counting ###
73-
print('Prepare annotated intron ranges...')
73+
message('Prepare annotated intron ranges...')
7474
intronRangesByTx <- getIntronRangesByTx(txdb, transcriptRanges, species)
7575
intronRangesByTx.unlist <- unlist(intronRangesByTx)
7676
intronRanges.unique <- getUniqueIntronRanges(intronRangesByTx.unlist)
@@ -94,7 +94,7 @@ preparePromoterAnnotation <- function(txdb, file, species) {
9494
intronRanges.annotated <- annotateIntronRanges(intronRanges.unique, intronTable)
9595

9696
### Annotate the reduced exons with promoter metadata
97-
print('Annotating reduced exon ranges...')
97+
message('Annotating reduced exon ranges...')
9898
## Identify first intron for each promoter for each transcript
9999
intronIdByPromoter.firstIntron <- getIntronIdPerPromoter(intronRangesByTx.unlist, promoterIdMapping)
100100

@@ -107,7 +107,7 @@ preparePromoterAnnotation <- function(txdb, file, species) {
107107
exonReducedRanges <- annotateReducedExonRanges(exonReducedRanges, promoterMetadata, intronIdByPromoter.firstIntron)
108108

109109
### Retrieve promoter coordinates
110-
print('Prepare promoter coordinates and first exon ranges...')
110+
message('Prepare promoter coordinates and first exon ranges...')
111111
promoterCoordinates <- promoters(exonReducedRanges, downstream = 1, upstream = 0)
112112
exonEnd <- resize(exonReducedRanges, width = 1, fix = 'end')
113113
promoterCoordinates.metadata <- data.frame(promoterId = promoterCoordinates$promoterId,

R/estimate-promoter-activity.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#'
1414
getAbsolutePromoterActivity <- function(junctionReadCounts, promoterAnnotation,
1515
log2 = TRUE, pseudocount = 1) {
16-
print(paste0('Calculating ', ifelse(log2 == TRUE, 'log2 ', ''),
16+
message(paste0('Calculating ', ifelse(log2 == TRUE, 'log2 ', ''),
1717
'absolute promoter activity...'))
1818
promoterIdMapping <- promoterIdMapping(promoterAnnotation)
1919
conversionHelper <- unique(promoterIdMapping[, c('promoterId', 'geneId')])
@@ -36,7 +36,7 @@ getAbsolutePromoterActivity <- function(junctionReadCounts, promoterAnnotation,
3636
#' @return data.frame of gene expression with gene ids#'
3737
#'
3838
getGeneExpression <- function(absolutePromoterActivity) {
39-
print('Calculating gene expression...')
39+
message('Calculating gene expression...')
4040
conversionHelper <- absolutePromoterActivity[, c('promoterId', 'geneId')]
4141
if (ncol(absolutePromoterActivity) == 3) {
4242
geneExpression <- data.frame(counts = tapply(
@@ -63,7 +63,7 @@ getGeneExpression <- function(absolutePromoterActivity) {
6363
#'
6464
getRelativePromoterActivity <- function(absolutePromoterActivity,
6565
geneExpression) {
66-
print(paste0('Calculating relative promoter activity...'))
66+
message(paste0('Calculating relative promoter activity...'))
6767
conversionHelper <- absolutePromoterActivity[, c('promoterId', 'geneId')]
6868
if (is.null(geneExpression) == TRUE) {
6969
geneExpression <- getGeneExpression(absolutePromoterActivity)

R/junction-read-count.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
calculateJunctionReadCounts <- function(promoterCoordinates, intronRanges,
2121
file = '', fileType = '', genome = '') {
2222
if(fileType == 'tophat') {
23-
print(paste0('Processing: ', file))
23+
message(paste0('Processing: ', file))
2424
junctionTable <- readTopHatJunctions(file)
2525
seqlevelsStyle(junctionTable) <- 'UCSC'
26-
print('File loaded into memory')
26+
message('File loaded into memory')
2727
} else if(fileType == 'star') {
28-
print(paste0('Processing: ', file))
28+
message(paste0('Processing: ', file))
2929
junctionTable <- readSTARJunctions(file)
3030
seqlevelsStyle(junctionTable) <- 'UCSC'
3131
junctionTable$score <- junctionTable$um_reads
32-
print('File loaded into memory')
32+
message('File loaded into memory')
3333
} else if (fileType == 'bam') {
34-
print(paste0('Processing: ', file))
34+
message(paste0('Processing: ', file))
3535
rawBam <- readGAlignments(file)
3636
bam <- keepStandardChromosomes(rawBam, pruning.mode = 'coarse')
3737
seqlevelsStyle(bam) <- 'UCSC'
@@ -44,9 +44,9 @@ calculateJunctionReadCounts <- function(promoterCoordinates, intronRanges,
4444
pruning.mode = 'coarse')
4545
strand(junctionTable) <- junctionTable$intron_strand
4646
junctionTable <- junctionTable[,c('score')]
47-
print('Junctions extracted from BAM file')
47+
message('Junctions extracted from BAM file')
4848
}
49-
print('Calculating junction counts')
49+
message('Calculating junction counts')
5050
intronRanges.overlap <- findOverlaps(intronRanges, junctionTable,
5151
type = 'equal')
5252
intronRanges$junctionCounts <- rep(0, length(intronRanges))
@@ -106,7 +106,7 @@ calculatePromoterReadCounts <- function(promoterAnnotation, files = NULL,
106106
BPPARAM = bpParameters)
107107
} else {
108108
if (requireNamespace('BiocParallel', quietly = TRUE) == FALSE) {
109-
print('Warning: "BiocParallel" package is not available!
109+
message('Warning: "BiocParallel" package is not available!
110110
Using sequential version instead...')
111111
}
112112
promoterReadCounts <- lapply(files, calculateJunctionReadCounts,
@@ -144,7 +144,7 @@ normalizePromoterReadCounts <- function(promoterReadCounts) {
144144
colData <- data.frame(sampleLabels = colnames(promoterReadCounts))
145145
rownames(colData) <- colnames(promoterReadCounts)
146146

147-
print('Calculating normalized read counts...')
147+
message('Calculating normalized read counts...')
148148
if (requireNamespace('DESeq2', quietly = TRUE) == FALSE) {
149149
stop('DESeq2 is not installed!
150150
For normalization DESeq2 is needed, please install it.')

R/plot-proActiv.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ plotPromoters <- function(result, gene, txdb, ranges,
7575
which is a single-exon transcript. proActiv does not estimate
7676
promoter activity in such cases.')
7777
}
78-
print(paste0('Plotting ', gene))
78+
message(paste0('Plotting ', gene))
7979

8080
grtrack <- getGeneRegionTrack(rdata, gene, txdb, ranges)
8181
dtracklist <- getDataTrack(rdata, groups, blk.width = blk.width,
@@ -87,7 +87,7 @@ plotPromoters <- function(result, gene, txdb, ranges,
8787
fill = arrow.fill, col = arrow.border)
8888
gtrack <- GenomeAxisTrack()
8989

90-
print('Creating Plot...')
90+
message('Creating Plot...')
9191
plotTracks(c(grtrack, dtracklist, atrack, gtrack), type='histo',
9292
main = gene, col.axis = 'black', col.title = 'black',
9393
background.title = 'transparent', cex.title = cex.title,
@@ -99,7 +99,7 @@ plotPromoters <- function(result, gene, txdb, ranges,
9999
#' @importFrom Gviz DataTrack
100100
getDataTrack <- function(rdata, groups, blk.width,
101101
fill.histogram, col.histogram) {
102-
print('Creating Data Track...')
102+
message('Creating Data Track...')
103103
## Set dummy width for visualization
104104
if (is.null(blk.width)) {
105105
blk.width <- blk.width
@@ -133,7 +133,7 @@ getDataTrack <- function(rdata, groups, blk.width,
133133
#' @importFrom Gviz GeneRegionTrack
134134
#' @importFrom GenomicRanges GRangesList
135135
getGeneRegionTrack <- function(rdata, gene, txdb, ranges) {
136-
print('Creating Gene Region Track...')
136+
message('Creating Gene Region Track...')
137137
txs.gene <- rdata$txId[[1]]
138138
if ( missing(txdb) & missing(ranges)) {
139139
stop('Either txdb or ranges must be provided')
@@ -163,7 +163,7 @@ getGeneRegionTrack <- function(rdata, gene, txdb, ranges) {
163163
getAnnotationTrack <- function(rdata, grtrack, arrow.width,
164164
fontcolor.feature, cex.feature,
165165
fill, col) {
166-
print('Creating Annotation Track...')
166+
message('Creating Annotation Track...')
167167
## Adjust arrow start depending on stand - Gviz quirks
168168
if (is.null(arrow.width)) {
169169
min.coord <- min(c(start(grtrack), end(grtrack)))

R/proActiv.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ buildSummarizedExperiment <- function(promoterAnnotation,
129129
fileLabels, drop = FALSE]))
130130
metadata(result) <- list(geneExpression =
131131
geneExpression[, fileLabels, drop = FALSE])
132-
print('Calculating positions of promoters...')
132+
message('Calculating positions of promoters...')
133133
promoterCoordinates <- promoterCoordinates(promoterAnnotation)
134134
promoterIdMapping <- promoterIdMapping(promoterAnnotation)
135135
promoterCoordinates$geneId <- promoterIdMapping$geneId[match(
@@ -159,7 +159,7 @@ summarizeAcrossCondition <- function(result, condition) {
159159
colData(result) <- DataFrame(sampleName = colnames(result),
160160
condition=condition)
161161
colnames(result) <- colData(result)$sampleName
162-
print('Summarising expression and activity across conditions...')
162+
message('Summarising expression and activity across conditions...')
163163
for (group in unique(condition)) {
164164
rowData(result)[,paste0(group, '.mean')] <-
165165
rowMeans(assays(result[,colData(result)$condition==group])$abs)
@@ -177,7 +177,7 @@ summarizeAcrossCondition <- function(result, condition) {
177177
categorizePromoters <- function(rdata, condition) {
178178
rdata <- as_tibble(rdata)
179179
for (group in unique(condition)) {
180-
print(paste0('Categorizing ', group, ' promoters...'))
180+
message(paste0('Categorizing ', group, ' promoters...'))
181181
mean <- paste0(group, '.mean')
182182
class <- paste0(group, '.class')
183183

0 commit comments

Comments
 (0)