Hi Laszlo,
firstly, let me apologize for being so slow to respond - the last few weeks have been overwhelming both on a personal and professional level. I hope my reply is still relevant.
Anyway, so the problem you are having is that Bio::Phylo detects a mismatch between the "data type object" that is associated with the matrix and the one associated with the matrix row.
"Data type objects" are helper objects that validate whether the contents of a matrix or a matrix row are valid (for example, for dna data this object checks to see whether all letters in a sequence string conform to the IUPAC single character codes, or are the current symbol for "missing" or for "gap).
You can modify these data type objects to give them a different lookup table that defines how ambiguous states in a character state sequence map onto fundamental states. Again the easiest example is for dna data, where one such mapping is N => [ A, C, G, T ], i.e. the IUPAC single character symbol N is an ambiguity code that can mean any of the underlying nucleotides.
In your code, when you create the matrix object, you give it a modified lookup table that says that 0 only maps onto 0, and 1 onto 1. Typically this only makes sense for restriction site data (or other presence/absence data).
To get the behavior that you want (or, in any case, to make this particular error go away) there is two things you can do:
1. when you create the matrix, leave out the -lookup argument, and its value.
OR:
2. when you create the datum, pass in the data type object associated with the matrix, e.g.
$fac->create_datum( -type_object => $matrix->get_type_object )
My sense from your previous questions is that you might just go with option 1, unless I have misunderstood what you are working on.
Best wishes,
Rutger