ancIBD.postprocessing

Class for calling IBD from Posterior Data. Saves results as tab seperated .tsv created by Pandas and Numpy Contains Sub-Classes, as well as factory Method. Pls always change parameters with set_params method! @ Author: Harald Ringbauer, 2020

Module Contents

Classes

PostProcessing

Class that can do PostProcessing of HAPSBURG output.

NoPostProcessing

Class that does no Postprocessing

IBD2Postprocessing

Class that can do PostProcessing of HAPSBURG output.

Functions

load_Postprocessing([p_model])

Factory Method for PostProcessing class

class ancIBD.postprocessing.PostProcessing(folder='')

Bases: object

Class that can do PostProcessing of HAPSBURG output. (for one individual). Sometimes post-processing is done outside that, Has Methods to save the output. Saves using standard hapROH format

folder = ''
cutoff_post = 0.99
min_cm = 4
max_gap = 0.01
save = 0
output = True
ch = 3
iid = 'iid0'
mask = ''
set_params(**kwargs)

Set the Parameters. Takes keyworded arguments

roh_posterior(posterior0)

Calculate the IBD posterior. Input: Posterior 0 [l] Output: 1 - Posterior 0 [l]

ibd_stat_to_block(ibd)

Convert IBD status per marker into list of ibd. Input: IBD stats [l] boolean. Return start and end indexes of IBD blocks

create_df(starts, ends, starts_map, ends_map, l, l_map, ch, starts_bp, ends_bp, min_cm, iid1, iid2='')

Create and returndthe hapBLOCK/hapROH dataframe.

merge_called_blocks(df, max_gap=0)

Merge Blocks in Dataframe df and return merged Dataframe

save_output(df, r_map=[], post=[], save_folder='')

Save hapBLOCK output in standardized format.

save_ibd_df(df_ibd, save_path)

Save IBD Dataframe to path save_path

mask_regions(df)
call_roh(r_map, bp, post0, iid1='', iid2='')

Call ROH of Homozygosity from Posterior Data bigger than cutoff. post0: posterior in format [5,l], log space

class ancIBD.postprocessing.NoPostProcessing(folder='')

Bases: PostProcessing

Class that does no Postprocessing

call_roh(**kwd)

Does nothing

class ancIBD.postprocessing.IBD2Postprocessing(folder='')

Bases: PostProcessing

Class that can do PostProcessing of HAPSBURG output. (for one individual). Sometimes post-processing is done outside that, Has Methods to save the output. Saves using standard hapROH format

min_cm2_init = 1.0
min_cm2_after_merge = 2.0
cutoff_post1 = 0.99
cutoff_post2 = 0.975
create_df(starts, ends, starts_map, ends_map, l, l_map, starts_bp, ends_bp, ch, min_cm, iid1, iid2, segment_type='IBD1')

Create and returndthe hapBLOCK/hapROH dataframe.

get_posterior(post0)
call_roh(r_map, bp, post0, iid1='', iid2='')

Call ROH of Homozygosity from Posterior Data bigger than cutoff. post0: posterior in format [7,l], log space

ancIBD.postprocessing.load_Postprocessing(p_model='hapROH')

Factory Method for PostProcessing class