Gene flow HPDI from Theta and M

213 views
Skip to first unread message

andersgs

unread,
Sep 2, 2017, 5:27:38 AM9/2/17
to migrate-support
Dear Peter.

I wish to report results as gene flow (Theta x Migration), I would like to also report the uncertainty (ideally the 95% HPDI or some other suitable interval of the posterior density). I am resisting just multiplying the 2.5% and 97.5% values for Theta and Migration because I feel that would inflate the HPDI for gene flow as I would not be taking in to account the covariance between Theta and Migration. Is that correct? Is there a way of getting the HPDI for gene flow from Migrate-N's (3.6.11) current output --- I have a bayesallfile.gz and a bayesfile. Or, would I have to re-run Migrate-N asking to report gene flow instead?

Thank you.

Best regards.

Anders.

Tomas Hrbek

unread,
Sep 2, 2017, 10:32:19 AM9/2/17
to migrate...@googlegroups.com
Dear Peter and Anders,

I have been meaning to ask exactly the same question. I came to the
conclusion that one multiplies theta and mi sampled from the same point
along the mcmc chain to get Nm, and then calculates summary statistic
from these Nm estimates. I hope this is correct. What I did not
satisfactorily figure out is how one gets an estimate from multiple
loci, i.e. how does one combine information from individual loci to get
a multilocus estimate. Can someone let me know?

Thanks a lot,

tomas
> --
> You received this message because you are subscribed to the Google
> Groups "migrate-support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to migrate-suppo...@googlegroups.com
> <mailto:migrate-suppo...@googlegroups.com>.
> To post to this group, send email to migrate...@googlegroups.com
> <mailto:migrate...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/migrate-support.
> For more options, visit https://groups.google.com/d/optout.

Peter Beerli

unread,
Sep 2, 2017, 10:46:47 AM9/2/17
to migrate...@googlegroups.com
Anders and Tomas,
I will give a small example on how to do this, but it will take me today (I had started to work out a small example — but I am not that far yet)
migrate can read the bayesallfile back, but in the 3.x version this is always dicey, but let me construct a small example that discusses this.
I agree that it would be helpful for all users.

Peter
> To unsubscribe from this group and stop receiving emails from it, send an email to migrate-suppo...@googlegroups.com.
> To post to this group, send email to migrate...@googlegroups.com.

Peter Beerli

unread,
Oct 26, 2017, 6:56:59 PM10/26/17
to migrate...@googlegroups.com
Finally I post the answers back to the net> how to convert a run that was done using Theta and M to Theta and xNm if the bayesallfile is available.

Anders Goncalves Da Silva wrote a python script based on a version I wrote earlier:
both handle bayesallfiles to generate Nm values from original M and theta values collected throughout the run.
Anders’ version has a nice option structure but will need a few python modules.
If you use this and/or need more help, post on this thread.

Both versions (mine and Anders') are attached

Peter

M_to_Nm_Beerli.zip
M_to_Nm_GoncalvesDaSilva.zip

KM

unread,
Nov 14, 2017, 8:04:13 AM11/14/17
to migrate-support
Dear Peter,
thanks for the scripts! Your version worked well for me, although I get huge Nm estimates and not in accordance with my calculations done by hand. For the bayesallfile I recorded every 500 parameter steps, maybe not enough info available? My data comes from a fully admixed  population within a fragmented landscape, so I do expect high Nm. I am interested in comparing estimates of Nm between two sampling periods with different levels of connectivity. I attached the original bayesallfile and the output after re-running migrate-n.
Thanks in advance for any input!
Karina
bayesall.1998.M1.gz
outfile.1998.M1

Peter Beerli

unread,
Nov 25, 2017, 9:44:35 AM11/25/17
to migrate...@googlegroups.com
Karina,
it is not clear what you are asking,
the conversion either works or does not: if you start with Theta and M values you should get Theta and 4Nm values,
your outfile suggests that there was no conversion done (still report M values). 
the script simply grabs the Theta_x and the M_y->x values and then returns Theta_x and Theta_x*M_y->x, thus your calculation and the script should give the same answers, in principle.

Your Theta and M values in the 
bayesallfile and your outfile suggest that the 4Nm numbers should be very large. This seems to ask for a model comparison against
panmixia, I guess your data cannot differentiate between a structured and an unstructured population.


Peter

-- 
You received this message because you are subscribed to the Google Groups "migrate-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrate-suppo...@googlegroups.com.
To post to this group, send email to migrate...@googlegroups.com.
Visit this group at https://groups.google.com/group/migrate-support.
For more options, visit https://groups.google.com/d/optout.
<bayesall.1998.M1.gz><outfile.1998.M1>

ALEJANDRA LOPEZ DIAZ

unread,
Feb 21, 2019, 9:09:29 AM2/21/19
to migrate-support
Hi Peter. I run your script in python 3 and python 2.7, but doesn't works. I used the data of your example to test the script and the program returns a .gz file with the same baseallfile.gz's values and the maximum value 0.0. Then, I try to run the script with my data but the program return an error. The server does not allow me to upload my file, I guess from the size. There is a version of python in which it works without any problem?

Error.png

Reply all
Reply to author
Forward
0 new messages