lh3 / psmc

Implementation of the Pairwise Sequentially Markovian Coalescent (PSMC) model
Other
147 stars 60 forks source link

Average over multiple psmc plots for population #3

Open jlrf98 opened 9 years ago

jlrf98 commented 9 years ago

Dear lh3, I have run PSMC on several individuals from a population sample, and would like to plot the average for the population, rather than each individual separately. I am not sure how to do this using the .psmc output files, as the columns in the output are unlabeled. I attempted plotting the last iteration in the .psmc file, taking the rows marked "RS" in the first column, and it appears that plotting the 3rd and 4th column for these rows using R produces a plot similar to the .eps file generated by psmc_plot.pl, albeit unscaled. It would be tremendously useful if you could provide information in the README or elsewhere on how to manually rescale the output in the .psmc files (given a mutation rate m and generation time g), and I would be able to take it from there to calculate the average across samples in a population. Having the flexibility to produce the plots in R would be fantastic. Thanks, Juan

jlrf98 commented 9 years ago

Issue resolved, I found the answers at https://hengli.uservoice.com/forums/152783-general/suggestions/5314226-quantitatively-comparing-psmc-results

Running psmc_plot.pl with -R option produces text files that can be plotted in R

laiqiang0728 commented 3 years ago

Dear Ih3, I'm Running psmc_plot.pl with -R option and pruduces the text file, but i have no idea of each column in the text file refer to. And the website that you mentionded above is no longer valid. I want to combine multiple independently plot onto the a single set of axes for comparison, so my first thought was to use ggplot. Do you have any clear instructions on how to accomplish this?

Thanks, Qiang.

fredjaya commented 3 years ago

@laiqiang0728 I have finally figured it out after extensive trial and error!

Note: I have only tried it on single, non-bootstrapped runs so far.

1. Concatenate the individual .psmc files you wish to plot:

cat sample1.psmc sample2.psmc sampleN.psmc > combined.psmc

2. Plot using multiline mode:

psmc_plot.pl [options] -M 'sample1,sample2,sampleN' [prefix] combined.psmc 
gubrins commented 2 years ago

how would you do it @fredjaya if you also want to add the bootstrap for each sample?