ancIBD.plot.plot_karyotype
Module Contents
Functions
|
Get and return length of Chromosome ch |
|
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. |
|
Make Karyotype Plot from IBD dataframe. |
|
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 IBD Distribution for one Individual (iid) |
|
df_ibd: List of IBD or ROH in standard hapROH, bapBLOCK format |
- ancIBD.plot.plot_karyotype.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!
- ancIBD.plot.plot_karyotype.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)
- ancIBD.plot.plot_karyotype.plot_chromosome(ax, l, x_pos, lw=24, df_roh=[], df_low=[], c_back='lightgray', c_ibd='maroon')
Plot a Chromosome of length l with centromer ctr on ax at x_pos
- ancIBD.plot.plot_karyotype.plot_segments_individual(df_ibd, fs=12, figsize=(8, 8), savepath='', plot_bad=True, title='', plot=True, c_back='lightgray', c_ibd='maroon')
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/ c_back: Background Karyotype color. c_ibd: Foreground IBD
- ancIBD.plot.plot_karyotype.plot_karyo_from_ibd_df(df_ibd, iids=[], min_cm=12, c_back='silver', c_ibd='darkslateblue', savepath='', fs=13, figsize=(7, 7), title='', **kwargs)
Make Karyotype Plot from IBD dataframe. df_ibd: List of IBD or ROH in standard hapROH, bapBLOCK format iids: [iid1, iid2] min_cm: Minimum Length of IBDs to plot [in cM] savepath: Where to save individuals title: What title to add. kwargs: Pass on Keyword arguments to the plotting function
- ancIBD.plot.plot_karyotype.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)
- ancIBD.plot.plot_karyotype.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)
- ancIBD.plot.plot_karyotype.coal_prob(m, comm_anc=1)
Calculate Coalescence Probability. m: Nr of Meiosis comm_anc: How many common ancestors
- ancIBD.plot.plot_karyotype.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 [in Morgan] m: Nr of Meisois comm_anc: Nr of Ancestry Loops
- ancIBD.plot.plot_karyotype.plot_pde_individual(df_ibd, figsize=(8, 6), bw_cm=4, plotlim=[4, 100], savepath='', output=False, lw_curve=3, comm_ancs=[4, 4, 4, 2], ms=[4, 6, 5, 4], labels=['First Cousins', 'Second Cousins', '5 generations anc.', '4 generations anc.'], cs=['red', 'green', 'orange', 'gray'], ls=[], title='', leg_loc='upper right')
Plot Histograms/PDEs of IBD Distribution for one Individual (iid) bw_cm: Length of one Bin (in cM) comm_ancs: How many common ancestors to plot [list] ms: How many meiosis to plot [list] labels: what labels do they have [list] cs: what colors to plot [list]
- ancIBD.plot.plot_karyotype.plot_pde_individual_from_ibd_df(df_ibd, iids=[], min_cm=12, figsize=(8, 6), comm_ancs=[4, 4, 2, 2], ms=[4, 6, 5, 4], labels=['First Cousins', 'Second Cousins', '5 generations anc.', '4 generations anc.'], cs=['red', 'green', 'orange', 'gray'], ls=[], title='', bw_cm=4, plotlim=[4, 100], lw_curve=3, leg_loc='upper right', output=False, savepath='')
df_ibd: List of IBD or ROH in standard hapROH, bapBLOCK format iids: [iid1, iid2] min_cm: Minimum Length of IBDs to plot [in M] savepath: Where to save individuals