bschiffthaler / seidr

Toolkit to create crowd networks
GNU General Public License v3.0
2 stars 1 forks source link

R - seidr_chunked_apply crashes if chunksize larger than number of edges #13

Closed nicolasDelhomme closed 5 years ago

nicolasDelhomme commented 5 years ago

Here is an example to reproduce it:

networkfile <- "/mnt/picea/projects/functional-genomics-course/summer2018/aspleaf/backbone/aspleaf-backbone-1-percent.sf"

# file has 60k edges
sf <- SeidrFileFromPath(networkfile)

# works
system.time(sranges <- seidr_chunked_apply(sf,
chunksize = 1e4,
FUN = function(edge_data) {
mins <- colMins(do.call(rbind, edge_data$score), na.rm = TRUE)
maxs <- colMaxs(do.call(rbind, edge_data$score), na.rm = TRUE)
list(mins, maxs)
}))

# fails
system.time(sranges <- seidr_chunked_apply(sf,
                                           chunksize = 1e5,
                                           FUN = function(edge_data) {
                                               mins <- colMins(do.call(rbind, edge_data$score), na.rm = TRUE)
                                               maxs <- colMaxs(do.call(rbind, edge_data$score), na.rm = TRUE)
                                               list(mins, maxs)
                                           }))