Skip to content

Commit a2d0849

Browse files
committed
Merge pull request #47 from hammerlab/fix-travis
Fix installation of dependencies on Travis using conda
2 parents 434ffa0 + 0953984 commit a2d0849

File tree

8 files changed

+49
-31
lines changed

8 files changed

+49
-31
lines changed

.travis.yml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,43 @@ addons:
77
apt:
88
packages:
99
# Needed for NetMHC
10-
tcsh
11-
env:
12-
global:
13-
# MHC_BUNDLE_PASS
14-
- secure: "TIminZrp9m1kMXhemqz8Zx4BjojIoEYZJnNrDrL6T/pKMpP5FQ6sprj8meGfNse4ApRIPmp5lhqxbPOe7Cg7ooetIcORekjRueHwRkYXqgMbgffgZYuEJTAGLKFsBDEXFD1kWT7igmvXFsP1T0bb1TxRPK93Q5G+e1dEAm6Iqwo="
15-
# Setup anaconda for easily running scipy on Travis; see https://gist.github.com/dan-blanchard/7045057
10+
- tcsh
11+
# install pandoc for use with pypandoc for converting the README
12+
# from markdown to RST
13+
- pandoc
1614
before_install:
17-
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
18-
- chmod +x miniconda.sh
19-
- ./miniconda.sh -b
20-
- export PATH=/home/travis/miniconda/bin:$PATH
21-
- conda update --yes conda
15+
# Commands below copied from: http://conda.pydata.org/docs/travis.html
16+
# We do this conditionally because it saves us some downloading if the
17+
# version is the same.
18+
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
19+
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
20+
else
21+
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
22+
fi
23+
- bash miniconda.sh -b -p $HOME/miniconda
24+
- export PATH="$HOME/miniconda/bin:$PATH"
25+
# reset the shell's lookup table for program name to path mappings
26+
- hash -r
27+
- conda config --set always_yes yes --set changeps1 no
28+
- conda update -q conda
29+
# Useful for debugging any issues with conda
30+
- conda info -a
31+
# install netmhcbundle
2232
- git clone https://mhcbundle:[email protected]/hammerlab/netmhc-bundle.git
2333
- export NETMHC_BUNDLE_HOME=$PWD/netmhc-bundle
2434
- mkdir tmp
2535
- export NETMHC_BUNDLE_TMPDIR=$PWD/tmp
2636
- export PATH=$PATH:$NETMHC_BUNDLE_HOME/bin
37+
env:
38+
global:
39+
# MHC_BUNDLE_PASS
40+
- secure: "TIminZrp9m1kMXhemqz8Zx4BjojIoEYZJnNrDrL6T/pKMpP5FQ6sprj8meGfNse4ApRIPmp5lhqxbPOe7Cg7ooetIcORekjRueHwRkYXqgMbgffgZYuEJTAGLKFsBDEXFD1kWT7igmvXFsP1T0bb1TxRPK93Q5G+e1dEAm6Iqwo="
2741
install:
28-
- conda install --yes python=$TRAVIS_PYTHON_VERSION numpy scipy nose pandas matplotlib
42+
- >
43+
conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
44+
numpy scipy nose pandas matplotlib
45+
- source activate test-environment
46+
- pip install pypandoc
2947
- pip install -r requirements.txt
3048
- pip install .
3149
- pip install coveralls

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build Status](https://travis-ci.org/hammerlab/mhctools.svg?branch=master)](https://travis-ci.org/hammerlab/mhctools) [![Coverage Status](https://coveralls.io/repos/hammerlab/mhctools/badge.svg?branch=master)](https://coveralls.io/r/hammerlab/mhctools?branch=master)
22

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

66
## Example
77

mhctools/alleles.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def parse_allele_name(name, species_prefix=None):
171171
3) allele family
172172
4) allele code
173173
174-
If species_prefix is provided, that is used instead of getting the species prefix from the name.
174+
If species_prefix is provided, that is used instead of getting the species prefix from the name.
175175
(And in that case, a species prefix in the name will result in an error being raised.)
176176
177177
For example, in all of the following inputs:
@@ -338,7 +338,6 @@ def compact_allele_name(raw_allele):
338338
HLA-DPA1*01:05-DPB1*100:01 into DPA10105-DPB110001
339339
"""
340340
parsed_alleles = parse_classi_or_classii_allele_name(raw_allele)
341-
species = parsed_alleles[0].species
342341
normalized_list = []
343342
for parsed_allele in parsed_alleles:
344343
if len(parsed_allele.allele_family) > 0:

mhctools/epitope_collection_builder.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,20 @@ def add_binding_prediction(
102102
source_sequence = str(self.fasta_dictionary[source_sequence_key])
103103

104104
binding_prediction = BindingPrediction(
105-
source_sequence_key=source_sequence_key,
106-
source_sequence=source_sequence,
107-
offset=offset,
108-
allele=normalize_allele_name(allele),
109-
peptide=peptide,
110-
length=len(peptide),
111-
value=ic50,
112-
percentile_rank=rank,
113-
prediction_method_name=self.prediction_method_name,
114-
measure=self.binding_measure)
105+
source_sequence_key=source_sequence_key,
106+
source_sequence=source_sequence,
107+
offset=offset,
108+
allele=normalize_allele_name(allele),
109+
peptide=peptide,
110+
length=len(peptide),
111+
value=ic50,
112+
percentile_rank=rank,
113+
prediction_method_name=self.prediction_method_name,
114+
measure=self.binding_measure)
115115
self.binding_predictions.append(binding_prediction)
116116

117117
def get_collection(self):
118118
return EpitopeCollection(self.binding_predictions)
119119

120120
def get_dataframe(self):
121-
return self.get_collection.dataframe()
121+
return self.get_collection().dataframe()

mhctools/iedb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import logging
1717
import io
1818

19+
# pylint: disable=import-error
1920
from six.moves.urllib.request import urlopen, Request
21+
# pylint: disable=import-error
2022
from six.moves.urllib.parse import urlencode
2123
import pandas as pd
2224

mhctools/netmhc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
from .base_commandline_predictor import BaseCommandlinePredictor
1818
from .file_formats import parse_netmhc_stdout
1919

20-
2120
class NetMHC(BaseCommandlinePredictor):
22-
2321
def __init__(
2422
self,
2523
alleles,

mhctools/netmhcii_pan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121

2222
class NetMHCIIpan(BaseCommandlinePredictor):
23-
2423
def __init__(
2524
self,
2625
alleles,

mhctools/process_helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from subprocess import Popen, CalledProcessError
1919
import time
2020

21+
# pylint: disable=import-error
2122
from six.moves.queue import Queue
2223

2324
class AsyncProcess(object):
@@ -123,7 +124,7 @@ def add_to_queue(process):
123124
# Are there any done processes?
124125
to_remove = []
125126
for possibly_done in processes.queue:
126-
if possibly_done.poll() != None:
127+
if possibly_done.poll() is not None:
127128
possibly_done.wait()
128129
to_remove.append(possibly_done)
129130
# Remove them from the queue and stop checking
@@ -140,6 +141,7 @@ def add_to_queue(process):
140141
processes.get().wait()
141142

142143
elapsed_time = time.time() - start_time
143-
logging.info("Ran %d commands in %0.4f seconds",
144+
logging.info(
145+
"Ran %d commands in %0.4f seconds",
144146
len(multiple_args_dict),
145147
elapsed_time)

0 commit comments

Comments
 (0)