Skip to content

Commit bb7b390

Browse files
authored
Merge pull request #25 from PathwayMerger/ppi-exporter
Ppi exporter
2 parents 29c5691 + 264f16f commit bb7b390

File tree

24 files changed

+155
-159
lines changed

24 files changed

+155
-159
lines changed

.coveragerc

Lines changed: 0 additions & 19 deletions
This file was deleted.

.flake8

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
#########################
66

77
[flake8]
8-
ignore =
9-
E501
10-
I100 # Import statements are in the wrong order
11-
I101 # Imported names are in the wrong order
8+
ignore =
9+
E501 # Line too long
1210
F405 # Stars import
1311
F403 # imports not used in init
1412
F401 # imports not used in init
@@ -25,7 +23,10 @@ exclude =
2523
*.egg-info,
2624
.cache,
2725
.eggs
28-
max-complexity = 10
26+
max-complexity = 20
27+
max-line-length = 120
2928
import-order-style = pycharm
30-
application-import-names = pathme
29+
application-import-names =
30+
pathme
31+
tests
3132
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s

.readthedocs.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# See: https://docs.readthedocs.io/en/latest/yaml-config.html
2-
build:
3-
image: latest
42
python:
5-
version: 3.6
3+
version: 3
64
pip_install: true
75
extra_requirements:
8-
- docs
6+
- docs

.travis.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
sudo: false
22
cache: pip
3+
34
language: python
45
python:
5-
- 3.6
6+
- 3.7
67
stages:
78
- lint
89
- docs
@@ -13,9 +14,6 @@ jobs:
1314
- stage: lint
1415
env: TOXENV=manifest
1516
- env: TOXENV=flake8
16-
- env: TOXENV=flake8-kegg
17-
- env: TOXENV=xenon
18-
- env: TOXENV=vulture
1917
- env: TOXENV=pyroma
2018
# docs stage
2119
- stage: docs
@@ -25,21 +23,11 @@ jobs:
2523
# test stage
2624
- stage: test
2725
env: TOXENV=py
28-
- env: TOXENV=py PATHME_TESTS=tests/test_kegg/
29-
matrix:
30-
allow_failures:
31-
- env: TOXENV=flake8
32-
- env: TOXENV=xenon
33-
- env: TOXENV=vulture
3426
install:
35-
- pip install --upgrade pip
36-
- pip install tox
37-
- pip install codecov
38-
- pip install coverage
27+
- sh -c 'if [ "$TOXENV" = "py" ]; then pip install tox codecov; else pip install tox; fi'
3928
script:
40-
- tox
29+
- tox
4130
after_success:
42-
- tox -e coverage-report
43-
- codecov
31+
- sh -c 'if [ "$TOXENV" = "py" ]; then tox -e coverage-report; codecov; fi'
4432
notifications:
4533
slack: pybel:n2KbWKBum3musnBg3L76gGwq

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2018-2019 Daniel Domingo-Fernandez
189+
Copyright 2018-2020 Daniel Domingo-Fernández
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

doc8.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
source_suffix = '.rst'
1919
master_doc = 'index'
2020
project = 'PathMe'
21-
copyright = '2018, Daniel Domingo-Fernández, Sarah Mubeen, and Josep Marin Llao'
22-
author = 'Daniel Domingo-Fernández, Sarah Mubeen, and Josep Marin Llao'
21+
copyright = '2020, Daniel Domingo-Fernández, Sarah Mubeen, Josep Marin Llao, and Charles Tapley Hoyt'
22+
author = 'Daniel Domingo-Fernández, Sarah Mubeen, Josep Marin Llao, and Charles Tapley Hoyt'
2323

2424
release = '0.1.12-dev'
2525

@@ -44,7 +44,7 @@
4444
latex_elements = {}
4545
latex_documents = [
4646
(master_doc, 'pathme.tex', 'PathMe Documentation',
47-
'Sarah Mubeen, Josep Marin Llao, and Daniel Domingo-Fernández', 'manual'),
47+
'Daniel Domingo-Fernández, Sarah Mubeen, Josep Marin Llao, and Charles Tapley Hoyt', 'manual'),
4848
]
4949
man_pages = [
5050
(master_doc, 'pathme', 'PathMe Documentation', [author], 1)

setup.cfg

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ classifiers =
3535
Operating System :: OS Independent
3636
Programming Language :: Python
3737
Programming Language :: Python :: 3.7
38-
Programming Language :: Python :: 3.6
3938
Programming Language :: Python :: 3 :: Only
4039
Topic :: Scientific/Engineering :: Bio-Informatics
4140

@@ -65,7 +64,7 @@ install_requires =
6564
# Random options
6665
zip_safe = false
6766
include_package_data = True
68-
python_requires = >=3.6
67+
python_requires = >=3.7
6968

7069
# Where is my code
7170
packages = find:
@@ -100,6 +99,16 @@ max-line-length = 120
10099
[coverage:run]
101100
branch = True
102101
source = pathme
102+
omit =
103+
src/pathme/__main__.py
104+
src/pathme/cli.py
105+
tests/*
106+
docs/*
107+
108+
[coverage:paths]
109+
source =
110+
src/pathme
111+
.tox/*/lib/python*/site-packages/pathme
103112

104113
[coverage:report]
105114
show_missing = True

src/pathme/cli.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
import pathme.kegg.cli
1616
import pathme.reactome.cli
1717
import pathme.wikipathways.cli
18-
from .constants import CX_DIR, KEGG_BEL, REACTOME_BEL, SPIA_DIR, UNIVERSE_DIR, WIKIPATHWAYS_BEL
19-
from .export_utils import get_universe_graph, iterate_universe_graphs, spia_export_helper
18+
from .constants import CX_DIR, KEGG_BEL, PPI_DIR, REACTOME_BEL, SPIA_DIR, UNIVERSE_DIR, WIKIPATHWAYS_BEL
19+
from .export_utils import export_helper, get_universe_graph, iterate_universe_graphs
2020

2121
logger = logging.getLogger(__name__)
2222

@@ -69,14 +69,31 @@ def export():
6969
def spia(kegg_path, reactome_path, wikipathways_path, output):
7070
"""Export BEL Pickles to SPIA Excel."""
7171
click.echo(f'Results will be exported to {output}')
72-
spia_export_helper(
72+
export_helper(
7373
kegg_path=kegg_path,
7474
reactome_path=reactome_path,
7575
wikipathways_path=wikipathways_path,
7676
output=output,
7777
)
7878

7979

80+
@export.command()
81+
@kegg_path_option
82+
@reactome_path_option
83+
@wikipathways_path_option
84+
@click.option('-o', '--output', help='Output directory', default=PPI_DIR, show_default=True)
85+
def ppi(kegg_path, reactome_path, wikipathways_path, output):
86+
"""Export BEL Pickles to PPI-like tsv file."""
87+
click.echo(f'Results will be exported to {output}')
88+
export_helper(
89+
kegg_path=kegg_path,
90+
reactome_path=reactome_path,
91+
wikipathways_path=wikipathways_path,
92+
output=output,
93+
format='ppi',
94+
)
95+
96+
8097
@export.command()
8198
@kegg_path_option
8299
@reactome_path_option
@@ -94,11 +111,11 @@ def cx(kegg_path, reactome_path, wikipathways_path, output, no_flatten, no_norma
94111

95112
click.echo(f'Results will be exported to {output}')
96113
for source, path, graph in iterate_universe_graphs(
97-
kegg_path=kegg_path,
98-
reactome_path=reactome_path,
99-
wikipathways_path=wikipathways_path,
100-
flatten=(not no_flatten),
101-
normalize_names=(not no_normalize_names),
114+
kegg_path=kegg_path,
115+
reactome_path=reactome_path,
116+
wikipathways_path=wikipathways_path,
117+
flatten=(not no_flatten),
118+
normalize_names=(not no_normalize_names),
102119
):
103120
with open(os.path.join(output, f"{path.strip('.pickle')}.cx.json"), 'w') as file:
104121
to_cx_file(graph, file)

src/pathme/constants.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@ def get_data_dir() -> str:
3939

4040
SPIA_DIR = os.path.join(DATA_DIR, 'spia')
4141
CX_DIR = os.path.join(DATA_DIR, 'cx')
42+
PPI_DIR = os.path.join(DATA_DIR, 'ppi')
4243
UNIVERSE_DIR = os.path.join(DATA_DIR, 'universe')
4344

4445

45-
def ensure_pathme_folders(): # TODO why is this a function?
46+
def ensure_pathme_folders():
4647
"""Ensure data folders are created."""
4748
os.makedirs(KEGG_DIR, exist_ok=True)
4849
os.makedirs(REACTOME_DIR, exist_ok=True)
4950
os.makedirs(WIKIPATHWAYS_DIR, exist_ok=True)
5051
os.makedirs(KEGG_CACHE, exist_ok=True)
5152
os.makedirs(SPIA_DIR, exist_ok=True)
53+
os.makedirs(CX_DIR, exist_ok=True)
54+
os.makedirs(PPI_DIR, exist_ok=True)
5255
os.makedirs(UNIVERSE_DIR, exist_ok=True)
5356

5457
os.makedirs(KEGG_BEL, exist_ok=True)

0 commit comments

Comments
 (0)