OptGene (COBRA Toolbox) error: population

59 views
Skip to first unread message

Miguel Guerreiro

unread,
Jun 2, 2017, 2:15:35 PM6/2/17
to COBRA Toolbox
Hi everyone!

I've tried using the OptGene with the following code:
>>optGene(model, targetRxn, biomassRxn, selectedRxnList, 2, {[10:10]})

and there appears to be an error in the population part (
{[10:10]}).
What appears is the following:

Error using double
Conversion to double from cell is not possible.

Error in optGene (line 79)
InitialPopulation = double(population);


Can anyone help me with this?

Thank you so much in advance!

SEBASTIAN MENDOZA

unread,
Jun 9, 2017, 10:55:29 AM6/9/17
to COBRA Toolbox
Hi Miguel. 

Thanks for your question. 

I see three errors in your code: 

1) First, population should be a matrix, not a scalar, not a vector. a = [10:10] -> a = 10 -> "a" is a scalar

population matrix has dimensions: 
number of rows = sum(PopulationSize)    (Defaulf number for PopulationSize = [125 125 125 125]), so number of rows = 500
number of columns = number of variables, i.e., number of genes in the cell array "generxnList" (fourth input of OptGene function)

2) Second, population should be a logical matrix not a cell. a = {[10:10]})

>> iscell({[10:10]})

ans =

     1

3) population should only contain 0s or 1s. 

I suggest not to use PopulationSize as an input unless you are dealing with a time-consuming case (several days)
I you have more questions, don't hesitate to ask. 

Best regards,

Miguel Guerreiro

unread,
May 16, 2018, 3:36:28 PM5/16/18
to COBRA Toolbox
Thank you so much, this really helped!

Do you happen to use RobustKnock as well?


Best regards,
Miguel.
Reply all
Reply to author
Forward
0 new messages