hapsburg.PackagesSupport.simData ================================ .. py:module:: hapsburg.PackagesSupport.simData Attributes ---------- .. autoapisummary:: hapsburg.PackagesSupport.simData.sim Classes ------- .. autoapisummary:: hapsburg.PackagesSupport.simData.Simulator hapsburg.PackagesSupport.simData.BinomSim hapsburg.PackagesSupport.simData.BinomSimCopyBoth hapsburg.PackagesSupport.simData.SimRef hapsburg.PackagesSupport.simData.BinomSimRefNoLD hapsburg.PackagesSupport.simData.MultiVariateNormalLD Module Contents --------------- .. py:class:: Simulator(refsim='BinomialNoLD') Bases: :py:obj:`object` Simulator Class for HMMs. This is the main Class, all specific Simulators can inherit from it and overwrite functions. Contains Parameters .. py:attribute:: l :value: 10000 .. py:attribute:: lats :value: [] .. py:attribute:: pure_stat :value: [] .. py:attribute:: ob_stat :value: [] .. py:attribute:: ref_states :value: [] .. py:attribute:: ref_sim :value: 0 .. py:attribute:: stats .. py:method:: set_ref_sim(sim) Set the Reference Simulator to sim .. py:method:: simulate_latent() :abstractmethod: Simulate all l latent States .. py:method:: error_model() Apply error model to all l latent States .. py:method:: simulate_full() Return all Statistics .. py:method:: simulate_ref() Generate the reference Data Set .. py:method:: apply_error() Applies the Error Model .. py:method:: copyHaplo() :abstractmethod: Copy from Haplotypes Refs via latent states .. py:method:: save_data(folder='../Simulated/Test0/') Save the simulated Data to a Directory .. py:method:: save_parameters(folder='../Simulated/Test0/') Save Parameters of Simulation .. py:class:: BinomSim(refsim='BinomialNoLD') Bases: :py:obj:`Simulator` Bimomial Simulator. Assume equally spaced SNPs. Copying: 0: From HW state. 1,...,n from Reference Data Set [n] .. py:attribute:: spacing :value: [] .. py:attribute:: roh_in :value: 0.002 .. py:attribute:: roh_out :value: 0.01 .. py:attribute:: roh_jump :value: 0.1 .. py:method:: set_cons_spacing() Set the spacing of SNPs .. py:method:: set_params() :abstractmethod: Set the parameters .. py:method:: save_parameters(folder) Save Parameters to parameter.csv in folder .. py:method:: first_state() Generate the first latent state .. py:method:: sim_copying() Simulate the Vector with States to copy from .. py:method:: jump_no_roh() Generate length and next state not in ROH .. py:method:: jump_roh() Generate length and next state in ROH .. py:method:: simulate_latent() Simulate l latent States .. py:method:: copyHaplo() Copy from Haplotypes Refs via latent states .. py:class:: BinomSimCopyBoth(refsim='BinomialNoLD') Bases: :py:obj:`Simulator` Bimomial Simulator. Assume equally spaced SNPs. Copy from two Individuals, even in non-ROH state .. py:attribute:: spacing :value: [] .. py:attribute:: roh_in :value: 0.002 .. py:attribute:: roh_out :value: 0.002 .. py:attribute:: roh_jump :value: 0.1 .. py:method:: set_cons_spacing() Set the spacing of SNPs .. py:method:: set_params() :abstractmethod: Set the parameters .. py:method:: jump_roh() Generate length and next state in ROH .. py:method:: sim_copying_inroh() Simulate Copying within ROH. Return Copy State [l] .. py:method:: sim_roh_inout() Return 0 1 vector [l] wether in or out ROH state .. py:method:: simulate_latent() Simulate and Return Vector with States to copy from .. py:method:: copyHaplo() Copy from Haplotypes Refs via latent states .. py:class:: SimRef Bases: :py:obj:`object` Class for Simulating the Reference Strings .. py:attribute:: refs :value: [] .. py:attribute:: haps :value: [] .. py:method:: simulate_refs() :abstractmethod: Simulate and return Reference Strings .. py:method:: set_params(**kwargs) Set Attributes with keyworded Arguments .. py:method:: plot_ld_r2(haps=[], l=200, fs=18) Plot R2 across pw. Distances of SNPs .. py:class:: BinomSimRefNoLD Bases: :py:obj:`SimRef` Simulate References under a Binomial Model. For the moment: Do not do any LD Structure .. py:attribute:: h :value: 2 .. py:attribute:: k :value: 100 .. py:attribute:: l :value: 1000 .. py:attribute:: p :value: 0.5 .. py:method:: simulate_refs() Simulate References under a Binomial Model .. py:class:: MultiVariateNormalLD Bases: :py:obj:`SimRef` Simulate References under a Multivariate Normal Model. Simulate latent variable and push them through a logit function .. py:attribute:: l :value: 1000 .. py:attribute:: k :value: 100 .. py:attribute:: cov_dist :value: 200 .. py:method:: logit(x) Define a Logit Function .. py:method:: simulate_refs() Simulate References under the multivariate Normal Model .. py:data:: sim