Modeling a single microsatellite surrounded by 100kb bases

40 views
Skip to first unread message

Mayra Banuelos

unread,
Jun 16, 2022, 11:37:35 AM6/16/22
to slim-discuss
Dear Ben,

Thanks so much for creating slim! I finally get a chance to take advantage of its power :)  

I am using a modified Gravel Model and simulating a chromosome consisting of 100kb bases, 1 STR, and another 100kb bases. I used a chromosome set up as its done in the QTL section.

I have used your sample code for updating the # of repeats for the microsatellite based on mutations but I keep getting an error, specifically in the line msat.tag = repeats. 

"ERROR (EidosValue_Object_vector::SetPropertyOfElements): assignment to a property requires an rvalue that is a singleton (multiplex assignment) or that has a .size() matching the .size of the lvalue."

Could I please get some guidance as to what I am doing wrong here that is causing my simulation to crash? Thank you!

Mayra Banuelos
Modified_Gravel.slim

Ben Haller

unread,
Jun 16, 2022, 11:42:27 AM6/16/22
to Mayra Banuelos, slim-discuss
Hi Mayra!

It sounds like the value you are trying to assign to the mutation's tag property is not a singleton, but a vector containing more than one value.  I would recommend adding a print() call just before that assignment, to see what is in the value you are assigning in to the tag.  Perhaps once you see the values in it you will realize where they came from and what the bug is.  Good luck!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Mayra Banuelos wrote on 6/16/22 8:37 AM:
--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/c9542a3a-82e6-455d-8230-2735f46c441bn%40googlegroups.com.

Mayra Banuelos

unread,
Jun 16, 2022, 12:20:15 PM6/16/22
to slim-discuss
Hi Ben!

Thanks so much for the response. I checked that and it seemed that for some reason the number of repeats would sometimes be empty. So I fixed that by adding an if statement to make sure the vector was not empty. However, I am now getting an error in this line:

mutSites = sample(msatPositions, mutCount);

ERROR (Eidos_ExecuteFunction_sample): function sample() provided with insufficient elements (1 supplied, 2 needed).

If I understand the code correctly, I can fix this by checking that mutCount > 0 before sampling, and by setting mutCount to 1 at the time of sampling since I am modeling a single STR. Does that sound right? 

Thanks so much!

Mayra Banuelos


Ben Haller

unread,
Jun 16, 2022, 12:24:39 PM6/16/22
to Mayra Banuelos, slim-discuss
Hi Mayra.  Well, since I haven't seen your full model script I can't comment on whether that is the right fix or not.  In general, it is important to understand *why* an error is occurring, rather than just working around it.  *Why* would the number of repeats be empty?  You need to understand that in order to fix your code without introducing new bugs; "for some reason" doesn't cut it :->.  Similarly, you need to understand *why* the vector you're passing to sample() contains only one value.  Using "debug points" in SLiMgui can be a useful way to figure out what is going on; the manual has some discussion of this.  Good luck!


Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Mayra Banuelos wrote on 6/16/22 9:20 AM:

Mayra Banuelos

unread,
Jun 16, 2022, 12:26:31 PM6/16/22
to slim-discuss
Hi Ben,

I will check it out. Thank you!

Mayra Banuelos

On Thursday, June 16, 2022 at 11:42:27 AM UTC-4 bha...@mac.com wrote:

Mayra Banuelos

unread,
Jun 16, 2022, 2:14:29 PM6/16/22
to slim-discuss
Found the bugs! Just in case it is helpful for anyone in the future, the first thing was to set the stacking policy of the microsatellite mutation type to "last". That way we don't get the error when updating the number of repeats for having more than one mutation acting on the microsatellite as the tag must take a single value and not a vector. 

Re the error in the sample line, when sampling without replacement, the documentation notes that the size must be at most equal to the size of x. Because I am modeling a single nucleotide this would have to be 1. 

Thanks!
Mayra Banuelos 

Reply all
Reply to author
Forward
0 new messages