Skip to content

Commit

Permalink
changed quiet argument to debug in importBed function and updated rel…
Browse files Browse the repository at this point in the history
…evant documentation, examples, and functions
  • Loading branch information
borauyar committed Sep 6, 2017
1 parent ecc8460 commit 00f215b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions R/meta_analysis_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
#' # when importing multiple bed files with different column names, it
#' # is required to pass the common column names to be parsed from the
#' # bed files
#' bedData <- importBedFiles(filePaths = c(input1, input2), quiet = TRUE,
#' colnames = c('chrom', 'start', 'end', 'strand'))
#' bedData <- importBedFiles(filePaths = c(input1, input2),
#' colnames = c('chrom', 'start', 'end', 'strand'))
#'
#' @importFrom GenomicRanges GRangesList
#' @importFrom pbapply pbsapply
#' @export
importBedFiles <- function(filePaths, ...) {
bedData <- GenomicRanges::GRangesList(pbapply::pbsapply(filePaths, function(f) {
RCAS::importBed(filePath = f, quiet = TRUE, ...)
RCAS::importBed(filePath = f, debug = FALSE, ...)
}, USE.NAMES = TRUE))
names(bedData) <- gsub(pattern = '.bed$',
replacement = '',
Expand Down
10 changes: 5 additions & 5 deletions R/report_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ importGtf <- function (filePath, saveObjectAsRds = TRUE, readFromRds = TRUE,
#' convert the \code{seqlevelsStyle} to 'UCSC' and apply
#' \code{keepStandardChromosomes} function to only keep data from the standard
#' chromosomes
#' @param quiet TRUE/FALSE (default:FALSE). Set to TRUE to turn off messages
#' @param debug TRUE/FALSE (default:TRUE). Set to FALSE to turn off messages
#' @param ... Other arguments passed to rtracklayer::import.bed function
#' @return A \code{GRanges} object containing the coordinates of the intervals
#' from an input BED file
Expand All @@ -109,23 +109,23 @@ importGtf <- function (filePath, saveObjectAsRds = TRUE, readFromRds = TRUE,
#' @importFrom GenomeInfoDb seqlevelsStyle
#' @importFrom GenomeInfoDb keepStandardChromosomes
#' @export
importBed <- function (filePath, sampleN = 0, keepStandardChr = TRUE, quiet = FALSE, ...) {
importBed <- function (filePath, sampleN = 0, keepStandardChr = TRUE, debug = TRUE, ...) {

if (file.exists(filePath)) {
data = rtracklayer::import.bed(filePath, ...)
if(quiet == FALSE) {
if(debug == TRUE) {
cat('Processing',filePath,'\n')
}
if (keepStandardChr == TRUE) {
GenomeInfoDb::seqlevelsStyle(data) <- 'UCSC'
if(quiet == FALSE) {
if(debug == TRUE) {
cat('Keeping standard chromosomes only\n')
}
data <- GenomeInfoDb::keepStandardChromosomes(data, pruning.mode = 'coarse')
}

if (sampleN > 0 && sampleN < length(data)) {
if(quiet == FALSE) {
if(debug == TRUE) {
cat ('Downsampling intervals to size:',sampleN,'\n')
}
data <- data[sample(x = 1:length(data), size = sampleN)]
Expand Down
4 changes: 2 additions & 2 deletions man/importBed.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/importBedFiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 00f215b

Please sign in to comment.