Skip to content

Commit c1bf872

Browse files
committed
initial commit
0 parents  commit c1bf872

File tree

13 files changed

+641
-0
lines changed

13 files changed

+641
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2017] [Alexander Thomas Ian Strudwick Young]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include *.txt
2+
recursive-include docs *.txt

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# sibreg
2+
sibreg is a python library for performing robust GWAS using sibling pairs with a random effects
3+
model for within family phenotypic correlations
4+
5+
6+
# Main features:
7+
8+
regrnd class: given data, find the parameters that maximise
9+
the likelihood and their sampling distribution.
10+
11+
12+
# Package Install Instructions
13+
14+
sibreg has the following dependencies:
15+
16+
python 2.7
17+
18+
Packages:
19+
20+
- numpy
21+
- scipy
22+
- pysnptools
23+
24+
We highly recommend using a python distribution such as Anaconda (https://store.continuum.io/cshop/anaconda/).
25+
This will come with both numpy and scipy installed and can include an MKL-compiled distribution
26+
for optimal speed.
27+
28+
To install from source, clone the git repository, and in the directory
29+
containing the sibreg source code, at the shell type
30+
31+
'sudo python setupy.py install'
32+
33+
or, on the windows command prompt, type
34+
35+
'python setup.py install'
36+
37+
# Running tests
38+
39+
The tests directory contains scripts for testing the computation of
40+
the likelihoods, gradients, and maximum likelihood solutions
41+
To run these tests, a further dependency is required: numdifftools.
42+
43+
To run the tests, first install sibreg. Change to the tests/ directory and at the shell type
44+
45+
'python test.py'
46+
47+
Tests should run without any failures.

bin/sGWAS.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import sibreg

docs/conf.py

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
2+
import os
3+
import sys
4+
sys.path.insert(0, os.path.abspath('../regrnd/'))
5+
print(sys.path)
6+
7+
# -- General configuration ------------------------------------------------
8+
9+
# If your documentation needs a minimal Sphinx version, state it here.
10+
#
11+
# needs_sphinx = '1.0'
12+
13+
# Add any Sphinx extension module names here, as strings. They can be
14+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
15+
# ones.
16+
extensions = ['sphinx.ext.autodoc',
17+
'sphinx.ext.autosummary',
18+
'numpydoc',
19+
'sphinx.ext.doctest',
20+
'sphinx.ext.intersphinx',
21+
'sphinx.ext.mathjax',
22+
'sphinx.ext.viewcode',
23+
'sphinx.ext.githubpages']
24+
25+
intersphinx_mapping = {'numpy': ('http://docs.scipy.org/doc/numpy/', None)}
26+
27+
# Add any paths that contain templates here, relative to this directory.
28+
templates_path = ['_templates']
29+
30+
# The suffix(es) of source filenames.
31+
# You can specify multiple suffix as a list of string:
32+
#
33+
# source_suffix = ['.rst', '.md']
34+
source_suffix = '.rst'
35+
36+
# The master toctree document.
37+
master_doc = 'index'
38+
39+
# General information about the project.
40+
project = u'regrnd'
41+
copyright = u'2017, Alexander Thomas Ian Strudwick Young'
42+
author = u'Alexander Thomas Ian Strudwick Young'
43+
44+
# The version info for the project you're documenting, acts as replacement for
45+
# |version| and |release|, also used in various other places throughout the
46+
# built documents.
47+
#
48+
# The short X.Y version.
49+
version = u'1.2.0a1'
50+
# The full version, including alpha/beta/rc tags.
51+
release = u'1.2.0a1'
52+
53+
# The language for content autogenerated by Sphinx. Refer to documentation
54+
# for a list of supported languages.
55+
#
56+
# This is also used if you do content translation via gettext catalogs.
57+
# Usually you set "language" from the command line for these cases.
58+
language = None
59+
60+
# List of patterns, relative to source directory, that match files and
61+
# directories to ignore when looking for source files.
62+
# This patterns also effect to html_static_path and html_extra_path
63+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
64+
65+
# The name of the Pygments (syntax highlighting) style to use.
66+
pygments_style = 'sphinx'
67+
68+
# If true, `todo` and `todoList` produce output, else they produce nothing.
69+
todo_include_todos = False
70+
71+
72+
# -- Options for HTML output ----------------------------------------------
73+
74+
# The theme to use for HTML and HTML Help pages. See the documentation for
75+
# a list of builtin themes.
76+
#
77+
html_theme = 'alabaster'
78+
79+
# Theme options are theme-specific and customize the look and feel of a theme
80+
# further. For a list of options available for each theme, see the
81+
# documentation.
82+
#
83+
# html_theme_options = {}
84+
85+
# Add any paths that contain custom static files (such as style sheets) here,
86+
# relative to this directory. They are copied after the builtin static files,
87+
# so a file named "default.css" will overwrite the builtin "default.css".
88+
html_static_path = ['_static']
89+
90+
# Custom sidebar templates, must be a dictionary that maps document names
91+
# to template names.
92+
#
93+
# This is required for the alabaster theme
94+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
95+
html_sidebars = {
96+
'**': [
97+
'about.html',
98+
'navigation.html',
99+
'relations.html', # needs 'show_related': True theme option to display
100+
'searchbox.html',
101+
'donate.html',
102+
]
103+
}
104+
105+
106+
# -- Options for HTMLHelp output ------------------------------------------
107+
108+
# Output file base name for HTML help builder.
109+
htmlhelp_basename = 'hlmmdoc'
110+
111+
112+
# -- Options for LaTeX output ---------------------------------------------
113+
114+
latex_elements = {
115+
# The paper size ('letterpaper' or 'a4paper').
116+
#
117+
# 'papersize': 'letterpaper',
118+
119+
# The font size ('10pt', '11pt' or '12pt').
120+
#
121+
# 'pointsize': '10pt',
122+
123+
# Additional stuff for the LaTeX preamble.
124+
#
125+
# 'preamble': '',
126+
127+
# Latex figure (float) alignment
128+
#
129+
# 'figure_align': 'htbp',
130+
}
131+
132+
# Grouping the document tree into LaTeX files. List of tuples
133+
# (source start file, target name, title,
134+
# author, documentclass [howto, manual, or own class]).
135+
latex_documents = [
136+
(master_doc, 'hlmm.tex', u'hlmm Documentation',
137+
u'Alexander Thomas Ian Strudwick Young', 'manual'),
138+
]
139+
140+
141+
# -- Options for manual page output ---------------------------------------
142+
143+
# One entry per manual page. List of tuples
144+
# (source start file, name, description, authors, manual section).
145+
man_pages = [
146+
(master_doc, 'hlmm', u'hlmm Documentation',
147+
[author], 1)
148+
]
149+
150+
151+
# -- Options for Texinfo output -------------------------------------------
152+
153+
# Grouping the document tree into Texinfo files. List of tuples
154+
# (source start file, target name, title, author,
155+
# dir menu entry, description, category)
156+
texinfo_documents = [
157+
(master_doc, 'hlmm', u'hlmm Documentation',
158+
author, 'hlmm', 'One line description of project.',
159+
'Miscellaneous'),
160+
]
161+
162+
163+
164+
165+
# Example configuration for intersphinx: refer to the Python standard library.
166+
intersphinx_mapping = {'https://docs.python.org/': None}

docs/guide.rst

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Guide
2+
************
3+
4+
**Introduction**
5+
6+
regrnd is a python library for fitting L2 regularised regression models with repeated observations from the same sample.
7+
regrnd should be run with Anaconda built with Python 2.7.
8+
9+
A regrnd model (:class:`regrnd.model`) consists of a linear model for the mean along
10+
with a vector of sample labels that allows for repeated observations from the same sample.
11+
12+
The documentation for the regrnd module (:doc:`regrnd`) contains information on how to define a :class:`regrnd.model`,
13+
how to optimise a :class:`regrnd.model` given a L2 regularisation parameter, how to predict from
14+
a :class:`regrnd.model`, and how to simulate a :class:`regrnd.model`.
15+
16+
**Running tests**
17+
18+
To check that the code is working properly and computing likelihoods and gradients accurately, you can
19+
run tests. In the regrnd/ subdirectory, type
20+
21+
``python tests.py``
22+
23+
The output should say
24+
25+
``Ran 4 tests in...``
26+
27+
``OK``
28+
29+
**Running the code**
30+
31+
In the regrnd/ subdirectory, there is a script 'met_analysis.py'. The script takes one
32+
command line argument that is the location of the training_data.csv file. Unless you wish to install
33+
regrnd as a package, the 'met_analysis.py' script should be run from the regrnd/ subdirectory
34+
so that it can import the code in regrnd/regrnd.py.
35+
36+
The cross-validation code is contained in this script, but it is commmented out as it
37+
takes some time to run for all the investigated regularisation parameters.
38+
39+
Without modifying the script, it trains the model on the training data using the
40+
regularisation parameters found by cross-validation. It then predicts
41+
the 'mets' of the test set, and prints the mean squared error on the test set.
42+

docs/index.rst

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Welcome to regrnd's documentation!
2+
================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
8+
guide
9+
regrnd
10+
11+
Indices and tables
12+
==================
13+
14+
* :ref:`genindex`
15+
* :ref:`modindex`
16+
* :ref:`search`

docs/regrnd.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Documentation for 'regrnd' module
2+
=================================
3+
4+
Documentation for the regrnd model class.
5+
6+
.. automodule:: regrnd
7+
8+
.. autoclass:: regrnd.model
9+
:members:
10+
11+
.. autofunction:: regrnd.simulate

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
description-file = README.md

setup.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from setuptools import setup
2+
3+
setup(name='sibreg',
4+
version='1.2.0a1',
5+
description='Functions for performing robust GWAS using sibpairs in a random effects model',
6+
url='https://github.com/alexTISYoung/sibreg',
7+
download_url='https://github.com/AlexTISYoung/hlmm/archive/1.2.0a1.tar.gz',
8+
author='Alexander I. Young',
9+
author_email='[email protected]',
10+
license='MIT',
11+
scripts=['bin/sGWAS.py'],
12+
classifiers=[
13+
# How mature is this project? Common values are
14+
# 3 - Alpha
15+
# 4 - Beta
16+
# 5 - Production/Stable
17+
'Development Status :: 3 - Alpha',
18+
19+
# Indicate who your project is intended for
20+
'Intended Audience :: Science/Research',
21+
'Topic :: Scientific/Engineering :: Bio-Informatics',
22+
23+
# Pick your license as you wish (should match "license" above)
24+
'License :: OSI Approved :: MIT License',
25+
26+
# Specify the Python versions you support here. In particular, ensure
27+
# that you indicate whether you support Python 2, Python 3 or both.
28+
'Programming Language :: Python :: 2.7',
29+
],
30+
keywords='statistics genetics',
31+
packages=['sibreg'],
32+
install_requires=[
33+
'numpy',
34+
'scipy',
35+
'pysnptools'
36+
],
37+
extras_require={
38+
'test': ['numdifftools'],
39+
},
40+
zip_safe=False)

sibreg/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import sibreg

0 commit comments

Comments
 (0)