R2 Decay Across Distance

23 views
Skip to first unread message

Soul Young

unread,
Jan 12, 2021, 1:39:20 PM1/12/21
to msprime-users
Hello,

I am trying to fit exponential decay functions of r2 across physical distance of my simulated tree sequences. So far I can retrieve the M x M matrix of r2 of simulations using:

import msprime

tree_sequence=msprime.simulate(sample_size=50, Ne=600, 
                                   length=1e7, recombination_rate=1e-08,
                                  mutation_rate=1e-8)

ld_calc = tskit.LdCalculator(tree_sequence)
A = ld_calc.r2_matrix()


However, I haven't found the best way to turn this matrix into a data structure where I can find the physical distance (in bp) between each SNP in each pairwise computation. 

I can get the M SNP positions with:

variant_positions = [variant.site.position for variant in tree_sequence.variants()]

but after this I'm not sure what's next? I know I can write a VCF of my tree sequences and then compute LD, but I'm trying to keep this computation without producing many intermediate files.

Thanks,
Soul

Jerome Kelleher

unread,
Jan 14, 2021, 7:55:53 AM1/14/21
to msprim...@googlegroups.com
Hi Soul,

I think this would be a great question for the Q&A section of our tskit
Discussions forum (which we're just starting up). Would you mind posting
it there please?

https://github.com/tskit-dev/tskit/discussions/categories/q-a

Cheers,
Jerome
> --
> You received this message because you are subscribed to the Google
> Groups "msprime-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to msprime-user...@googlegroups.com
> <mailto:msprime-user...@googlegroups.com>.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/msprime-users/21b22f20-ad9e-4b80-8e73-ca8526fe4ab1n%40googlegroups.com
> <https://groups.google.com/d/msgid/msprime-users/21b22f20-ad9e-4b80-8e73-ca8526fe4ab1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Soul Young

unread,
Jan 18, 2021, 3:12:48 AM1/18/21
to msprime-users
Ok will do!

Thanks

Reply all
Reply to author
Forward
0 new messages