From 82da2c61391f1cd62f0d49583ff2b14c4fa2bd37 Mon Sep 17 00:00:00 2001 From: JunJunLao <1138976957@qq.com> Date: Thu, 23 May 2024 21:30:50 +0800 Subject: [PATCH] add args for loadHomerRes --- R/parseHomer.R | 49 ++++++++++++++++++++++++++++++--------------- man/loadHomerRes.Rd | 6 +++++- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/R/parseHomer.R b/R/parseHomer.R index a91a660..204a82c 100644 --- a/R/parseHomer.R +++ b/R/parseHomer.R @@ -190,41 +190,58 @@ preparePFMmat <- function(homerDir = NULL, #' #' @param homerDir the path of homer output data. #' @param motifIndex the numbers of motif index. +#' @param novo whether parse de novo motif data, default TRUE. +#' @param known whether parse de known motif data, default TRUE. #' #' @return homerResult object #' @export loadHomerRes <- function(homerDir = NULL, - motifIndex = NULL){ + motifIndex = NULL, + novo = TRUE, + known = TRUE){ # ============================================================================ # deal with known motif # ============================================================================ # extract known motif - known <- parseHomer(homerDir = homerDir, - motifIndex = motifIndex, - type = "known") + if(known == TRUE){ + known <- parseHomer(homerDir = homerDir, + motifIndex = motifIndex, + type = "known") - known_pwm <- parseHomerMotif(homerDir = homerDir, + known_pwm <- parseHomerMotif(homerDir = homerDir, + motifIndex = motifIndex, + type = "known") + + known_pfm <- preparePFMmat(homerDir = homerDir, motifIndex = motifIndex, type = "known") + }else{ + known <- NULL + known_pwm <- NULL + known_pfm <- NULL + } - known_pfm <- preparePFMmat(homerDir = homerDir, - motifIndex = motifIndex, - type = "known") # ============================================================================ # deal with novo motif # ============================================================================ # extract novo motif - novo <- parseHomer(homerDir = homerDir, - motifIndex = motifIndex, - type = "novo") + if(novo == TRUE){ + novo <- parseHomer(homerDir = homerDir, + motifIndex = motifIndex, + type = "novo") + + novo_pwm <- parseHomerMotif(homerDir = homerDir, + motifIndex = motifIndex, + type = "novo") - novo_pwm <- parseHomerMotif(homerDir = homerDir, + novo_pfm <- preparePFMmat(homerDir = homerDir, motifIndex = motifIndex, type = "novo") - - novo_pfm <- preparePFMmat(homerDir = homerDir, - motifIndex = motifIndex, - type = "novo") + }else{ + novo <- NULL + novo_pwm <- NULL + novo_pfm <- NULL + } # ============================================================================ diff --git a/man/loadHomerRes.Rd b/man/loadHomerRes.Rd index 034dec8..50f67db 100644 --- a/man/loadHomerRes.Rd +++ b/man/loadHomerRes.Rd @@ -4,12 +4,16 @@ \alias{loadHomerRes} \title{parse homer output and assemble into homerResult object} \usage{ -loadHomerRes(homerDir = NULL, motifIndex = NULL) +loadHomerRes(homerDir = NULL, motifIndex = NULL, novo = TRUE, known = TRUE) } \arguments{ \item{homerDir}{the path of homer output data.} \item{motifIndex}{the numbers of motif index.} + +\item{novo}{whether parse de novo motif data, default TRUE.} + +\item{known}{whether parse de known motif data, default TRUE.} } \value{ homerResult object