Skip to content
Prev 12656 / 21312 Next

[Bioc-devel] BiocParallel and AnnotationDbi: database disk image is malformed

On 01/19/2018 12:37 PM, Gabe Becker wrote:
pass the data base connection to the function

getSymbol <- function ( x, db )
     ## olde schoole
     AnnotationDbi::mget(x, db)
     ## AnnotationDbi::mapIds(db, x, "SYMBOL", "PROBEID")

and arrange for the general case, i.e., distinct processes with data 
serialized between them

 > cl = parallel::makePSOCKcluster(2)
 > parLapply(cl, x, getSymbol, hgu95av2SYMBOL)
Error in checkForRemoteErrors(val) :
   2 nodes produced errors; first error: external pointer is not valid

(getSymbol would fail as originally written in the serial case, since 
the workers would not have access to hgu95av2SYMBOL

The workaround is to open the connection on the node, e.g.,

getSymbol <- function ( x, dbname ) {
     nmspc <- loadNamespace(dbname)
     db <- get(dbname, nmspc)
     AnnotationDbi::mapIds(db, x, "SYMBOL", "PROBEID")
}

lapply(x, getSymbol, "hgu95av2.db")
bplapply(x, getSymbol, "hgu95av2.db")
bplapply(x, getSymbol, "hgu95av2.db", BPPARAM = SnowParam())

Martin
This email message may contain legally privileged and/or...{{dropped:2}}