Entering edit mode
Paul Leo
▴
970
@paul-leo-2092
Last seen 10.2 years ago
I am trying to download an "exons worth of reads" from a collection of
Bam files using a bamViews object. The index files are stored locally
al
la Rsamtools documentation and suggested code. Typically less that 50
reads per bam file are obtained.
Occasionally the connection times out (I think?) which causes the R
session to crash (the documentation hits to problems with unreliable
connections)
I don't mind the connection timing out, or it even being unreliable,
but how to I catch the error without losing the session?
Codes works fine most of the time and there is no case where I can
reliably reproduce the error, but some info is provided which may help
those wiser than I...
Even without the crash I wonder IF the connection timed out for failed
how would I know this occurred for a given file ; is there a
success/fail info I can access anywhere... that is, would I know the
difference between no reads in that region or the retrieval just
failed? (So far I have *found* no cases where an empty list resulted
from a failed connection).
Thanks
Paul
> radial<- try(scanBam(bv,param=params))
[kftp_connect_file] 227 Entering Passive Mode (193,62,197,91,149,230)
*** caught bus error ***
address (nil), cause 'unknown'
Traceback:
1: .Call(func, file, index, "rb", list(space(which),
.uunlist(start(which)), .uunlist(end(which))), flag, simpleCigar,
...)
2: .io_bam(.scan_bam, file, index, reverseComplement, tmpl, param =
param)
3: scanBam(file = bamPaths(bamViews)[i], index =
bamIndicies(bamViews)[i], ...)
4: scanBam(file = bamPaths(bamViews)[i], index =
bamIndicies(bamViews)[i], ...)
5: FUN(...)
6: doTryCatch(return(expr), name, parentenv, handler)
7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
8: tryCatchList(expr, classes, parentenv, handlers)
9: tryCatch({ FUN(...)}, error = function(err) { msg <-
paste(capture.output(conditionCall(err)), conditionMessage(err),
sep = "\n ") if (is.loaded("mpi_comm_size"))
SRError("RemoteError", msg) else SRError("UnspecifiedError", msg)})
10: FUN(c(5L, 13L, 21L, 29L)[[4L]], ...)
11: lapply(S, FUN, ...)
12: doTryCatch(return(expr), name, parentenv, handler)
13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
14: tryCatchList(expr, classes, parentenv, handlers)
15: tryCatch(expr, error = function(e) { call <- conditionCall(e)
if (!is.null(call)) { if (identical(call[[1L]],
quote(doTryCatch))) call <- sys.call(-4L) dcall <-
deparse(call)[1L] prefix <- paste("Error in", dcall, ": ")
LONG <- 75L msg <- conditionMessage(e) sm <-
strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") +
nchar(sm[1L], type = "w") if is.na(w)) w <- 14L +
nchar(dcall, type = "b") + nchar(sm[1L], type = "b")
if (w > LONG) prefix <- paste(prefix, "\n ", sep = "")
} else prefix <- "Error : " msg <- paste(prefix,
conditionMessage(e), "\n", sep = "")
.Internal(seterrmessage(msg[1L])) if (!silent &&
identical(getOption("show.error.messages"), TRUE)) {
cat(msg, file = stderr()) .Internal(printDeferredWarnings())
} invisible(structure(msg, class = "try-error"))})
16: try(lapply(S, FUN, ...), silent = TRUE)
17: sendMaster(try(lapply(S, FUN, ...), silent = TRUE))
18: FUN(1:8[[5L]], ...)
19: lapply(1:cores, inner.do)
20: mcLapply(X, CFUN, ..., verbose = verbose)
21: fapply(X, FUN, ..., verbose = verbose)
22: .srapply(idx, fun, bamViews, ...)
23: .BamViews_delegate("scanBam", file, fun, ..., param = param)
24: scanBam(bv, param = params)
25: scanBam(bv, param = params)
26: doTryCatch(return(expr), name, parentenv, handler)
27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
28: tryCatchList(expr, classes, parentenv, handlers)
29: tryCatch(expr, error = function(e) { call <- conditionCall(e)
if (!is.null(call)) { if (identical(call[[1L]],
quote(doTryCatch))) call <- sys.call(-4L) dcall <-
deparse(call)[1L] prefix <- paste("Error in", dcall, ": ")
LONG <- 75L msg <- conditionMessage(e) sm <-
strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") +
nchar(sm[1L], type = "w") if is.na(w)) w <- 14L +
nchar(dcall, type = "b") + nchar(sm[1L], type = "b")
if (w > LONG) prefix <- paste(prefix, "\n ", sep = "")
} else prefix <- "Error : " msg <- paste(prefix,
conditionMessage(e), "\n", sep = "")
.Internal(seterrmessage(msg[1L])) if (!silent &&
identical(getOption("show.error.messages"), TRUE)) {
cat(msg, file = stderr()) .Internal(printDeferredWarnings())
} invisible(structure(msg, class = "try-error"))})
30: try(scanBam(bv, param = params))
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
R version 2.12.0 Under development (unstable) (2010-04-18 r51771)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rsamtools_1.0.5 Biostrings_2.16.5 RCurl_1.4-2
[4] bitops_1.0-4.1 GenomicFeatures_1.0.0 GenomicRanges_1.0.3
[7] IRanges_1.6.6 multicore_0.1-3
loaded via a namespace (and not attached):
[1] Biobase_2.8.0 biomaRt_2.4.0 BSgenome_1.16.4 DBI_0.2-5
[5] RSQLite_0.9-1 rtracklayer_1.8.1 XML_3.1-0
>
[[alternative HTML version deleted]]