wangke16 / MSMC-IM

A tool for estimating time-dependent migration rates based on cross-/within-population coalescent rates from MSMC
16 stars 2 forks source link

R script to plot MSMC-IM results #9

Closed DuttaAnik closed 1 year ago

DuttaAnik commented 2 years ago

Dear Wang,

Is there any custom R-script to plot the migration rate manually rather than the automatic generation by using the options in MSMC-IM.py?

If there is any formula that I need to scale the variable to the plot, then can you please let me know? thank you.

Regards Anik

stschiff commented 2 years ago

I'm pinging @wangke16

DuttaAnik commented 1 year ago

Dear Dr. Schiffels,

Have you received any response from @wangke16?

wangke16 commented 1 year ago

Hi, you could do ggplot in R (see pseudo code bellow). if you would like to visualise migration rate in years, then you need scale the time to years by multiplying the generation time (assuming 29 years) before plotting.

ggplot(msmcim_m, aes(x = t, y = m)) + geom_ribbon(aes(ymin=0, ymax = m)) + scale_x_continuous(limits = c(1e3,2e7), breaks=c(1e3,1e4,4e4,8e4,2e5,6e5,1e6,4e6,8e6), trans='log10') + theme_bw() + labs(title="migration rate (view backward in time)", x = "years(log)")

DuttaAnik commented 1 year ago

Hi, thank you very much for the code. I already figured it out. I thought it has some kind of formula similar to when plotting relative cross-coalescent from MSMC2. Thank you very much, anyways.

Regards Anik