Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid 'type' (list) of argument #127

Open
ArtPoon opened this issue Oct 13, 2020 · 2 comments
Open

invalid 'type' (list) of argument #127

ArtPoon opened this issue Oct 13, 2020 · 2 comments
Assignees

Comments

@ArtPoon
Copy link
Contributor

ArtPoon commented Oct 13, 2020

Ran into a different problem:

> set.seed(1234)
> outer.tree <- load.outer.tree(model)
> plot(outer.tree)
Error in max(sapply(comp$get.lineages(), function(line) line$get.sampling.time())) : 
  invalid 'type' (list) of argument

This occurs because the comp object has no Lineages:

> node
[1] "ID316_1"
> comp
<Compartment>
  Public:
    add.lineage: function (new.lineage) 
    clone: function (deep = FALSE) 
    copy: function (deep = FALSE) 
    get.branching.time: function () 
    get.lineages: function () 
    get.name: function () 
    get.sampling.time: function () 
    get.source: function () 
    get.type: function () 
    initialize: function (name = NA, type = NA, source = NA, branching.time = NA, 
    is.unsampled: function () 
    remove.lineage: function (ex.lineage) 
    set.branching.time: function (new.branching.time) 
    set.sampling.time: function () 
    set.source: function (new.source) 
    set.type: function (new.type) 
    set.unsampled: function (is.unsampled) 
  Private:
    branching.time: 519
    deep_clone: function (name, value) 
    lineages: list
    name: ID316_1
    sampling.time: NA
    source: Compartment, R6
    type: CompartmentType, R6
    unsampled: FALSE
> comp$get.lineages()
list()

Originally posted by @ArtPoon in https://github.com/PoonLab/twt/issue_comments/577884445

@ewong347
Copy link
Collaborator

Not sure that comp object necessarily has no Lineages to fail... Continuing to debug

Comparing outputs for:

outer$get.sampling.times()
outer$get.lineages()

Failed YAML:

> outer$get.sampling.times()
$Active_1__A_1
[1] 0

> plot(outer)
Error in max(sapply(comp$get.lineages(), function(line) line$get.sampling.time())) : 
 invalid 'type' (list) of argument
> outer$get.lineages()
$Active_1__A_1
<Lineage>
 Public:
   clone: function (deep = FALSE) 
   copy: function (deep = FALSE) 
   get.location: function () 
   get.name: function () 
   get.sampling.time: function () 
   get.type: function () 
   initialize: function (name = NA, type = NA, sampling.time = NA, location = NA) 
   parent: NULL
   set.location: function (comp) 
   set.location.by.name: function (locationList, new.locationName) 
 Private:
   location: Compartment, R6
   name: Active_1__A_1
   sampling.time: 0
   type: virus

Working YAML

> outer$get.lineages()
$A_1__1_1
<Lineage>
  Public:
    clone: function (deep = FALSE) 
    copy: function (deep = FALSE) 
    get.location: function () 
    get.name: function () 
    get.sampling.time: function () 
    get.type: function () 
    initialize: function (name = NA, type = NA, sampling.time = NA, location = NA) 
    parent: NULL
    set.location: function (comp) 
    set.location.by.name: function (locationList, new.locationName) 
  Private:
    location: Compartment, R6
    name: A_1__1_1
    sampling.time: 0
    type: virus
[...]


> outer$get.sampling.times()
$A_1__1_1
[1] 0

[...]

@ewong347
Copy link
Collaborator

In conversation with @RouxCil, this error comes from not specifying parameter branching.time, so a somewhat expected error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants