Select Git revision
jass_preprocessing.html
jass_preprocessing.html 23.65 KiB
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jass_preprocessing package — jass_preprocessing 1.0 documentation</title>
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> jass_preprocessing
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">jass_preprocessing package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-jass_preprocessing.compute_score">jass_preprocessing.compute_score module</a></li>
<li><a class="reference internal" href="#module-jass_preprocessing.dna_utils">jass_preprocessing.dna_utils module</a></li>
<li><a class="reference internal" href="#module-jass_preprocessing.map_gwas">jass_preprocessing.map_gwas module</a></li>
<li><a class="reference internal" href="#module-jass_preprocessing.map_reference">jass_preprocessing.map_reference module</a></li>
<li><a class="reference internal" href="#module-jass_preprocessing.save_output">jass_preprocessing.save_output module</a></li>
<li><a class="reference internal" href="#module-jass_preprocessing">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">jass_preprocessing</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> »</li>
<li>jass_preprocessing package</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/_autosummary/jass_preprocessing.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="jass-preprocessing-package">
<h1>jass_preprocessing package<a class="headerlink" href="#jass-preprocessing-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-jass_preprocessing.compute_score">
<span id="jass-preprocessing-compute-score-module"></span><h2>jass_preprocessing.compute_score module<a class="headerlink" href="#module-jass_preprocessing.compute_score" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="jass_preprocessing.compute_score.compute_sample_size">
<code class="sig-prename descclassname">jass_preprocessing.compute_score.</code><code class="sig-name descname">compute_sample_size</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em>, <em class="sig-param">diagnostic_folder</em>, <em class="sig-param">trait</em>, <em class="sig-param">perSS=0.7</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/compute_score.html#compute_sample_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.compute_score.compute_sample_size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="jass_preprocessing.compute_score.compute_z_score">
<code class="sig-prename descclassname">jass_preprocessing.compute_score.</code><code class="sig-name descname">compute_z_score</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/compute_score.html#compute_z_score"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.compute_score.compute_z_score" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute zscore value and sign1
add the corresponding column to the mgwas dataframe</p>
</dd></dl>
</div>
<div class="section" id="module-jass_preprocessing.dna_utils">
<span id="jass-preprocessing-dna-utils-module"></span><h2>jass_preprocessing.dna_utils module<a class="headerlink" href="#module-jass_preprocessing.dna_utils" title="Permalink to this headline">¶</a></h2>
<p>Few fonction to to compute DNA complement</p>
<dl class="function">
<dt id="jass_preprocessing.dna_utils.dna_complement">
<code class="sig-prename descclassname">jass_preprocessing.dna_utils.</code><code class="sig-name descname">dna_complement</code><span class="sig-paren">(</span><em class="sig-param">input</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/dna_utils.html#dna_complement"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.dna_utils.dna_complement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="jass_preprocessing.dna_utils.dna_complement_base">
<code class="sig-prename descclassname">jass_preprocessing.dna_utils.</code><code class="sig-name descname">dna_complement_base</code><span class="sig-paren">(</span><em class="sig-param">inputbase</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/dna_utils.html#dna_complement_base"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.dna_utils.dna_complement_base" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-jass_preprocessing.map_gwas">
<span id="jass-preprocessing-map-gwas-module"></span><h2>jass_preprocessing.map_gwas module<a class="headerlink" href="#module-jass_preprocessing.map_gwas" title="Permalink to this headline">¶</a></h2>
<p>Map GWAS</p>
<p>A set of functions to find GWAS files in subfolder and
to map columns</p>
<dl class="function">
<dt id="jass_preprocessing.map_gwas.convert_missing_values">
<code class="sig-prename descclassname">jass_preprocessing.map_gwas.</code><code class="sig-name descname">convert_missing_values</code><span class="sig-paren">(</span><em class="sig-param">df</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_gwas.html#convert_missing_values"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_gwas.convert_missing_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert all missing value strings to a standart np.nan value</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>GWAS_table</strong> (<em>pandas dataframe</em>) – GWAS data as a dataframe</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a pandas dataframe with missing value all equal to np.nan</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_gwas.gwas_internal_link">
<code class="sig-prename descclassname">jass_preprocessing.map_gwas.</code><code class="sig-name descname">gwas_internal_link</code><span class="sig-paren">(</span><em class="sig-param">GWAS_table</em>, <em class="sig-param">GWAS_path</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_gwas.html#gwas_internal_link"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_gwas.gwas_internal_link" title="Permalink to this definition">¶</a></dt>
<dd><p>Walk the GWAS path to find the GWAS tables</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>GWAS_table</strong> (<em>str</em>) – path of the folder to explore</p></li>
<li><p><strong>findfile</strong> (<em>str</em>) – name of the file to find</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a pandas dataframe with one column for the filename
and one column containing the complete path to the file</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_gwas.map_columns_position">
<code class="sig-prename descclassname">jass_preprocessing.map_gwas.</code><code class="sig-name descname">map_columns_position</code><span class="sig-paren">(</span><em class="sig-param">gwas_internal_link</em>, <em class="sig-param">column_dict</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_gwas.html#map_columns_position"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_gwas.map_columns_position" title="Permalink to this definition">¶</a></dt>
<dd><p>Find column position for each specific Gwas</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>gwas_internal_link</strong> (<em>str</em>) – filename of the GWAS data (with path)</p></li>
<li><p><strong>GWAS_labels</strong> (<em>pd.DataFrame</em>) – corresponding row of the information file</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>pandas Series with column position and column names as index</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_gwas.read_gwas">
<code class="sig-prename descclassname">jass_preprocessing.map_gwas.</code><code class="sig-name descname">read_gwas</code><span class="sig-paren">(</span><em class="sig-param">gwas_internal_link</em>, <em class="sig-param">column_map</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_gwas.html#read_gwas"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_gwas.read_gwas" title="Permalink to this definition">¶</a></dt>
<dd><p>Read gwas raw data, fetch columns thanks to position stored in
column_map and rename columns according to column_map.index</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>gwas_internal_link</strong> (<em>str</em>) – GWAS data as a dataframe</p></li>
<li><p><strong>column_map</strong> (<em>pandas Series</em>) – Series containing the position of column in</p></li>
<li><p><strong>raw data</strong> (<em>the</em>) – </p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>a pandas dataframe with missing value all equal to np.nan</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_gwas.walkfs">
<code class="sig-prename descclassname">jass_preprocessing.map_gwas.</code><code class="sig-name descname">walkfs</code><span class="sig-paren">(</span><em class="sig-param">startdir</em>, <em class="sig-param">findfile</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_gwas.html#walkfs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_gwas.walkfs" title="Permalink to this definition">¶</a></dt>
<dd><p>Go through the folder and subfolder to find the specified file</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>startdir</strong> (<em>str</em>) – path of the folder to explore</p></li>
<li><p><strong>findfile</strong> (<em>str</em>) – name of the file to find</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-jass_preprocessing.map_reference">
<span id="jass-preprocessing-map-reference-module"></span><h2>jass_preprocessing.map_reference module<a class="headerlink" href="#module-jass_preprocessing.map_reference" title="Permalink to this headline">¶</a></h2>
<p>Module of function</p>
<dl class="function">
<dt id="jass_preprocessing.map_reference.compute_is_aligned">
<code class="sig-prename descclassname">jass_preprocessing.map_reference.</code><code class="sig-name descname">compute_is_aligned</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_reference.html#compute_is_aligned"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_reference.compute_is_aligned" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if the reference panel and the GWAS data have the same reference
allele. return a boolean vector.
The function should be the complement of “is_flipped” but we still compute
the two function to eventually detect weird cases (more than two alleles for
instance)</p>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_reference.compute_is_flipped">
<code class="sig-prename descclassname">jass_preprocessing.map_reference.</code><code class="sig-name descname">compute_is_flipped</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_reference.html#compute_is_flipped"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_reference.compute_is_flipped" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if the reference panel and the GWAS data have the same reference
allele. return a boolean vector.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>mgwas</strong> (<em>pandas dataframe</em>) – GWAS study dataframe merged with the reference_panel</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>merge studies,</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>is_flipped (pandas dataframe)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_reference.compute_snp_alignement">
<code class="sig-prename descclassname">jass_preprocessing.map_reference.</code><code class="sig-name descname">compute_snp_alignement</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_reference.html#compute_snp_alignement"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_reference.compute_snp_alignement" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a column to mgwas indicating if the reference and coded
allele is flipped compared to the reference panel.
If it is, the sign of the statistic must be flipped
:param mgwas: a pandas dataframe of the GWAS data merged</p>
<blockquote>
<div><p>with the reference panel</p>
</div></blockquote>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_reference.map_on_ref_panel">
<code class="sig-prename descclassname">jass_preprocessing.map_reference.</code><code class="sig-name descname">map_on_ref_panel</code><span class="sig-paren">(</span><em class="sig-param">gw_df</em>, <em class="sig-param">ref_panel</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_reference.html#map_on_ref_panel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_reference.map_on_ref_panel" title="Permalink to this definition">¶</a></dt>
<dd><p>Merge Gwas dataframe with the reference panel
Make sure that the same SNPs are in the reference panel and the gwas</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>gw_df</strong> (<em>pandas dataframe</em>) – GWAS study dataframe</p></li>
<li><p><strong>ref_panel</strong> (<em>pandas dataframe</em>) – reference panel dataframe</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>merge studies,</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>merge_GWAS (pandas dataframe)</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.map_reference.read_reference">
<code class="sig-prename descclassname">jass_preprocessing.map_reference.</code><code class="sig-name descname">read_reference</code><span class="sig-paren">(</span><em class="sig-param">gwas_reference_panel</em>, <em class="sig-param">mask_MHC=False</em>, <em class="sig-param">minimum_MAF=None</em>, <em class="sig-param">region_to_mask=None</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/map_reference.html#read_reference"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.map_reference.read_reference" title="Permalink to this definition">¶</a></dt>
<dd><p>helper function to name correctly the column
:param gwas_reference_panel: path toward the reference panel file
:type gwas_reference_panel: str
:param mask_MHC: Whether the MHC region should be masked or not. default is False
:type mask_MHC: bool
:param Filter the reference panel by minimum allele frequency:
:type Filter the reference panel by minimum allele frequency: hg19 coordinate
:param minimum_MAF: minimum allele frequency for a SNPs to be retain in the panel
:type minimum_MAF: float
:param region_to_mask: a list of additional regions to mask
:type region_to_mask: dict</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>the reference_panel with the specified filter applied</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>ref (pandas dataframe)</p>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-jass_preprocessing.save_output">
<span id="jass-preprocessing-save-output-module"></span><h2>jass_preprocessing.save_output module<a class="headerlink" href="#module-jass_preprocessing.save_output" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="jass_preprocessing.save_output.save_output">
<code class="sig-prename descclassname">jass_preprocessing.save_output.</code><code class="sig-name descname">save_output</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em>, <em class="sig-param">ImpG_output_Folder</em>, <em class="sig-param">my_study</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/save_output.html#save_output"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.save_output.save_output" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the preprocessed Gwas for ldscore analysis</p>
</dd></dl>
<dl class="function">
<dt id="jass_preprocessing.save_output.save_output_by_chromosome">
<code class="sig-prename descclassname">jass_preprocessing.save_output.</code><code class="sig-name descname">save_output_by_chromosome</code><span class="sig-paren">(</span><em class="sig-param">mgwas</em>, <em class="sig-param">ImpG_output_Folder</em>, <em class="sig-param">my_study</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/jass_preprocessing/save_output.html#save_output_by_chromosome"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#jass_preprocessing.save_output.save_output_by_chromosome" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the preprocessed Gwas for imputation</p>
</dd></dl>
</div>
<div class="section" id="module-jass_preprocessing">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-jass_preprocessing" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#module-jass_preprocessing.map_gwas" title="jass_preprocessing.map_gwas"><code class="xref py py-obj docutils literal notranslate"><span class="pre">map_gwas</span></code></a></p></td>
<td><p>Map GWAS</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#module-jass_preprocessing.dna_utils" title="jass_preprocessing.dna_utils"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dna_utils</span></code></a></p></td>
<td><p>Few fonction to to compute DNA complement</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#module-jass_preprocessing.map_reference" title="jass_preprocessing.map_reference"><code class="xref py py-obj docutils literal notranslate"><span class="pre">map_reference</span></code></a></p></td>
<td><p>Module of function</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#module-jass_preprocessing.compute_score" title="jass_preprocessing.compute_score"><code class="xref py py-obj docutils literal notranslate"><span class="pre">compute_score</span></code></a></p></td>
<td><p></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#module-jass_preprocessing.save_output" title="jass_preprocessing.save_output"><code class="xref py py-obj docutils literal notranslate"><span class="pre">save_output</span></code></a></p></td>
<td><p></p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2018, Hanna Julienne
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>