Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
Add more docs
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
cthoyt committed Apr 10, 2019
1 parent a7d045f commit 1f393c0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/source/convert.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Handling BEL
============
.. autofunction:: biokeen.convert.to_pykeen_path
.. autofunction:: biokeen.convert.to_pykeen_df
9 changes: 8 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ by using its interactive command line interface that can be started with the com
Installation is as easy as getting the code from `PyPI <https://pypi.python.org/pypi/biokeen>`_ with
:code:`python3 -m pip install biokeen`.


Citation
--------
If you use BioKEEN in your work, please cite [1]_:
Expand Down Expand Up @@ -46,6 +45,14 @@ If you use BioKEEN in your work, please cite [1]_:
train_and_evaluate
hyper_parameter_optimization


.. toctree::
:maxdepth: 2
:caption: Reference
:name: reference

convert

.. toctree::
:maxdepth: 2
:caption: Biological Databases
Expand Down
2 changes: 2 additions & 0 deletions src/biokeen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

"""BioKEEN."""

from . import convert
10 changes: 9 additions & 1 deletion src/biokeen/convert/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@


def to_pykeen_path(df: pd.DataFrame, path: str) -> bool:
"""Write the relationships in the BEL graph to a KEEN TSV file."""
"""Write the relationships in the BEL graph to a KEEN TSV file.
If you have a BEL graph, first do:
>>> from biokeen.convert import to_pykeen_df, to_pykeen_path
>>> graph = ... # Something from PyBEL
>>> df = to_pykeen_df(graph)
>>> to_pykeen_path(df, 'graph.keen.tsv')
"""
if len(df.index) == 0:
return False
df.to_csv(path, sep='\t', index=None, header=None)
Expand Down

0 comments on commit 1f393c0

Please sign in to comment.