Skip to content

Commit ca7cafd

Browse files
authored
Merge pull request #7 from ajshedivy/cytoscape
Cytoscape
2 parents 1421d59 + 0dada84 commit ca7cafd

File tree

24 files changed

+803
-540
lines changed

24 files changed

+803
-540
lines changed

.github/workflows/test.yml

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,14 @@ jobs:
2020
auto-activate-base: false
2121
auto-update-conda: false
2222
miniconda-version: 'latest'
23+
# Log conda environment contents
24+
- name: Log conda environment
25+
shell: bash --login {0}
26+
run: conda list
2327
# Run the PCSF tests in the pcsf conda environment
2428
- name: Test PCSF
2529
shell: bash --login {0}
2630
run: pytest pcsf/tests/
27-
workflow:
28-
name: Test TPS workflow
29-
runs-on: ${{ matrix.os }}
30-
strategy:
31-
matrix:
32-
os: [ubuntu-latest]
33-
steps:
34-
- name: Checkout repository
35-
uses: actions/checkout@v2
36-
- name: Install conda environment
37-
uses: conda-incubator/setup-miniconda@v2
38-
with:
39-
activate-environment: tps_workflow
40-
environment-file: workflow/minimal_env.yml
41-
auto-activate-base: false
42-
miniconda-version: 'latest'
43-
# Run the workflow tests
44-
- name: Test workflow
45-
shell: bash --login {0}
46-
# Verbose output and disable stdout and stderr capturing
47-
run: pytest -vs workflow/tests/
4831
docker:
4932
name: Build Docker images
5033
runs-on: ${{ matrix.os }}
@@ -58,7 +41,7 @@ jobs:
5841
uses: docker/build-push-action@v1
5942
with:
6043
path: .
61-
dockerfile: docker/tps/Dockerfile
44+
dockerfile: containers/tps/Dockerfile
6245
repository: ajshedivy/tps
6346
tags: latest
6447
cache_froms: ajshedivy/tps:latest
@@ -67,8 +50,36 @@ jobs:
6750
uses: docker/build-push-action@v1
6851
with:
6952
path: .
70-
dockerfile: docker/cytoscape/Dockerfile
53+
dockerfile: containers/cytoscape/Dockerfile
7154
repository: ajshedivy/cytoscape
7255
tags: latest
7356
cache_froms: ajshedivy/cytoscape:latest
7457
push: false
58+
workflow:
59+
name: Test TPS workflow
60+
runs-on: ${{ matrix.os }}
61+
strategy:
62+
matrix:
63+
os: [ubuntu-latest]
64+
steps:
65+
- name: Checkout repository
66+
uses: actions/checkout@v2
67+
- name: Install conda environment
68+
uses: conda-incubator/setup-miniconda@v2
69+
with:
70+
activate-environment: tps_workflow
71+
environment-file: workflow/minimal_env.yml
72+
auto-activate-base: false
73+
miniconda-version: 'latest'
74+
# Log conda environment contents
75+
- name: Log conda environment
76+
shell: bash --login {0}
77+
run: conda list
78+
# Run the workflow tests
79+
- name: Test workflow with pytest
80+
shell: bash --login {0}
81+
# Verbose output and disable stdout and stderr capturing
82+
run: pytest -vs workflow/tests/
83+
- name: Test workflow with script
84+
shell: bash --login {0}
85+
run: bash workflow.sh --config workflow/config/default_config.yaml --execute all

containers/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
# The following docker image is derived from a containerized version
2-
# of Cytoscape with GUI support
3-
#
4-
# https://github.com/cytoscape/docker-cytoscape-desktop
5-
6-
FROM ubuntu:20.04
7-
8-
# PARAMETERS
9-
ENV CYTOSCAPE_VERSION=3.8.2
10-
11-
# CHANGE USER
12-
USER root
13-
14-
# https://github.com/cytoscape/cytoscape/releases/download/3.8.2/cytoscape-unix-3.8.2.tar.gz
15-
# INSTALL JAVA
16-
RUN apt-get update && apt-get -y install default-jdk libxcursor1 xvfb supervisor wget x11vnc
17-
RUN wget https://github.com/cytoscape/cytoscape/releases/download/${CYTOSCAPE_VERSION}/cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz
18-
RUN tar xf cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz && rm cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz
19-
20-
# Set JAVA_HOME From sudo update-alternatives --config java
21-
RUN echo 'JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"' >> /etc/environment
22-
23-
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
24-
25-
ENV PATH /opt/conda/bin:$PATH
26-
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh -O ~/miniconda.sh && \
27-
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
28-
rm ~/miniconda.sh && \
29-
/opt/conda/bin/conda clean --all && \
30-
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
31-
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
32-
conda init bash
33-
34-
COPY docker/cytoscape/env.yml /docker/minimal_env.yml
35-
RUN conda env create -f docker/minimal_env.yml
36-
37-
COPY docker/cytoscape/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
38-
COPY docker/cytoscape/src/connect_cytoscape.py /cytoscape/connect_cytoscape.py
39-
COPY docker/cytoscape/src/connect.sh /cytoscape/connect.sh
40-
41-
EXPOSE 1234 5900
42-
CMD ["/usr/bin/supervisord > /dev/null 2>&1"]
1+
# The following docker image is derived from a containerized version
2+
# of Cytoscape with GUI support
3+
#
4+
# https://github.com/cytoscape/docker-cytoscape-desktop
5+
6+
FROM ubuntu:20.04
7+
8+
# PARAMETERS
9+
ENV CYTOSCAPE_VERSION=3.8.2
10+
11+
# CHANGE USER
12+
USER root
13+
14+
# https://github.com/cytoscape/cytoscape/releases/download/3.8.2/cytoscape-unix-3.8.2.tar.gz
15+
# INSTALL JAVA
16+
RUN apt-get update && apt-get -y install default-jdk libxcursor1 xvfb supervisor wget x11vnc
17+
RUN wget https://github.com/cytoscape/cytoscape/releases/download/${CYTOSCAPE_VERSION}/cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz
18+
RUN tar xf cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz && rm cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz
19+
20+
# Set JAVA_HOME From sudo update-alternatives --config java
21+
RUN echo 'JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"' >> /etc/environment
22+
23+
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
24+
25+
ENV PATH /opt/conda/bin:$PATH
26+
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh -O ~/miniconda.sh && \
27+
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
28+
rm ~/miniconda.sh && \
29+
/opt/conda/bin/conda clean --all && \
30+
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
31+
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
32+
conda init bash
33+
34+
COPY containers/cytoscape/env.yml /docker/minimal_env.yml
35+
RUN conda env create -f /docker/minimal_env.yml
36+
37+
COPY containers/cytoscape/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
38+
COPY containers/cytoscape/src/connect_cytoscape.py /cytoscape/connect_cytoscape.py
39+
COPY containers/cytoscape/src/connect.sh /cytoscape/connect.sh
40+
41+
EXPOSE 1234 5900
42+
CMD ["/usr/bin/supervisord > /dev/null 2>&1"]

containers/cytoscape/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: tps_workflow
2-
channels:
3-
- conda-forge
4-
- defaults
5-
dependencies:
6-
- python=3.6
7-
- pip=20.0
8-
- pip:
1+
name: tps_workflow
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- python=3.6
7+
- pip=20.0
8+
- pip:
99
- py2cytoscape==0.7.1

containers/cytoscape/src/__init__.py

Whitespace-only changes.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
3+
if (($# == 0)); then
4+
exit 0
5+
fi
6+
7+
POSITIONAL_ARGS=()
8+
9+
while [[ $# -gt 0 ]]; do
10+
case $1 in
11+
-s|--save)
12+
SAVE="$2"
13+
shift # past argument
14+
shift # past value
15+
;;
16+
-y|--style)
17+
STYLE="$2"
18+
shift # past argument
19+
shift # past value
20+
;;
21+
-a|--annot)
22+
ANNOTATIONS="$2"
23+
shift # past argument
24+
shift # past value
25+
;;
26+
-n|--network)
27+
NETWORK="$2"
28+
shift # past argument
29+
shift # past value
30+
;;
31+
-d|--datatypes)
32+
DATATYPES="$2"
33+
shift # past argument
34+
shift # past value
35+
;;
36+
-*|--*)
37+
echo "Unknown option $1"
38+
exit 1
39+
;;
40+
*)
41+
POSITIONAL_ARGS+=("$1") # save positional arg
42+
shift # past argument
43+
;;
44+
esac
45+
done
46+
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
47+
48+
echo "SAVE FILE = ${SAVE}"
49+
echo "STYLE FILE = ${STYLE}"
50+
echo "ANNOTATIONS FILE = ${ANNOTATIONS}"
51+
echo "NETWORK FILE = ${NETWORK}"
52+
echo "DATA TYPES = ${DATATYPES}"
53+
54+
if [[ -n $1 ]]; then
55+
echo "error: invalid arguments"
56+
exit 0
57+
fi
58+
59+
echo "activate TPS environment"
60+
eval "$(conda shell.bash hook)"
61+
conda activate tps_workflow
62+
63+
if [ $? -ne 0 ]; then
64+
echo "environment does not exist"
65+
echo "creating TPS environment"
66+
conda env create -f /docker/minimal_env.yml
67+
conda activate tps_workflow
68+
fi
69+
echo "environment activated"
70+
71+
python connect_cytoscape.py --save ${SAVE} --style ${STYLE} --annot ${ANNOTATIONS} --network ${NETWORK} --datatypes ${DATATYPES}

0 commit comments

Comments
 (0)