Skip to content

Commit

Permalink
Rename codebase to use hetnetpy from hetio
Browse files Browse the repository at this point in the history
Merges #42
Closes #40

`pip install hetnetpy` now installs two packages: hetnetpy and hetio.
`import hetio` will trigger a warning. The source code uses a
symbolic link. Behavior on windows unknown.
  • Loading branch information
dhimmel authored Jul 10, 2019
1 parent 83e58bc commit d88f81a
Show file tree
Hide file tree
Showing 26 changed files with 147 additions and 123 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python:
- "3.5"
- "3.6"
install:
- pip install .[test]
- pip install ".[test]"
- python setup.py sdist bdist_wheel
script:
- py.test
Expand All @@ -16,18 +16,18 @@ deploy:
secure: wk1yDPq/hfKjvWtmBegLE8BnqjosbGjkCahFWOrtpiUG/lFW+7RRuQG9yQEUNkXjJ3ClIvRIPTXhGxywlQb1OXChhRXw5owykJxbBGDubSqnQGdGrX9nYVQa0pF70i5Lq6leabTLlSqJklxIYp8Ccv+qAlc7tP1cYI9SxKrdieU1Hq7mXC21YMsyjFWNMG+p8FH+srp3DhC1XfyNyrMJFDwFKbFyty0q1HUobD6rT8mjVmTJanlPBMNTiAkJNiZZ+Je4WEUXkrvFf85HRnUYMKg8MPPfz+sDGaV8WOHsApS0BJNX+bCPYzNITykLLdt2YzaFf6zkxDXTPvgWKuyrKanDavA+j06+vQCWRyiOzNWSSJg4ccr+UC8c64hy0T/dkKc6xaDLjXJRMCpHeBHa6h2RgJAHq8m8lH+OkHR33MXq5TTyRg88wHn2nzI6oLbNkiJhWr9IANREAKmpG5MjfUT3ogi4myxeGcVnGw1B9UJmxOOWAHTDhUtxw8nIGzgtrx4oUxQLDqds90hkH0vpFLbiAZ14rdZYaqcFFmEIp5yDw1pJu8bf3tUfQzNz0+EuoKzGwfjyH8UjlW7//PH7aAukMpa664bNlQ4p3bJZA0tYNdmwTYebf98N4vmv+zHFaEMu57rzlFtwxiltIciLP2on1Qvdfd65ukVipS3Q9Vo=
file_glob: true
file:
- dist/hetio-*.tar.gz
- dist/hetio-*.whl
- dist/hetnetpy-*.tar.gz
- dist/hetnetpy-*.whl
on:
python: '3.6'
repo: hetio/hetio
repo: hetio/hetnetpy
tags: true
- provider: pypi
user: dhimmel
password:
secure: i6dHe2W+ynK81i/yjdCNqhXZ39rGJcdA+Nmp1W4Qg4NjizN3lozKmS9vHObdXRrobyn+AbCXPJ6GqyXPlT5+MbOtiTYWfvWm2Yd5zJff9GYyKkh4RBvmYrFgpkUJrb6mxmn+Gdo2yRA2aU2P+IBdY8aqx7/wvCBB6Z1e1xelOaZgOamCI8yfwsjXjuim8lP1IM6ayHjhTtejj8zHw14QhUoqBM6aKV2igJtv7CgwSZr6iAeOhruuyI3QgnlY3uM1f6I2YpsA/V0MnZDtVtvJ2ddk6sU6pIR1uUj5TCrJVBcFYI/z5jgJdo5kh2CLKRaD+k/luE+m0KV8K+GkRcC6+fYhLc+tF9gDw2F8TT2nnAmfHt8UYIn29sAyZsR8MifG6zhGTLZC4KpVRQP7eREr57GeQKEzEJiA/C4Fz2Fr47BMusO029EmB/OWsm8HqXz0IwsyWBp58shpgrP9xZUZBnDHe92pQNNfOfNzWuC1ATOs7LkbqB8Ml5vUT2vOePxkh7Bt3MR0ZEqNct7ZqwgOWrh2yFjoQ8BGDwPx1DNAQhQSGKBiea4kgWUGQIVTZw/IwwM7reWNY6Yvh8TA/5jlonVuCFBAXs0v1hwXn/suHGRk64yG2cS49h2lvltG379qp9gx6FI5WViszFvbwBZSONtIOr7lhGFw1IFRLRmeVkI=
on:
python: '3.6'
repo: hetio/hetio
repo: hetio/hetnetpy
tags: true
distributions: sdist bdist_wheel
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Hetnets in Python

[![Latest DOI](https://zenodo.org/badge/14475/dhimmel/hetio.svg)](https://zenodo.org/badge/latestdoi/14475/dhimmel/hetio)
[![GitHub issues](https://img.shields.io/github/issues/hetio/hetio.svg)](https://github.com/hetio/hetio/issues)
[![Build Status](https://travis-ci.com/hetio/hetio.svg?branch=master)](https://travis-ci.com/hetio/hetio)
[![GitHub issues](https://img.shields.io/github/issues/hetio/hetnetpy.svg)](https://github.com/hetio/hetnetpy/issues)
[![Build Status](https://travis-ci.com/hetio/hetnetpy.svg?branch=master)](https://travis-ci.com/hetio/hetnetpy)

## Overview

Hetnetpy is a Python 3 package for creating, querying, and operating on hetnets.
This software provides convenient data structures for hetnets, as well as algorithms for edge prediction.
It is specifically tailored and streamlined for hetnets compared to other more generic network software.
See https://het.io/software for additional software packages designed specifically for hetnets.

## Package relocation

**Critical**:
This is the final release before the package name [changes](https://github.com/hetio/hetio/issues/40) to `hetnetpy` from `hetio`.
Future development will occur in the `hetio/hetnetpy` [repository](https://github.com/hetio/hetnetpy).
PyPI releases will be available at <https://pypi.org/project/hetnetpy/>.
Note that this package was previousely named `hetio`, available at the following repositories:

- <https://github.com/hetio/hetnetpy> (current)
- <https://github.com/hetio/hetio> (former)
- <https://github.com/dhimmel/hetio> (former)

Users of v0.2.11 will see a warning when importing `hetio`.
These users should either switch to using `hetnetpy` or downgrade to `hetio<=0.2.10` to avoid the warning.
In July 2019, the package was [renamed](https://github.com/hetio/hetnetpy/issues/40) to `hetnetpy` to more clearly represent its functionality and disambiguiate it from other products.

## Background

Expand All @@ -22,22 +29,22 @@ These users should either switch to using `hetnetpy` or downgrade to `hetio<=0.2

**Impetus**: Development originated with a [study](https://doi.org/10.1371/journal.pcbi.1004259 "Heterogeneous Network Edge Prediction: A Data Integration Approach to Prioritize Disease-Associated Genes") to predict disease-associated genes and continues with a successive [study](https://doi.org/10.7554/eLife.26726 "Systematic integration of biomedical knowledge prioritizes drugs for repurposing") to repurpose drugs.

**Caution**: Documentation is currently spotty, testing coverage is moderate, and the API is not fully stable. Contributions are welcome. Please use [GitHub Issues](https://github.com/hetio/hetio/issues) for feedback, questions, or troubleshooting.
**Caution**: Documentation is currently spotty, testing coverage is moderate, and the API is not fully stable. Contributions are welcome. Please use [GitHub Issues](https://github.com/hetio/hetnetpy/issues) for feedback, questions, or troubleshooting.

## Installation

[![PyPI](https://img.shields.io/pypi/v/hetio.svg)](https://pypi.org/project/hetio/)
[![PyPI](https://img.shields.io/pypi/v/hetnetpy.svg)](https://pypi.org/project/hetnetpy/)

Please use Python 3.4 or higher. To install the current PyPI version (recommended), run:

```sh
pip install hetio
pip install hetnetpy
```

For the latest GitHub version, run:

```sh
pip install git+https://github.com/hetio/hetio.git#egg=hetio
pip install git+https://github.com/hetio/hetnetpy.git#egg=hetnetpy
```

For development, clone or download-and-extract the repository. Then run `pip install --editable .` from the repository's root directory. The `--editable` flag specifies [editable](https://pythonhosted.org/setuptools/setuptools.html#development-mode) mode, so updating the source updates your installation.
Expand All @@ -56,10 +63,10 @@ A Graph object stores a heterogeneous network and relies on the following classe
## Release instructions

This section is only relevant for project maintainers.
Travis CI deployments are used to upload releases to [PyPI](https://pypi.org/project/hetio) and [GitHub releases](https://github.com/hetio/hetio/releases).
Travis CI deployments are used to upload releases to [PyPI](https://pypi.org/project/hetnetpy) and [GitHub releases](https://github.com/hetio/hetnetpy/releases).
To create a new release, do the following:

1. Bump the version in [`__init__.py`](hetio/__init__.py).
1. Bump the version in [`__init__.py`](hetnetpy/__init__.py).

2. Add a release notes file in [`release-notes`](release-notes).
Format as a commit message that will be used as the GitHub release description.
Expand All @@ -68,7 +75,7 @@ To create a new release, do the following:

```sh
TAG=v`python setup.py --version`
git add hetio/__init__.py release-notes/$TAG.*
git add hetnetpy/__init__.py release-notes/$TAG.*
git commit --message "Prepare $TAG release"
git push
git tag --annotate $TAG --file release-notes/$TAG.*
Expand Down
1 change: 1 addition & 0 deletions hetio
11 changes: 0 additions & 11 deletions hetio/__init__.py

This file was deleted.

11 changes: 11 additions & 0 deletions hetnetpy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
__version__ = "0.3.0"

if __name__ == "hetio":
# https://github.com/hetio/hetnetpy/issues/40
import warnings
message = (
"The 'hetio' package has been renamed to 'hetnetpy'. "
"Future versions will remove the ability to 'import hetio'. "
"Switch to 'import hetnetpy'."
)
warnings.warn(message, FutureWarning)
6 changes: 3 additions & 3 deletions hetio/abbreviation.py → hetnetpy/abbreviation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import regex

import hetio.hetnet
import hetnetpy.hetnet


def validate_abbreviations(metagraph):
Expand Down Expand Up @@ -113,12 +113,12 @@ def create_abbreviations(metagraph):
def metaedges_from_metapath(abbreviation, standardize_by=None):
"""
Get the abbreviated metaedges for an abbreviated metapath.
Pass a hetio.MetaGraph object to `standardize_by` to standardize metaedge
Pass a hetnetpy.MetaGraph object to `standardize_by` to standardize metaedge
abbreviations based on the non-inverted orietatation. Pass `text` to
standardize by alphabetical/forward-direction arrangment of the
abbreviation. Default (`None`) does not standardize.
"""
if isinstance(standardize_by, hetio.hetnet.MetaGraph):
if isinstance(standardize_by, hetnetpy.hetnet.MetaGraph):
metapath = standardize_by.metapath_from_abbrev(abbreviation)
return [metaedge.get_standard_abbrev() for metaedge in metapath]
# Note that this is a valid regex module pattern but will not work in the
Expand Down
20 changes: 10 additions & 10 deletions hetio/hetnet.py → hetnetpy/hetnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import functools
import re

import hetio.abbreviation
import hetnetpy.abbreviation

direction_to_inverse = {
'forward': 'backward',
Expand Down Expand Up @@ -255,7 +255,7 @@ def get_metaedge(self, metaedge):
raise ValueError('Cannot interpret object of type {}'.format(type(metaedge).__name__))
if metaedge in self.neo4j_to_metaedge:
return self.neo4j_to_metaedge[metaedge]
metaedge_id = hetio.abbreviation.metaedge_id_from_abbreviation(self, metaedge)
metaedge_id = hetnetpy.abbreviation.metaedge_id_from_abbreviation(self, metaedge)
return self.get_edge(metaedge_id)

def get_metapath(self, metapath):
Expand Down Expand Up @@ -302,10 +302,10 @@ def from_edge_tuples(metaedge_tuples, kind_to_abbrev=None):
metagraph.add_edge(edge_tuple)

if kind_to_abbrev is None:
kind_to_abbrev = hetio.abbreviation.create_abbreviations(metagraph)
kind_to_abbrev = hetnetpy.abbreviation.create_abbreviations(metagraph)
metagraph.set_abbreviations(kind_to_abbrev)

assert hetio.abbreviation.validate_abbreviations(metagraph)
assert hetnetpy.abbreviation.validate_abbreviations(metagraph)

return metagraph

Expand Down Expand Up @@ -441,9 +441,9 @@ def get_metapath_from_edges(self, edges):
def metapath_from_abbrev(self, abbrev):
"""Retrieve a metapath from its abbreviation"""
metaedges = list()
metaedge_abbrevs = hetio.abbreviation.metaedges_from_metapath(abbrev)
metaedge_abbrevs = hetnetpy.abbreviation.metaedges_from_metapath(abbrev)
for metaedge_abbrev in metaedge_abbrevs:
metaedge_id = hetio.abbreviation.metaedge_id_from_abbreviation(
metaedge_id = hetnetpy.abbreviation.metaedge_id_from_abbreviation(
self, metaedge_abbrev)
metaedges.append(self.get_edge(metaedge_id))
return self.get_metapath_from_edges(tuple(metaedges))
Expand Down Expand Up @@ -561,7 +561,7 @@ def __init__(self, metagraph, data=dict()):
Parameters
----------
metagraph : hetio.hetnet.MetaGraph
metagraph : hetnetpy.hetnet.MetaGraph
metagraph with the potential types of nodes and relationships
"""
BaseGraph.__init__(self)
Expand All @@ -574,7 +574,7 @@ def add_node(self, kind, identifier, name=None, data={}):
Parameters
----------
metagraph : hetio.hetnet.MetaGraph
metagraph : hetnetpy.hetnet.MetaGraph
metagraph with the potential types of nodes and relationships
kind : str
metanode kind
Expand All @@ -601,9 +601,9 @@ def add_edge(self, source_id, target_id, kind, direction, data=dict()):
Parameters
----------
source_id : hetio.hetnet.Node or tuple of (metanode, node) identifiers
source_id : hetnetpy.hetnet.Node or tuple of (metanode, node) identifiers
the source node for the edge
target_id : hetio.hetnet.Node or tuple of (metanode, node) identifiers
target_id : hetnetpy.hetnet.Node or tuple of (metanode, node) identifiers
the target node for the edge
kind : str
the metaedge kind
Expand Down
4 changes: 2 additions & 2 deletions hetio/matrix.py → hetnetpy/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def metaedge_to_adjacency_matrix(
Parameters
==========
graph : hetio.hetnet.graph
metaedge : hetio.hetnet.MetaEdge or an alternative metaedge specification
graph : hetnetpy.hetnet.graph
metaedge : hetnetpy.hetnet.MetaEdge or an alternative metaedge specification
dtype : type
dense_threshold : float (0 ≤ dense_threshold ≤ 1)
minimum proportion of nonzero values at which to output a dense matrix.
Expand Down
14 changes: 7 additions & 7 deletions hetio/neo4j.py → hetnetpy/neo4j.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import itertools
import textwrap

import hetio.hetnet
import hetnetpy.hetnet


@functools.lru_cache()
Expand Down Expand Up @@ -119,7 +119,7 @@ def as_label(metanode):
"""
import warnings
warnings.warn(
"hetio.neo4j.as_label is deprecated. Use metanode.neo4j_label instead.",
"hetnetpy.neo4j.as_label is deprecated. Use metanode.neo4j_label instead.",
DeprecationWarning,
)
return metanode.neo4j_label
Expand All @@ -131,10 +131,10 @@ def as_type(metaedge):
"""
import warnings
warnings.warn(
"hetio.neo4j.as_type is deprecated. Use metaedge.neo4j_rel_type instead.",
"hetnetpy.neo4j.as_type is deprecated. Use metaedge.neo4j_rel_type instead.",
DeprecationWarning,
)
assert isinstance(metaedge, hetio.hetnet.MetaEdge)
assert isinstance(metaedge, hetnetpy.hetnet.MetaEdge)
return metaedge.neo4j_rel_type


Expand Down Expand Up @@ -168,7 +168,7 @@ def cypher_path(metarels):
Format a metapath for cypher.
"""
# Convert metapath to metarels
if isinstance(metarels, hetio.hetnet.MetaPath):
if isinstance(metarels, hetnetpy.hetnet.MetaPath):
metarels = metapath_to_metarels(metarels)

# Create cypher query
Expand Down Expand Up @@ -357,7 +357,7 @@ def construct_dwpc_query(metarels, property='name', join_hint='midpoint', index_
which is the default, uses the `labeled` method.
"""
# Convert metapath to metarels
if isinstance(metarels, hetio.hetnet.MetaPath):
if isinstance(metarels, hetnetpy.hetnet.MetaPath):
metarels = metapath_to_metarels(metarels)

# create cypher path query
Expand Down Expand Up @@ -435,7 +435,7 @@ def construct_pdp_query(metarels, dwpc=None, path_style='list', return_property=
which is the default, uses the `labeled` method.
"""
# Convert metapath to metarels
if isinstance(metarels, hetio.hetnet.MetaPath):
if isinstance(metarels, hetnetpy.hetnet.MetaPath):
metarels = metapath_to_metarels(metarels)

# create cypher path query
Expand Down
2 changes: 1 addition & 1 deletion hetio/pathtools.py → hetnetpy/pathtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import functools
import operator

from hetio.hetnet import Node, Path
from hetnetpy.hetnet import Node, Path


def DWPC(paths, damping_exponent, exclude_edges=set(), exclude_masked=True):
Expand Down
6 changes: 3 additions & 3 deletions hetio/permute.py → hetnetpy/permute.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import random
import logging

from hetio.hetnet import Graph
from hetnetpy.hetnet import Graph


def permute_graph(graph, multiplier=10, seed=0, metaedge_to_excluded=dict(), log=False):
Expand All @@ -19,7 +19,7 @@ def permute_graph(graph, multiplier=10, seed=0, metaedge_to_excluded=dict(), log
Parameters
----------
graph : hetio.hetnet.Graph
graph : hetnetpy.hetnet.Graph
Input hetnet to create a permuted derivative from
multiplier : int or float
This is multiplied by the number of edges for each metaedge to
Expand All @@ -36,7 +36,7 @@ def permute_graph(graph, multiplier=10, seed=0, metaedge_to_excluded=dict(), log
Returns
-------
permuted_graph : hetio.hetnet.Graph
permuted_graph : hetnetpy.hetnet.Graph
A permuted hetnet derived from the input graph.
stats : list of dicts
A list where each item is a dictionary of permutation statistics at a
Expand Down
2 changes: 1 addition & 1 deletion hetio/readwrite.py → hetnetpy/readwrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
except ImportError:
fspath = str

from hetio.hetnet import Graph, MetaGraph
from hetnetpy.hetnet import Graph, MetaGraph


def read_graph(path, formatting=None):
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions release-notes/v0.3.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
hetio/hetnetpy v0.3.0
=====================

This release is the first with the new package name `hetnetpy`.
Users should now use `pip install hetnetpy` and `import hetnetpy`.
`import hetio` will still work but will trigger a FutureWarning.
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
directory = pathlib.Path(__file__).parent.absolute()

# version
init_path = directory.joinpath('hetio', '__init__.py')
init_path = directory.joinpath('hetnetpy', '__init__.py')
with init_path.open() as read_file:
text = read_file.read()
pattern = re.compile(r"^__version__ = ['\"]([^'\"]*)['\"]", re.MULTILINE)
Expand All @@ -30,9 +30,9 @@

setuptools.setup(
# Package details
name='hetio',
name='hetnetpy',
version=version,
url='https://github.com/hetio/hetio',
url='https://github.com/hetio/hetnetpy',
description='Hetnets in Python',
long_description_content_type='text/markdown',
long_description=long_description,
Expand All @@ -43,7 +43,7 @@
author_email='[email protected]',

# Package topics
keywords='hetnet graph heterogeneous network neo4j hetio',
keywords='hetnet graph heterogeneous network neo4j hetio hetnetpy',
classifiers=[
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Bio-Informatics',
Expand All @@ -56,7 +56,7 @@
'Programming Language :: Python :: 3.6',
],

packages=['hetio'],
packages=['hetnetpy', 'hetio'],

# Specify python version
python_requires='>=3.4',
Expand Down
Loading

0 comments on commit d88f81a

Please sign in to comment.