Skip to content

moveTrappedPoints crashes R if table distances are all negative for a serum. #147

@drserajames

Description

@drserajames

Sometimes when I'm adjusting the column bases, the column base is lower than the lowest titre for a serum so that all the table distances for that serum are negative. The map optimises just fine, but then I get an error when I try to use moveTrappedPoints that crashes R.

> library(Racmacs)
> packageVersion("Racmacs")
[1] ‘1.1.40’
> 
> set.seed(123)
> dat2 <- 10*2^round(rbind(cbind(matrix(rep(7, 9), ncol=3), matrix(rep(3, 9), ncol=3)),
+                          cbind(matrix(rep(3, 9), ncol=3), matrix(rep(7, 9), ncol=3))))
> dat2[,1] <- dat2[,1]*8
> dat2
      [,1] [,2] [,3] [,4] [,5] [,6]
[1,] 10240 1280 1280   80   80   80
[2,] 10240 1280 1280   80   80   80
[3,] 10240 1280 1280   80   80   80
[4,]   640   80   80 1280 1280 1280
[5,]   640   80   80 1280 1280 1280
[6,]   640   80   80 1280 1280 1280
> 
> 
> map <- make.acmap(dat2, verbose=F, options=list(report_progress = F))
> mtp <- moveTrappedPoints(map)
Checking for trapped points recursively: no trapped points found.
> 
> cb_map <- optimizeMap(map, 2, 100, fixed_column_bases = rep(5,6))
Discarding previous optimization runs.
Performing 100 optimizations
================================================================================
Optimization runs complete
Took 0.05 secs

> cb_mtp <- moveTrappedPoints(cb_map)
Checking for trapped points recursively:terminate called after throwing an instance of 'std::logic_error'
  what():  Cube::min(): object has no elements
zsh: abort      R

I would prefer that moveTrappedPoints worked as normal. If that's not easy, then for an warning message ("Trapped points not moved due to negative table distances for at least one serum"), rather than a crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions