---

title: Core module

keywords: fastai
sidebar: home_sidebar

summary: "The core functions for making CHP markers"
description: "The core functions for making CHP markers"
nb_path: "nbs/01_Core.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/01_Core.ipynb
# command to build the docs after a change: nbdev_build_docs

-->

<div class="container" id="notebook-container">
        
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="1.-import">1. import<a class="anchor-link" href="#1.-import"> </a></h3>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="2.-RData-class">2. RData class<a class="anchor-link" href="#2.-RData-class"> </a></h3>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="RData" class="doc_header"><code>class</code> <code>RData</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L36" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>RData</code>(<strong><code>vcf</code></strong>, <strong><code>tfam</code></strong>, <strong><code>anno_file</code></strong>=<em><code>None</code></em>, <strong><code>fam_pop_file</code></strong>=<em><code>None</code></em>, <strong><code>allele_freq_info</code></strong>=<em><code>None</code></em>, <strong><code>included_variant_file</code></strong>=<em><code>None</code></em>) :: <code>dict</code></p>
</blockquote>
<p>dict() -&gt; new empty dictionary
dict(mapping) -&gt; new dictionary initialized from a mapping object's
    (key, value) pairs
dict(iterable) -&gt; new dictionary initialized as if via:
    d = {}
    for k, v in iterable:
        d[k] = v
dict(**kwargs) -&gt; new dictionary initialized with the name=value pairs
    in the keyword argument list.  For example:  dict(one=1, two=2)</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="3.RegionExtractor-class">3.RegionExtractor class<a class="anchor-link" href="#3.RegionExtractor-class"> </a></h3>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="RegionExtractor" class="doc_header"><code>class</code> <code>RegionExtractor</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L211" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>RegionExtractor</code>(<strong><code>filename</code></strong>, <strong><code>build</code></strong>=<em><code>None</code></em>, <strong><code>chr_prefix</code></strong>=<em><code>None</code></em>)</p>
</blockquote>
<p>Extract given genomic region from VCF
converting genotypes into dictionary of
genotype list</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="5.MarkerMaker-class">5.MarkerMaker class<a class="anchor-link" href="#5.MarkerMaker-class"> </a></h3>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="MarkerMaker" class="doc_header"><code>class</code> <code>MarkerMaker</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L367" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>MarkerMaker</code>(<strong><code>wsize</code></strong>=<em><code>1</code></em>, <strong><code>maf_cutoff</code></strong>=<em><code>None</code></em>, <strong><code>recomb</code></strong>=<em><code>False</code></em>)</p>
</blockquote>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h4 id="Functions-for-__Haplotype">Functions for <code>__Haplotype</code><a class="anchor-link" href="#Functions-for-__Haplotype"> </a></h4>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h4 id="get_family_with_var" class="doc_header"><code>get_family_with_var</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L572" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>get_family_with_var</code>(<strong><code>data</code></strong>)</p>
</blockquote>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h4 id="phasing_haps" class="doc_header"><code>phasing_haps</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L583" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>phasing_haps</code>(<strong><code>chrom</code></strong>, <strong><code>item</code></strong>, <strong><code>fvar</code></strong>, <strong><code>fgeno</code></strong>)</p>
</blockquote>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="6.LinkageWriter-class">6.LinkageWriter class<a class="anchor-link" href="#6.LinkageWriter-class"> </a></h3>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="LinkageWriter" class="doc_header"><code>class</code> <code>LinkageWriter</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L594" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>LinkageWriter</code>(<strong><code>num_missing_append</code></strong>=<em><code>0</code></em>)</p>
</blockquote>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="EncoderWorker" class="doc_header"><code>class</code> <code>EncoderWorker</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L683" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>EncoderWorker</code>(<strong><code>queue</code></strong>, <strong><code>length</code></strong>, <strong><code>data</code></strong>, <strong><code>extractor</code></strong>, <strong><code>coder</code></strong>, <strong><code>writer</code></strong>) :: <code>Process</code></p>
</blockquote>
<p>Process objects represent activity that is run in a separate process</p>
<p>The class is analogous to <code>threading.Thread</code></p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="7.Run-linagke-analysis">7.Run linagke analysis<a class="anchor-link" href="#7.Run-linagke-analysis"> </a></h3>
</div>
</div>
</div>
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h4 id="run_each_region" class="doc_header"><code>run_each_region</code><a href="https://github.com/changebio/SEQLinkage/tree/master/SEQLinkage/Core.py#L742" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>run_each_region</code>()</p>
</blockquote>
<p>get the haplotypes and allele frequency of variants in each region and run linkage analysis</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

</div>
 

