Hi all,

I just discovered the doMC package and have been working on parallelizing my
code.  I know by default the foreach function returns a list in which the
tags are the index of the iterator.  If I wanted specific tags for my list
how could I do something like that?  For example, the following code does a
t-test and returns a p-val for each probeset.

p_vals <- NULL
p_vals <- foreach (r = 1:nrow(ni)) %dopar% {
    t_test_results <- try(t.test(ni[r, groupA], ni[r, groupB]), silent=TRUE)
    ps <- as.character(ni[r,2])

    if (is(t_test_results, "try-error")){
        next()
    } else {
        if (!is.nan(t_test_results$p.value)){
            print(paste("Performing t-test on probeset -", ps))
            t_test_results$p.value
        }
    }
}

The returned list would look like:

[1] 0.005
[2] 0.15
[3] 0.52
.
.
.

The list tag for the p-val is the index r.  But the probeset itself as a
specific value (ps) which I would like to use as the tag in the list.  So it
could be like this:

[2425915] 0.005
[1596109] 0.15
[3258010] 0.52
.
.
.

I tried to use the line p_vals[[ps]] <- t_test_results$p.value inside my
foreach loop but it doesn't work.  The .combine parameter doesn't appear to
allow me to specify custom functions to combine my results.  Any ideas on
what I could do?

Thanks,

Fong

	[[alternative HTML version deleted]]

