Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mapWig & repTimeWig to be optional #15

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions R/runIchorCNA.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
#' @param outDir Output Directory.
#' @param cores Number of cores to use for EM.
#' @export
run_ichorCNA <- function(tumor_wig, normal_wig = NULL, gcWig, mapWig, repTimeWig, normal_panel=NULL, sex = NULL, exons.bed=NULL, id = "test",
centromere = NULL, minMapScore = 0.9, flankLength = 1e5, normal=0.5, estimatePloidy = TRUE, maxFracCNASubclone = 0.7,
run_ichorCNA <- function(tumor_wig, normal_wig = NULL, gcWig, mapWig = NULL, repTimeWig = NULL,
normal_panel = NULL, sex = NULL, exons.bed = NULL, id = "test", centromere = NULL,
minMapScore = 0.9, flankLength = 1e5, normal=0.5, estimatePloidy = TRUE, maxFracCNASubclone = 0.7,
normal.init = "c(0.5, 0.5)", scStates = NULL, scPenalty = 0.1, normal2IgnoreSC = 1.0,
coverage = NULL, likModel = "t", lambda = NULL, lambdaScaleHyperParam = 3,
kappa = 50, ploidy = "2", maxCN = 7, estimateNormal = TRUE, estimateScPrevalence = TRUE,
Expand Down Expand Up @@ -90,7 +91,16 @@ run_ichorCNA <- function(tumor_wig, normal_wig = NULL, gcWig, mapWig, repTimeWig

## load seqinfo
seqinfo <- getSeqInfo(genomeBuild, genomeStyle, chrs)


## check required tumor_wig & gcWig have inputs
if (missing(tumor_wig) || is.null(tumor_wig)) {
stop("tumor wig file not provided but is required")
}

if (missing(gcWig) || is.null(gcWig)) {
stop("GC wig file not provided but is required")
}

if (substr(tumor_wig,nchar(tumor_wig)-2,nchar(tumor_wig)) == "wig") {
wigFiles <- data.frame(cbind(id, tumor_wig))
} else {
Expand Down Expand Up @@ -119,6 +129,7 @@ run_ichorCNA <- function(tumor_wig, normal_wig = NULL, gcWig, mapWig, repTimeWig

## LOAD GC/MAP/REPTIME WIG FILES ###
message("Reading GC and mappability files")

gc <- wigToGRanges(gcWig)
if (is.null(gc)){
stop("GC wig file not provided but is required")
Expand Down
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ setGenomeStyle <- function(x, genomeStyle = "NCBI", species = "Homo_sapiens"){
}
#' @export
wigToGRanges <- function(wigfile, verbose = TRUE){
if(is.null(wigfile)) return(NULL)

output <- tryCatch({
input <- readLines(wigfile, warn = FALSE)
breaks <- c(grep("fixedStep", input), length(input) + 1)
Expand Down