Skip to content

Commit

Permalink
Merge pull request #25 from hammerlab/travis
Browse files Browse the repository at this point in the history
Add Travis to mhctools
  • Loading branch information
tavinathanson committed Aug 25, 2015
2 parents b260b3c + b879068 commit b256817
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 8 deletions.
39 changes: 39 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
sudo: false # Use container-based infrastructure
language: python
python:
- "2.7"
- "3.4"
addons:
apt:
packages:
# Needed for NetMHC
tcsh
env:
global:
# MHC_BUNDLE_PASS
- secure: "TIminZrp9m1kMXhemqz8Zx4BjojIoEYZJnNrDrL6T/pKMpP5FQ6sprj8meGfNse4ApRIPmp5lhqxbPOe7Cg7ooetIcORekjRueHwRkYXqgMbgffgZYuEJTAGLKFsBDEXFD1kWT7igmvXFsP1T0bb1TxRPK93Q5G+e1dEAm6Iqwo="
# Setup anaconda for easily running scipy on Travis; see https://gist.github.com/dan-blanchard/7045057
before_install:
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b
- export PATH=/home/travis/miniconda/bin:$PATH
- conda update --yes conda
- git clone https://mhcbundle:[email protected]/hammerlab/netmhc-bundle.git
- export NETMHC_BUNDLE_HOME=$PWD/netmhc-bundle
- mkdir tmp
- export NETMHC_BUNDLE_TMPDIR=$PWD/tmp
- export PATH=$PATH:$NETMHC_BUNDLE_HOME/bin
install:
- conda install --yes python=$TRAVIS_PYTHON_VERSION numpy scipy nose pandas
- pip install -r requirements.txt
- pip install .
script: nosetests test && ./lint.sh
deploy:
provider: pypi
user: hammerlab
password: # See http://docs.travis-ci.com/user/encryption-keys/
secure: "gJSWl4PLXKtVc2ERwbzfd4qKk9Yy4T8dpfR7Q89VLVXTd7Tv1SsEknShJZUFaCPN85aYFcAWsoOI6vSlBSdXeTONU/pmPgcWOLfiErsgCqUs6qq7edOhrtOS307SREX4oF6AF2iyJduWAF4NPq+9IoJUROIiB4u5qeUtWfVu2Eo="
on:
tags: true
branch: master
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/hammerlab/mhctools.svg?branch=master)](https://travis-ci.org/hammerlab/mhctools)

# mhctools
Python interface to running command-line and web-based MHC binding predictors.

Expand Down
9 changes: 9 additions & 0 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -o errexit

find mhctools test -name '*.py' \
| xargs pylint \
--errors-only \
--disable=print-statement

echo 'Passes pylint check'
1 change: 1 addition & 0 deletions mhctools/base_commandline_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def _determine_valid_alleles(command, supported_allele_flag):
logging.info("Skipping allele %s: %s" % (
line, error))
continue
return valid_alleles
except:
logging.warning(
"Failed to run %s %s",
Expand Down
1 change: 1 addition & 0 deletions mhctools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

# Python3 doesn't have a unicode classes
try:
# pylint: disable=undefined-variable
string_classes = (unicode, str)
except NameError:
string_classes = (str,)
Expand Down
2 changes: 1 addition & 1 deletion mhctools/epitope_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def strong_binders_by_rank(self, max_rank=2.0):

def groupby(self, key_fn):
groups = defaultdict(list)
for binding_prediction in self.binding_predictions:
for binding_prediction in self.elements:
key = key_fn(binding_prediction)
groups[key].append(binding_prediction)
# want to create an EpitopeCollection for each group
Expand Down
5 changes: 5 additions & 0 deletions mhctools/iedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def _parse_iedb_response(response):
if len(response) == 0:
raise ValueError("Empty response from IEDB!")
df = pd.read_csv(io.BytesIO(response), delim_whitespace=True, header=0)

# pylint doesn't realize that df is a DataFrame, so tell is
assert type(df) == pd.DataFrame
df = pd.DataFrame(df)

if len(df) == 0:
raise ValueError(
"No binding predictions in response from IEDB: %s" % (response,))
Expand Down
4 changes: 4 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[TYPECHECK]
# Without ignoring this, we get errors like:
# E:249,20: Module 'numpy' has no 'nan' member (no-member)
ignored-modules = numpy
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
numpy==1.7
pandas==0.13.1
varcode >=0.3.17
six >= 1.9.0
numpy>=1.7
pandas>=0.13.1
varcode>=0.3.17
six>=1.9.0
pylint>=1.4.4
nose>=1.3.6
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if __name__ == '__main__':
setup(
name='mhctools',
version="0.1.3",
version="0.1.4",
description="Python interface to running command-line and web-based MHC binding predictors",
author="Alex Rubinsteyn",
author_email="alex {dot} rubinsteyn {at} mssm {dot} edu",
Expand All @@ -55,8 +55,8 @@
install_requires=[
'numpy>=1.7',
'pandas>=0.13.1',
'varcode >=0.3.17',
'six >=1.9.0'
'varcode>=0.3.17',
'six>=1.9.0'
],
long_description=readme,
packages=['mhctools'],
Expand Down
1 change: 1 addition & 0 deletions test/test_known_epitopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import mhctools

mhc_classes = [
mhctools.NetMHCcons,
mhctools.NetMHCpan,
mhctools.NetMHCcons,
mhctools.NetMHC,
Expand Down

0 comments on commit b256817

Please sign in to comment.