possible to output two tree sequences?

37 views
Skip to first unread message

bob

unread,
Dec 3, 2021, 7:50:18 PM12/3/21
to slim-discuss
hi!

i'm curious if it's possible spit out two separate tree sequences from slim. for example, i might have two populations representing two different species. i would want to treat the two tree sequences as separate entities in downstream processing, including independent simplification and recapitation for each tree. has anyone tried this? any ideas?

thanks
bob

Ben Haller

unread,
Dec 3, 2021, 7:57:41 PM12/3/21
to slim-discuss
SLiM can only output the tree sequence for the whole simulation, but you should be able to just simplify down to two different "samples" on the python side of things, I think?

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


bob

unread,
Dec 4, 2021, 7:52:45 PM12/4/21
to slim-discuss
thanks for the response ben!

yea, that's what ive been doing (subsetting by "population", where "population" for me = species). however, this approach requires either the two species to have the same genetic architecture or for each species to carry a "dummy" chromosome which corresponds to the genome of the adjacent species. i haven't found a feature of tskit that allows for truncating chromosomes, just deleting information at intervals of loci or sites. it creates a lot of bookkeeping in downstream processing/analysis that would be nice to sidestep. perhaps this is more of tskit issue than a slim issue...

best
bob

Ben Haller

unread,
Dec 4, 2021, 8:25:31 PM12/4/21
to slim-discuss
Well, it's a SLiM issue inasmuch as SLiM could let you simulate multiple species, with different genetics and so forth.  That's on the to-do list.  :->  But barring that rather large new feature, yes, the situation you're in is pretty much a tskit issue not a SLiM issue.  :->


Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


bob wrote on 12/4/21 7:52 PM:
--
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/bce98c87-7ea1-4f88-bda9-b7c6934d933cn%40googlegroups.com.

hyan...@googlemail.com

unread,
Dec 5, 2021, 2:46:40 PM12/5/21
to slim-discuss
Just to say that ts.rtrim() will truncate chromosomes from which the right hand end has been deleted using ts.delete_intervals() or ts.keep_intervals()

Yan

bob

unread,
Dec 6, 2021, 1:20:06 PM12/6/21
to slim-discuss
thanks for the suggestion yan! i think this is exactly what i need :)

Peter Ralph

unread,
Dec 6, 2021, 10:34:17 PM12/6/21
to hyan...@googlemail.com, slim-discuss
We deal with this by having different mutation types for each species,
and a script block that removes any mutations of the wrong type from
each species each generation. (However, they still have to have the
same genome length and recombination map, true - separate chromosomes
would be a nicer way to do it!)
> --
> 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/f00f77af-b01a-425a-9fad-f8be63da45b0n%40googlegroups.com.

bob

unread,
Dec 7, 2021, 8:28:49 PM12/7/21
to slim-discuss
hey peter,

the way im doing it now incorporates yan's suggestion. i make two subpopulations, one for each species. i dedicate the first L1 loci (where L1 is a number) to species 1 and the next L2 loci to species two. i delete mutations landing on the "wrong" part of the chromosome (ie, the part of the chromosome corresponding to the species of which the focal individual is not a member) [im not sure if this step is necessary given my downstream processing]. in tskit, i subset the treequence by subpopulation (~species), use ts.delete_intervals() to delete information in the wrong parts of the chromosomes, and then ts.rtrim() for species 1 and ts.ltrim() for species 2 to isolate the chromosomes of each species. then i recapitate, mutate, output vcf, etc. i still need to triple check all the details, but i believe this results in cleanly separated chromosomes for each species. scripts available upon request.

best,
bob
Reply all
Reply to author
Forward
0 new messages