Skip to content

Commit

Permalink
Merge pull request #132 from hammerlab/update-travis-config
Browse files Browse the repository at this point in the history
Copied new travis config from Varcode
  • Loading branch information
iskandr committed Dec 18, 2015
2 parents de7916e + 2ff9f12 commit 6ef59f3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
32 changes: 23 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,38 @@ language: python
python:
- "2.7"
- "3.4"
# Setup anaconda; 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
# Commands below copied from: http://conda.pydata.org/docs/travis.html
# We do this conditionally because it saves us some downloading if the
# version is the same.
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
# reset the shell's lookup table for program name to path mappings
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
addons:
apt:
packages:
# install pandoc for use with pypandoc for converting the README
# from markdown to RST
- pandoc
install:
- conda install --yes python=$TRAVIS_PYTHON_VERSION numpy scipy nose pandas matplotlib
- >
conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
numpy scipy nose pandas matplotlib
- source activate test-environment
- pip install pypandoc
- pip install -r requirements.txt
- pip install .
- pip install coveralls
# required for generating reStructuredText README
- pip install pypandoc
script:
# human releases
- pyensembl install --release 54 --species human
Expand Down
8 changes: 7 additions & 1 deletion lint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#!/bin/bash
set -o errexit


# disabling several categories of errors due to false positives in pylint,
# see these issues:
# - https://bitbucket.org/logilab/pylint/issues/701/false-positives-with-not-an-iterable-and
# - https://bitbucket.org/logilab/pylint/issues/58

find . -name '*.py' \
| xargs pylint \
--errors-only \
--disable=print-statement
--disable=print-statement,unsubscriptable-object,not-an-iterable,no-member

echo 'Passes pylint check'
13 changes: 9 additions & 4 deletions pyensembl/ensembl_url_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from __future__ import print_function, division, absolute_import
from os.path import join

from six.moves.urllib_parse import urljoin
from six.moves import urllib_parse

from .species import Species, find_species_by_name
from .ensembl_release_versions import check_release_number
Expand All @@ -36,6 +36,7 @@
# GTF annotation files: /pub/release-78/gtf/homo_sapiens/
SPECIES_SUBDIR_TEMPLATE = "/pub/release-%(release)d/%(filetype)s/%(species)s/"


def _species_subdir(
ensembl_release,
species="homo_sapiens",
Expand All @@ -51,6 +52,7 @@ def _species_subdir(
"species": species,
}


def _normalize_release_properties(ensembl_release, species):
"""
Make sure a given release is valid, normalize it to be an integer,
Expand All @@ -65,6 +67,7 @@ def _normalize_release_properties(ensembl_release, species):
# GTF annotation file example: Homo_sapiens.GTCh38.gtf.gz
GTF_FILENAME_TEMPLATE = "%(Species)s.%(reference)s.%(release)d.gtf.gz"


def make_gtf_url(ensembl_release, species, server=ENSEMBL_FTP_SERVER):
"""
Returns a URL and a filename, which can be joined together.
Expand All @@ -78,7 +81,7 @@ def make_gtf_url(ensembl_release, species, server=ENSEMBL_FTP_SERVER):
filetype="gtf",
server=server)

url_subdir = urljoin(server, subdir)
url_subdir = urllib_parse.urljoin(server, subdir)

filename = GTF_FILENAME_TEMPLATE % {
"Species": species.capitalize(),
Expand All @@ -91,6 +94,7 @@ def make_gtf_url(ensembl_release, species, server=ENSEMBL_FTP_SERVER):
FASTA_DNA_CHROMOSOME_FILENAME_TEMPLATE = \
"%(Species)s.%(reference)s.%(release)d.%(sequence_type)s.chromosome.%(contig)s.fa.gz"


def make_fasta_dna_url(
ensembl_release,
species,
Expand All @@ -107,7 +111,7 @@ def make_fasta_dna_url(
species=species,
filetype="fasta",
server=server,)
server_subdir = urljoin(server, subdir)
server_subdir = urllib_parse.urljoin(server, subdir)

server_sequence_subdir = join(server_subdir, "dna")
filename = FASTA_DNA_CHROMOSOME_FILENAME_TEMPLATE % {
Expand All @@ -130,6 +134,7 @@ def make_fasta_dna_url(
NEW_FASTA_FILENAME_TEMPLATE = \
"%(Species)s.%(reference)s.%(sequence_type)s.all.fa.gz"


def make_fasta_url(
ensembl_release,
species,
Expand All @@ -150,7 +155,7 @@ def make_fasta_url(
filetype="fasta",
server=server)

server_subdir = urljoin(server, subdir)
server_subdir = urllib_parse.urljoin(server, subdir)
server_sequence_subdir = join(server_subdir, sequence_type)
if ensembl_release <= 75:
filename = OLD_FASTA_FILENAME_TEMPLATE % {
Expand Down

0 comments on commit 6ef59f3

Please sign in to comment.