hapsburg.figures.plot_ibdx ========================== .. py:module:: hapsburg.figures.plot_ibdx .. autoapi-nested-parse:: Plotting function to plot IBD X Estimates from Ne @ Author: Harald Ringbauer, 2020, All rights reserved Functions --------- .. autoapisummary:: hapsburg.figures.plot_ibdx.new_column hapsburg.figures.plot_ibdx.give_sub_df hapsburg.figures.plot_ibdx.give_stats_cm_bin hapsburg.figures.plot_ibdx.get_IBD_stats hapsburg.figures.plot_ibdx.get_IBD_stats_pops hapsburg.figures.plot_ibdx.get_ci_counts hapsburg.figures.plot_ibdx.create_Ne_roh_nr hapsburg.figures.plot_ibdx.create_ne_dct hapsburg.figures.plot_ibdx.plot_IBD_fracs hapsburg.figures.plot_ibdx.plot_ibd_curves hapsburg.figures.plot_ibdx.plot_ne_dct Module Contents --------------- .. py:function:: new_column(df, df_meta, col='New Clade', col_new='', match_col='iid') Maps Entries from meta dataframe onto the IBD dataframe. Return modified dataframe .. py:function:: give_sub_df(df, pop1='La Caleta', pop2='La Caleta', col='clst', output=True, exact=False) Return sub dataframe where pair across pop1 and pop2 .. py:function:: give_stats_cm_bin(df, cms=[4, 6, 8, 10, 12], col_b='n_roh>', output=True) print some stats about IBD dataframe df col_b: Start of IBD/ROH column. If one of cms 0 use open upper bound .. py:function:: get_IBD_stats(df, pop1='', pop2='', col='clade', col_b='n_roh>', cms=[4, 6, 8, 10, 12], output=False, a=0.05) Get IBD fraction statistics. a: Signficance level Return fractions, confidence intervalls as well as number of pairsise comparisons col_b: Start of IBD/ROH column .. py:function:: get_IBD_stats_pops(df, pops1=[], pops2=[], col='clade', col_b='n_roh>', cms=[4, 6, 8, 10, 12], output=False, a=0.05) Get IBD fraction statistics for list of pop pairs. Returns lists of fractions, confidence intervalls as well as number of pairsise comparisons. a: Significance Level col_b: Start of IBD/ROH column .. py:function:: get_ci_counts(counts, n, a=0.05, minc=0.0001) Get Confidence Intervalls from counts and trials. Return list of CIS (lentght 2 each) counts: Array of Counts n: Total number of trials a: Signficance level .. py:function:: create_Ne_roh_nr(Ns=[400, 800, 1600, 3200, 6400], bins=[[0.04, 0.08], [0.08, 0.12], [0.12, 0.2], [0.2, 3.0]], bin_n=10000, chr_lgts=[]) Create ROH sharing in list of bins (list of [begin,end]) for panmictic population sizes Ns: List of population sizes bins: Length Bins (in Morgan) to calculate expectations from return sharing [len(degrees), len(bins)] .. py:function:: create_ne_dct(cms, ns, chr_lgts=[1.8085 * 2 / 3]) Create Dictionary of Ne .. py:function:: plot_IBD_fracs(ax, cms1, fracs, cis=[], n=0, c='maroon', xlim=[4, 12], ylim=[0.001, 1.0], fs=(6, 6), lw=2, ms=6, yscale='log', show=False, hlines=[], lw_h=0.8, label='') Plot IBD fractions in cM bins. Plots on axis. ax: Axis to plot on. cms1: Vector of cM mean bins. fracs: Fractions to plot on y cis: Confidence Intervals [n elements of length 2] .. py:function:: plot_ibd_curves(figsize=(6, 6), labels=[], cms=[], fracs=[], cis=[], fs_big=16, fs_l=12, fs_t=12, label_idx=-1, xlim=[4, 12], ylim=[0.005, 1.1], colors=[], ylabel='# IBD per pair of male X', xlabel='centimorgan [2 cM bins]', savepath='', dpi=400, leg_loc='upper right', hlines=[0.001, 0.01, 0.1, 1.0], offset=0, dct_ne={}, frameon=False) Plot IBD X curves on one plot. offset: Offset along x axis of each y value. label_idx: If>=0 Plot Ne labels on curves on according bin .. py:function:: plot_ne_dct(ax, dct_ne={}, bins=[], label_idx=-1, c='lightgray', fs=12) Plot ne: ROH sharing onto axis