Skip to content

Commit

Permalink
beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlKCarlK committed Nov 6, 2023
1 parent 67972a4 commit 6fc8ae5
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 28 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,3 @@ old4cargo.lock
old5Cargo.lock
oldCargo.lock
bed_reader/Untitled-1.ipynb
bed_reader/_open_bed.py
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- (Python) Added new `read_sparse()` method for creating
`sympy.sparse.csc_matrix` and `sympy.sparse.csr_matrix`. This
method can save memory when a *.bed file contains mostly 0's.
method can save memory when a *.bed file contains mostly zeros.

- (Rust) Rust methods that returned `Result` now return
`Result<_,Box<BedErrorPlus>>`. Before, they returned
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[package]
version = "1.0.0-beta.2"
version = "1.0.0-beta.3"
name = "bed-reader"
description = "Read and write the PLINK BED format, simply and efficiently."
repository = "https://github.com/fastlmm/bed-reader"
Expand Down
13 changes: 10 additions & 3 deletions bed_reader/_open_bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,14 @@ def read_sparse(
) -> (Union[sparse.csc_matrix, sparse.csr_matrix]) if sparse is not None else None:
"""
Read genotype information into a :mod:`scipy.sparse` matrix. Sparse matrices
may be useful when the data is mostly 0.
may be useful when the data is mostly zeros.
.. note::
This method requires :mod:`scipy`. Install `scipy` with:
.. code-block:: bash
pip install --upgrade bed-reader[sparse]
Parameters
----------
Expand Down Expand Up @@ -1510,8 +1517,8 @@ def _read_csv(filepath, delimiter=None, dtype=None, usecols=None):


if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)

import pytest

logging.basicConfig(level=logging.INFO)

pytest.main(["--doctest-modules", __file__])
8 changes: 8 additions & 0 deletions bed_reader/_sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ def sample_file(filepath: Union[str, Path]) -> str:
Local name of sample .bed file.
.. note::
This function requires the :mod:`pooch` package. Install `pooch` with:
.. code-block:: bash
pip install --upgrade bed-reader[samples]
By default this function puts files under the user's cache directory.
Override this by setting
the `BED_READER_DATA_DIR` environment variable.
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 93cd283100cdb6074a5966603b955a1a
config: bd3c16945e06a1735271b50da76cccd3
tags: 645f666f9bcd5a90fca523b33c5a78b7
17 changes: 12 additions & 5 deletions docs/_modules/bed_reader/_open_bed.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>bed_reader._open_bed &mdash; Bed Reader 1.0.0-beta.1 documentation</title>
<title>bed_reader._open_bed &mdash; Bed Reader 1.0.0-beta.2 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -30,7 +30,7 @@
Bed Reader
</a>
<div class="version">
1.0.0-beta.1
1.0.0-beta.2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -1261,7 +1261,14 @@ <h1>Source code for bed_reader._open_bed</h1><div class="highlight"><pre>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="p">(</span><span class="n">Union</span><span class="p">[</span><span class="n">sparse</span><span class="o">.</span><span class="n">csc_matrix</span><span class="p">,</span> <span class="n">sparse</span><span class="o">.</span><span class="n">csr_matrix</span><span class="p">])</span> <span class="k">if</span> <span class="n">sparse</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Read genotype information into a :mod:`scipy.sparse` matrix. Sparse matrices</span>
<span class="sd"> may be useful when the data is mostly 0.</span>
<span class="sd"> may be useful when the data is mostly zeros.</span>

<span class="sd"> .. note::</span>
<span class="sd"> This method requires :mod:`scipy`. Install `scipy` with:</span>

<span class="sd"> .. code-block:: bash</span>

<span class="sd"> pip install --upgrade bed-reader[sparse]</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
Expand Down Expand Up @@ -1579,10 +1586,10 @@ <h1>Source code for bed_reader._open_bed</h1><div class="highlight"><pre>


<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">)</span>

<span class="kn">import</span> <span class="nn">pytest</span>

<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">)</span>

<span class="n">pytest</span><span class="o">.</span><span class="n">main</span><span class="p">([</span><span class="s2">&quot;--doctest-modules&quot;</span><span class="p">,</span> <span class="vm">__file__</span><span class="p">])</span>
</pre></div>

Expand Down
12 changes: 10 additions & 2 deletions docs/_modules/bed_reader/_sample_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>bed_reader._sample_data &mdash; Bed Reader 1.0.0 documentation</title>
<title>bed_reader._sample_data &mdash; Bed Reader 1.0.0-beta.2 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -30,7 +30,7 @@
Bed Reader
</a>
<div class="version">
1.0.0
1.0.0-beta.2
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
Expand Down Expand Up @@ -113,6 +113,14 @@ <h1>Source code for bed_reader._sample_data</h1><div class="highlight"><pre>
<span class="sd"> Local name of sample .bed file.</span>


<span class="sd"> .. note::</span>
<span class="sd"> This function requires the :mod:`pooch` package. Install `pooch` with:</span>

<span class="sd"> .. code-block:: bash</span>

<span class="sd"> pip install --upgrade bed-reader[samples]</span>


<span class="sd"> By default this function puts files under the user&#39;s cache directory.</span>
<span class="sd"> Override this by setting</span>
<span class="sd"> the `BED_READER_DATA_DIR` environment variable.</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; Bed Reader 1.0.0-beta.2 documentation</title>
<title>Overview: module code &mdash; Bed Reader 1.0.0-beta.3 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -30,7 +30,7 @@
Bed Reader
</a>
<div class="version">
1.0.0-beta.2
1.0.0-beta.3
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.0.0-beta.2',
VERSION: '1.0.0-beta.3',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
4 changes: 2 additions & 2 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &mdash; Bed Reader 1.0.0-beta.2 documentation</title>
<title>Index &mdash; Bed Reader 1.0.0-beta.3 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -30,7 +30,7 @@
Bed Reader
</a>
<div class="version">
1.0.0-beta.2
1.0.0-beta.3
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down
20 changes: 17 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>bed_reader Documentation &mdash; Bed Reader 1.0.0-beta.2 documentation</title>
<title>bed_reader Documentation &mdash; Bed Reader 1.0.0-beta.3 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
Expand All @@ -31,7 +31,7 @@
Bed Reader
</a>
<div class="version">
1.0.0-beta.2
1.0.0-beta.3
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -844,7 +844,14 @@ <h3>open_bed<a class="headerlink" href="#open-bed" title="Permalink to this head
<dt class="sig sig-object py" id="bed_reader.open_bed.read_sparse">
<span class="sig-name descname"><span class="pre">read_sparse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.12)"><span class="pre">Any</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.12)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#type" title="(in Python v3.12)"><span class="pre">type</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.12)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'float32'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">batch_size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.12)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.12)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'csc'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_threads</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csc_matrix.html#scipy.sparse.csc_matrix" title="(in SciPy v1.11.3)"><span class="pre">csc_matrix</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html#scipy.sparse.csr_matrix" title="(in SciPy v1.11.3)"><span class="pre">csr_matrix</span></a></span></span><a class="reference internal" href="_modules/bed_reader/_open_bed.html#open_bed.read_sparse"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#bed_reader.open_bed.read_sparse" title="Permalink to this definition"></a></dt>
<dd><p>Read genotype information into a <a class="reference external" href="https://docs.scipy.org/doc/scipy/reference/sparse.html#module-scipy.sparse" title="(in SciPy v1.11.3)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">scipy.sparse</span></code></a> matrix. Sparse matrices
may be useful when the data is mostly 0.</p>
may be useful when the data is mostly zeros.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This method requires <a class="reference external" href="https://docs.scipy.org/doc/scipy/index.html#module-scipy" title="(in SciPy v1.11.3)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">scipy</span></code></a>. Install <cite>scipy</cite> with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>bed-reader<span class="o">[</span>sparse<span class="o">]</span>
</pre></div>
</div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
Expand Down Expand Up @@ -1166,6 +1173,13 @@ <h3>sample_file<a class="headerlink" href="#sample-file" title="Permalink to thi
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.12)">str</a></p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This function requires the <code class="xref py py-mod docutils literal notranslate"><span class="pre">pooch</span></code> package. Install <cite>pooch</cite> with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>bed-reader<span class="o">[</span>samples<span class="o">]</span>
</pre></div>
</div>
</div>
<p>By default this function puts files under the user’s cache directory.
Override this by setting
the <cite>BED_READER_DATA_DIR</cite> environment variable.</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/objects.inv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sphinx inventory version 2
# Project: Bed Reader
# Version: 1.0.0-beta.2
# Version: 1.0.0-beta.3
# The remainder of this file is compressed using zlib.
xڥ��n�0����`R=RYκ,F�2b(,S'>Ӹ���м=�N4I�������}|;)��-T�(�n� j�]ʼn1�"&)�lk+����.R��������[�9p(n=�hֶ[D~ZN�M�(�,Sr9\�Z e������O�֠Wp�.��J��T+�rT�u�kj�j� �j�+��q�V�m��^��!��R���� ��4+�Ysd��#c�hܵ?1r<��
�i����xw}��\ʦ�O CKw���}��ѠC{���eTU㺊�Aѝ�Z�?^�v;���=":T���k <^��%��I���D�<3��7Cg�)9L{ ԸWx����r")���I��'�~@����"3^��D��{����?��I�;2��o����ᗏ��ٛ5�L��<�PYę�=�<I��ꐘ/���ɥQ�<�Ό�����x��ǐ��� �����fFL~X���'��0�g3�� ��d���0�4�a���*jp�����
Expand Down
4 changes: 2 additions & 2 deletions docs/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &mdash; Bed Reader 1.0.0-beta.2 documentation</title>
<title>Search &mdash; Bed Reader 1.0.0-beta.3 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />

Expand Down Expand Up @@ -33,7 +33,7 @@
Bed Reader
</a>
<div class="version">
1.0.0-beta.2
1.0.0-beta.3
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="#" method="get">
Expand Down
Loading

0 comments on commit 6fc8ae5

Please sign in to comment.