hapsburg.figures.plot_individual_roh
Plotting function to plot karyotype plot of ROH from hapsburg output @ Author: Harald Ringbauer, 2019, All rights reserved
Functions
|
Load the ROH Dataframe for Individual iid and |
|
Post Process ROH Dataframe. |
|
Get and return length of Chromosome ch |
|
Load ROH of one Individual |
|
Load areas of low SNP density, and return list of Dataframes |
|
Plot a Chromosome of length l with centromer ctr on ax |
|
Plot ROH in one ancient Individual. |
|
Gives back the pdfs for Blocks of Length l [Morgan] |
|
Calculate the PDF of ROH blocks of length x [Morgan] |
|
Calculate Coalescence Probability. |
|
Calculates the Expected Nr of ROH Blocks per Morgan for full Individual |
|
Plot Histograms/PDEs of ROH Distribution for one Individual (iid) |
Module Contents
- hapsburg.figures.plot_individual_roh.load_roh(iid, ch, path_folder='./Empirical/1240k/', prefix_out='e01/')
Load the ROH Dataframe for Individual iid and Chromosome ch
- hapsburg.figures.plot_individual_roh.post_process_roh_df1(df, min_cm=4, snp_cm=100, output=False)
Post Process ROH Dataframe. min_cm: Minimum Length in CentiMorgan snp_cm: How many SNPs per CentiMorgan
- hapsburg.figures.plot_individual_roh.chrom_length(ch, ch_lengths=[], output=False)
Get and return length of Chromosome ch If ch_lengths not given, use default (from Eigenstrat map). Atm only do autosomes!
- hapsburg.figures.plot_individual_roh.load_individual_roh(iid, min_cm=4, gap=0.0, snp_cm=50, path_folder='./Empirical/1240k/', prefix_out='', folder='./Empirical/1240k/', output=False)
Load ROH of one Individual
- hapsburg.figures.plot_individual_roh.load_bad_areas(path='./Data/1000Genomes/Markers/1240k/snp_density.csv', min_snps=50)
Load areas of low SNP density, and return list of Dataframes (one for each chromosome)
- hapsburg.figures.plot_individual_roh.plot_chromosome(ax, l, x_pos, lw=24, df_roh=[], df_low=[])
Plot a Chromosome of length l with centromer ctr on ax at x_pos
- hapsburg.figures.plot_individual_roh.plot_roh_individual(iid='MA89', fs=12, figsize=(8, 8), savepath='', min_cm=4, snp_cm=50, gap=0.0, folder='./Empirical/1240k/MarcusAncs/', prefix_out='', plot_bad=True, title='True', output=False)
Plot ROH in one ancient Individual. gap: What Gap to Merge [in cM!] prefix_out: If there is a folder before indivual data, e.g. e01/
- hapsburg.figures.plot_individual_roh.expected_block_pdf(x, chr_l, m)
Gives back the pdfs for Blocks of Length l [Morgan] on a Chromosome of Length [Morgan]. m: Nr of Meiosis. Return PDF (per Morgan)
- hapsburg.figures.plot_individual_roh.expected_block_pdf_chromosomes(x, chr_lgts, m)
Calculate the PDF of ROH blocks of length x [Morgan] for m Recombination events x: Can be Array chr_lgts: Array of all chromosome lengths [in Morgan] Return PDF (per Morgan)
- hapsburg.figures.plot_individual_roh.coal_prob(m, comm_anc=1)
Calculate Coalescence Probability. m: Nr of Meiosis comm_anc: How many common ancestors
- hapsburg.figures.plot_individual_roh.exp_blocks_full_individual(x, m, comm_anc=1)
Calculates the Expected Nr of ROH Blocks per Morgan for full Individual x: Array of Block Lenths m: Nr of Meisois comm_anc: Nr of Ancestry Loops
- hapsburg.figures.plot_individual_roh.plot_pde_individual(iid='MA89', figsize=(8, 6), min_cm=4, snp_cm=50, bw_cm=4, kde_plot=False, plotlim=[4, 100], savepath='', folder='./Empirical/1240k/', prefix_out='e01/', output=False, gap=0.0, lw_curve=3, comm_ancs=[4, 4, 4, 2], ms=[6, 5, 4, 3], labels=['First Cousins', 'Aunt/Nephew', 'Full Siblings', 'Parent/Offpsring'], cs=['red', 'green', 'orange', 'gray'], title='', leg_loc='upper right')
Plot Histograms/PDEs of ROH Distribution for one Individual (iid) If list of k iids given, load all ROH and plot all of them, and the expected value for k individuals. bw_cm: Length of one Bin (in cM) comm_ancs: How many common ancestors to plot [list] In number of haplotypes ms: How many meiosis to plot [list] labels: what labels do they have [list] cs: what colors to plot [list] kde_plot: If True fit and plot a KDE to the ROH histogram