From 7e0a1a0ce6c4e008a2c114e436e451152f09e504 Mon Sep 17 00:00:00 2001 From: Tim Song Date: Thu, 14 Nov 2019 16:55:15 -0500 Subject: [PATCH] Allow for 3 attempts to perform facets iteration, will error out if it cannot find af it --- doFacets.R | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/doFacets.R b/doFacets.R index 2a30602..ed07489 100755 --- a/doFacets.R +++ b/doFacets.R @@ -233,15 +233,21 @@ facets_iteration <- function(COUNTS_FILE, TAG, DIRECTORY, CVAL, DIPLOGR, NDEPTH, if (RLIB_VERSION >= '0.5.2') { - rcmat = readSnpMatrix2(COUNTS_FILE, err.thresh = 10, del.thresh = 10) - dat = preProcSample(rcmat, ndepth = NDEPTH, het.thresh = 0.25, snp.nbhd = SNP_NBHD, cval = 25, - gbuild = GENOME, hetscale = TRUE, unmatched = unmatched, ndepthmax = 1000) - - out = procSample(dat, cval = CVAL, min.nhet = MIN_NHET, dipLogR = DIPLOGR) - fit = emcncf(out) - + numcounts = 3 + for (i in 1:numcounts){ + print(paste0("attempt ",i)) + tryCatch({ + dat = preProcSample(rcmat, ndepth = NDEPTH, het.thresh = 0.25, snp.nbhd = SNP_NBHD, cval = 25, + gbuild = GENOME, hetscale = TRUE, unmatched = unmatched, ndepthmax = 1000) + out = procSample(dat, cval = CVAL, min.nhet = MIN_NHET, dipLogR = DIPLOGR) + fit = emcncf(out) + break + }, + error=function(e){str(e)} + ) + } fit$cncf = cbind(fit$cncf, cf = out$out$cf, tcn = out$out$tcn, lcn = out$out$lcn) write_output(out, fit, DIRECTORY, TAG, TUMOR_ID )