fraenkel-lab / OmicsIntegrator

This repository is the working directory for the Garnet-Forest bundle of python scripts for analyzing diverse forms of 'omic' data in a network context.
http://fraenkel.mit.edu/omicsintegrator
BSD 2-Clause "Simplified" License
31 stars 20 forks source link

Incompatibility with NetworkX version 2 #28

Closed gungorbudak closed 6 years ago

gungorbudak commented 6 years ago

networkx>=1.4 from requirements.txt installs networkx==2.1 as NetworkX was upgraded to 2.1 recently and I had the following error in a Docker image with ubuntu:14.04 base image.

Traceback (most recent call last):
  File "/opt/OmicsIntegrator-0.3.1/scripts/forest.py", line 1464, in <module>
    main()
  File "/opt/OmicsIntegrator-0.3.1/scripts/forest.py", line 1425, in main
    outputObj = PCSFOutput(inputObj,edgeList,info,options.outputpath,options.outputlabel,1)
  File "/opt/OmicsIntegrator-0.3.1/scripts/forest.py", line 757, in __init__
    nx.set_node_attributes(augForest, 'betweenness', betweenness)
  File "/usr/local/lib/python2.7/dist-packages/networkx/classes/function.py", line 654, in set_node_attributes
    G.nodes[n][name] = values
TypeError: unhashable type: 'dict'

Installing networkx==1.11 seems to resolve the issue and forest.py correctly generates the output files.

Here is the Dockerfile I used:

FROM ubuntu:14.04

LABEL maintainer "gngrbdk@gmail.com"

# Set /opt/ as working directory
WORKDIR /opt

# Copy this file into container
COPY Dockerfile /opt

# Update Ubuntu package index
RUN apt-get update

# Install common dependencies
RUN apt-get install -y \
    wget \
    unzip \
    build-essential \
    software-properties-common \
    libboost-all-dev \
    libxft-dev \
    libfreetype6-dev \
    libblas-dev \
    liblapack-dev \
    libatlas-base-dev \
    gfortran \
    python-pip \
    python-dev \
    python

# Download msgsteiner 1.3
RUN wget http://staff.polito.it/alfredo.braunstein/code/msgsteiner-1.3.tgz && tar xzf msgsteiner-1.3.tgz && rm msgsteiner-1.3.tgz

# Change dir into msgsteiner and compile
WORKDIR /opt/msgsteiner-1.3
RUN make

# Go back to original working directory
WORKDIR /opt

# Download Omics Integrator 0.3.1
RUN wget https://github.com/fraenkel-lab/OmicsIntegrator/archive/v0.3.1.zip && unzip v0.3.1.zip && rm v0.3.1.zip

# Install required Python packages
RUN pip install -r /opt/OmicsIntegrator-0.3.1/requirements.txt

# Download Forest Tuner
RUN wget https://raw.githubusercontent.com/gungorbudak/forest-tuner/master/forest-tuner.py
agitter commented 6 years ago

@gungorbudak thanks for reporting this error. I'll patch the requirements file.