Issue plotting time-stratified DEC+J BSM results using areas_allowed

19 views
Skip to first unread message

Gaby

unread,
Sep 26, 2025, 4:25:23 PMSep 26
to BioGeoBEARS
Hello. I'm trying to run a stochastic mapping analysis of my time-stratified with areas_allowed DEC+J results, but plot_BSM is failing in the following manner: 

Read 11 items
Read 50 items

length(possible_ranges_list_txt) =  382
length(colors_list_for_states) =  256
length(MLstates) =  49
Error in rangestxt_to_colors(possible_ranges_list_txt, colors_list_for_states, :
  Error: possible_ranges_list_txt and colors_list_for_states must be the same length

The issue appears to be that I'm expected to manually apply the areas_allowed filter to my states list. But I don't know how to do this here: 

# Note: If you did something to change the states_list from the default given the number of areas, you would
# have to manually make that change here as well! (e.g., areas_allowed matrix, or manual reduction of the states_list)
states_list_0based = rcpp_areas_list_to_states_list(areas=areas, maxareas=max_range_size, include_null_range=include_null_range)
colors_list_for_states = get_colors_for_states_list_0based(areanames=areanames, states_list_0based=states_list_0based, max_range_size=max_range_size, plot_null_range=TRUE)

So, if you know any way how I could do this, it would be very helpful.

Best,

Gaby.

Nick Matzke

unread,
Oct 24, 2025, 5:05:59 AMOct 24
to BioGeoBEARS
Hi!  The error message is telling you exactly what is wrong.  You need to get those 3 things to have the same lengths.

I believe this is covered here:

Manually modify the states list in time-stratified analyses
http://phylo.wikidot.com/example-biogeobears-scripts#modified_states_stratified

...you may have to put in a little work to track:

Where the colors_list_for_states is generated, and then edit it manually like you did the possible_ranges_list

MLstates I forget, but that must be derived from the inference output. 

Off the top of my head in the middle of the night, I hypothesize that 

* you think you changed the ranges list for the inference, but you actually didn't, so the inference ran with 49 states
* the possible_ranges_list_txt was set up in some fashion, but did not match (or did not get input into) the inference
* colors_list_for_states was set up in a third place, in a 3rd way.

As I have said many times, the "areas_allowed" option has very limited functionality - if I had half a brain I would delete it.  The better approach is to manually modify the states list within the script:

Manually modify the states list in time-stratified analyses
http://phylo.wikidot.com/example-biogeobears-scripts#modified_states_stratified

If you start from a working example script, then modify that, you may have better luck.

Be sure especially to check that max_range_size etc. are consistent throughout the script.

Cheers,
Nick
 

Best,

Gaby.
Reply all
Reply to author
Forward
0 new messages