Skip to content

Commit

Permalink
setup.py fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed Jan 11, 2017
1 parent e069f00 commit 8e28129
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 24 deletions.
19 changes: 6 additions & 13 deletions docs/_pages/gpm.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GenotypePhenotypeMap
====================

The ``GenotypePhenotypeMap`` class is the primary tool provided by the ``gpmap`` package.
It creates intuitive and useful mapping on the fly. It appends methods and attributes
to make analyzing genotype-phenotype data easy. We've create other packages that
The ``GenotypePhenotypeMap`` class is main entry-point to the ``gpmap`` package.
It offers intuitive and useful methods and attributes
for analyzing genotype-phenotype data. We've also created a number of other packages that
easily interact with the ``GenotypePhenotypeMap``.

Example
Expand Down Expand Up @@ -31,14 +31,7 @@ Interface

BinaryMap
---------
Attached to the GenotypePhenotypeMap is a ``BinaryMap`` object.

The ``BinaryMap`` class creates a binary representation of all genotypes and maps
them to a genotype-phenotype map. Binary representations are useful for many reasons,
like modeling evolutionary paths and analyzing epistatic interactions (see epistasis_)

All ``GenotypePhenotypeMap`` objects append a ``BinaryMap`` instance to a the ``binary``
attribute. Most attributes in the ``GenotypePhenotypeMap`` also exist in under
the ``binary`` attribute, updated with the binary genotype representations.

.. _epistasis: http://epicstasis.readthedocs.io/
attribute. The ``BinaryMap`` class creates a binary representation of all genotypes and maps
them to a genotype-phenotype map. Most attributes in the ``GenotypePhenotypeMap`` also exist in
the ``binary`` object, updated with the binary genotype representations.
6 changes: 5 additions & 1 deletion docs/_pages/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ Alternatively, you can load data from a json file (using the format defined `her
Port to NetworkX object
-----------------------

A useful feature of the ``seqspace`` object
.. code-block:: python
Graph = gpm.add_networkx()
.. code-block:: python
2 changes: 1 addition & 1 deletion gpmap/gpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def write(self, fname, items, sep="\t", **kwargs):
f.write(sep.join(row))

def sort(self, genotypes):
"""Sort the genotype-phenotype map by genotypes
"""Sort the genotype-phenotype map using a list of genotypes.
"""
if len(genotypes) != self.n:
raise Exception("""genotypes argument must be the same length.""")
Expand Down
7 changes: 7 additions & 0 deletions gpmap/graph/draw/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ def path(G, pos, ax, path, scale=1, length=1, **kwargs):
@checkG
def network(G, scale=1, vertical=True, figsize=(5,5), **kwargs):
"""Draw a generic plot for a genotype-phenotype map.
Parameters
----------
G : GenotypePhenotypeGraph object
genotype-phenotype network to plot
scale :
"""
pos = positions.flattened(G, vertical=vertical, scale=scale)
# separate keyword args.
Expand Down
4 changes: 4 additions & 0 deletions gpmap/graph/draw/ellipses.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import numpy
import matplotlib as mpl
import networkx as nx

def draw_networkx_nodes_ellipses(G, pos,
nodelist=None,
height=20,
Expand Down
2 changes: 2 additions & 0 deletions gpmap/graph/draw/positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def flattened(G, scale=1, vertical=False):
----------
G : GenotypePhenotypeGraph object
A genotype-phenotype objects
scale : float (default=1)
density of the nodes.
Returns
-------
Expand Down
1 change: 1 addition & 0 deletions gpmap/simulate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .base import GenotypePhenotypeSimulation
15 changes: 8 additions & 7 deletions gpmap/simulate/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ def random_mutation_set(length, alphabet_size=2):
size = [alphabet_size for i in range(length)]
else:
size = alphabet_size

alphabet = utils.AMINO_ACIDS[:size]
mutations = dict([(i, alphabet[i])for i in range(length)])
# build mutations dictionary
mutations = {}
for i in range(length):
alphabet = utils.AMINO_ACIDS[:size[i]]
mutations[i] = alphabet
return mutations

class GenotypePhenotypeSimulation(GenotypePhenotypeMap):
Expand All @@ -40,7 +42,7 @@ def __init__(self, wildtype, mutations, range=(0,1), *args, **kwargs):
def set_random(self, range=(0,1)):
""" Get a set of random
"""
self.phenotypes = np.random.random(range[0], range[1], size=self.n)
self.phenotypes = np.random.uniform(range[0], range[1], size=self.n)

@classmethod
def from_length(cls, length, alphabet_size=2, *args, **kwargs):
Expand All @@ -53,12 +55,11 @@ def from_length(cls, length, alphabet_size=2, *args, **kwargs):
alphabet_size : int (optional)
alphabet size
Returns
-------
self : GenotypePhenotypeSimulation
"""
mutations = random_mutations_set(lengths, alphabet_size=alphabet_size)
wildtype = ".join"([m[0] for m in mutations.values()])
mutations = random_mutation_set(length, alphabet_size=alphabet_size)
wildtype = "".join([m[0] for m in mutations.values()])
self = cls(wildtype, mutations, *args, **kwargs)
return self
13 changes: 11 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
except:
from distutils.core import setup

# Packages and subpackages to install
packages = [
'gpmap',
'gpmap.evolve',
'gpmap.graph',
'gpmap.graph.draw',
'gpmap.simulate'
]

setup(name='gpmap',
version='0.1',
version='0.1.1',
description='Data-structure for analyzing genotype-phenotype map data.',
author='Zach Sailer',
author_email='[email protected]',
packages=['gpmap'],
packages=packages,
url="https://github.com/harmslab/gpmap",
install_requires=[
'networkx',
Expand Down

0 comments on commit 8e28129

Please sign in to comment.