hapsburg.PackagesSupport.simData

Attributes

sim

Classes

Simulator

Simulator Class for HMMs.

BinomSim

Bimomial Simulator.

BinomSimCopyBoth

Bimomial Simulator.

SimRef

Class for Simulating the Reference Strings

BinomSimRefNoLD

Simulate References under a Binomial Model.

MultiVariateNormalLD

Simulate References under a Multivariate Normal Model.

Module Contents

class hapsburg.PackagesSupport.simData.Simulator(refsim='BinomialNoLD')

Bases: object

Simulator Class for HMMs. This is the main Class, all specific Simulators can inherit from it and overwrite functions. Contains Parameters

l = 10000
lats = []
pure_stat = []
ob_stat = []
ref_states = []
ref_sim = 0
stats
set_ref_sim(sim)

Set the Reference Simulator to sim

abstractmethod simulate_latent()

Simulate all l latent States

error_model()

Apply error model to all l latent States

simulate_full()

Return all Statistics

simulate_ref()

Generate the reference Data Set

apply_error()

Applies the Error Model

abstractmethod copyHaplo()

Copy from Haplotypes Refs via latent states

save_data(folder='../Simulated/Test0/')

Save the simulated Data to a Directory

save_parameters(folder='../Simulated/Test0/')

Save Parameters of Simulation

class hapsburg.PackagesSupport.simData.BinomSim(refsim='BinomialNoLD')

Bases: Simulator

Bimomial Simulator. Assume equally spaced SNPs. Copying: 0: From HW state. 1,…,n from Reference Data Set [n]

spacing = []
roh_in = 0.002
roh_out = 0.01
roh_jump = 0.1
set_cons_spacing()

Set the spacing of SNPs

abstractmethod set_params()

Set the parameters

save_parameters(folder)

Save Parameters to parameter.csv in folder

first_state()

Generate the first latent state

sim_copying()

Simulate the Vector with States to copy from

jump_no_roh()

Generate length and next state not in ROH

jump_roh()

Generate length and next state in ROH

simulate_latent()

Simulate l latent States

copyHaplo()

Copy from Haplotypes Refs via latent states

class hapsburg.PackagesSupport.simData.BinomSimCopyBoth(refsim='BinomialNoLD')

Bases: Simulator

Bimomial Simulator. Assume equally spaced SNPs. Copy from two Individuals, even in non-ROH state

spacing = []
roh_in = 0.002
roh_out = 0.002
roh_jump = 0.1
set_cons_spacing()

Set the spacing of SNPs

abstractmethod set_params()

Set the parameters

jump_roh()

Generate length and next state in ROH

sim_copying_inroh()

Simulate Copying within ROH. Return Copy State [l]

sim_roh_inout()

Return 0 1 vector [l] wether in or out ROH state

simulate_latent()

Simulate and Return Vector with States to copy from

copyHaplo()

Copy from Haplotypes Refs via latent states

class hapsburg.PackagesSupport.simData.SimRef

Bases: object

Class for Simulating the Reference Strings

refs = []
haps = []
abstractmethod simulate_refs()

Simulate and return Reference Strings

set_params(**kwargs)

Set Attributes with keyworded Arguments

plot_ld_r2(haps=[], l=200, fs=18)

Plot R2 across pw. Distances of SNPs

class hapsburg.PackagesSupport.simData.BinomSimRefNoLD

Bases: SimRef

Simulate References under a Binomial Model. For the moment: Do not do any LD Structure

h = 2
k = 100
l = 1000
p = 0.5
simulate_refs()

Simulate References under a Binomial Model

class hapsburg.PackagesSupport.simData.MultiVariateNormalLD

Bases: SimRef

Simulate References under a Multivariate Normal Model. Simulate latent variable and push them through a logit function

l = 1000
k = 100
cov_dist = 200
logit(x)

Define a Logit Function

simulate_refs()

Simulate References under the multivariate Normal Model

hapsburg.PackagesSupport.simData.sim