git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Streamer@69052 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -31,63 +31,3 @@ RawToChar <- function(...) |
31 | 31 |
|
32 | 32 |
Rev <- function(...) |
33 | 33 |
.Rev$new(...) |
34 |
- |
|
35 |
-## connect |
|
36 |
- |
|
37 |
-connect <- |
|
38 |
- function(blocks, df) |
|
39 |
-{ |
|
40 |
- inUse <- sapply(blocks, function(x) all(x$inUse)) |
|
41 |
- cls <- sapply(blocks, class) |
|
42 |
- if (any(inUse)) { |
|
43 |
- msg <- sprintf("%s: already in use in another stream", |
|
44 |
- paste(cls[which(inUse)], collapse = ", ")) |
|
45 |
- stop(msg) |
|
46 |
- } |
|
47 |
- |
|
48 |
- len <- length(blocks) |
|
49 |
- n <- nrow(df) |
|
50 |
- df$weight <- 1L |
|
51 |
- |
|
52 |
- for (i in seq_len(n)) |
|
53 |
- { |
|
54 |
- fromi <- as.character(df$from[i]) |
|
55 |
- toi <- as.character(df$to[i]) |
|
56 |
- left <- blocks[[fromi]] |
|
57 |
- right <- blocks[[toi]] |
|
58 |
- if (is(right, "YConnector")) |
|
59 |
- right$.upstream[[fromi]] <- left |
|
60 |
- |
|
61 |
- if (is(left, "TConnector")) |
|
62 |
- { |
|
63 |
- orig <- left$.tOuts |
|
64 |
- temp <- TOut() |
|
65 |
- temp$inputPipe <- left |
|
66 |
- right$inputPipe <- temp |
|
67 |
- left$.tOuts <- c(left$.tOuts, temp) |
|
68 |
- } else { |
|
69 |
- right$inputPipe <- left |
|
70 |
- } |
|
71 |
- |
|
72 |
- if (is(right, "ParallelConnector")) { |
|
73 |
- right$.upstream <- .mc_parallel(quote({ |
|
74 |
- while(TRUE) { |
|
75 |
- prime <- yield(left) |
|
76 |
- .mc_sendMaster(prime) |
|
77 |
- }})) |
|
78 |
- |
|
79 |
- } |
|
80 |
- } |
|
81 |
- |
|
82 |
- nms <- local({ |
|
83 |
- g <- graphBAM(df, edgemode="directed") |
|
84 |
- outDeg <- degree(g)$outDegree |
|
85 |
- names(outDeg[outDeg==0]) |
|
86 |
- }) |
|
87 |
- s <- lapply(blocks[nms], stream) |
|
88 |
- for (i in seq_len(len)) |
|
89 |
- blocks[[i]]$inUse <- TRUE |
|
90 |
- s |
|
91 |
-} |
|
92 |
- |
|
93 |
- |