File: bptry.Rd

package info (click to toggle)
r-bioc-biocparallel 1.40.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,768 kB
  • sloc: cpp: 139; sh: 14; makefile: 8
file content (81 lines) | stat: -rw-r--r-- 2,021 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
\name{bptry}

\alias{bptry}

\title{Try expression evaluation, recovering from bperror signals}

\description{

  This function is meant to be used as a wrapper around
  \code{bplapply()} and friends, returning the evaluated expression
  rather than signalling an error.

}
\usage{
bptry(expr, ..., bplist_error, bperror)
}

\arguments{
  \item{expr}{An R expression; see \code{\link{tryCatch}}.}

  \item{bplist_error}{

    A \sQuote{handler} function of a single argument, used to catch
    \code{bplist_error} conditions signalled by \code{expr}. A
    \code{bplist_error} condition is signalled when an element of
    \code{bplapply} and other iterations contain a evaluation that
    failed. When missing, the default retrieves the \dQuote{result}
    attribute from the error, containing the partially evaluated
    results.

    Setting \code{bplist_error=identity} returns the evaluated
    condition.

    Setting \code{bplist_error=stop} passes the condition to other
    handlers, notably the handler provided by \code{bperror}.

  }

  \item{bperror}{

    A \sQuote{handler} function of a single argument, use to catch
    \code{bperror} conditions signalled by \code{expr}. A \code{bperror}
    is a base class to all errors signaled by \pkg{BiocParallel}
    code. When missing, the default returns the condition without
    signalling an error.

  }

  \item{\dots}{

    Additional named handlers passed to \code{tryCatch()}. These
    user-provided handlers are evaluated before default handlers
    \code{bplist_error}, \code{bperror}.

  }

}

\value{

  The partially evaluated list of results.

}

\author{Martin Morgan \email{martin.morgan@roswellpark.org}}


\seealso{
  \code{\link{bpok}}, \code{\link{tryCatch}}, \code{\link{bplapply}}.
}
\examples{
param = registered()[[1]]
param
X = list(1, "2", 3)
bptry(bplapply(X, sqrt))                         # bplist_error handler
result <- bptry(bplapply(X, sqrt), bplist_error=identity)  # bperror handler
result
bpresult(result)
}

\keyword{manip}