Skip to content

Commit

Permalink
Merge pull request #64 from t-neumann/condaslimmming
Browse files Browse the repository at this point in the history
Condaslimmming
  • Loading branch information
t-neumann authored Dec 14, 2019
2 parents 6d7b2d0 + 7546772 commit 385ffda
Show file tree
Hide file tree
Showing 3,704 changed files with 5,688 additions and 491,283 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
49 changes: 28 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
sudo: false
dist: trusty

language: python
python:
# We don't actually use the Travis Python, but this keeps it organized.
- "2.7"
- "3.5"
- "3.6"
- "3.7"

before_install:

# Here we just install Miniconda, which you shouldn't have to change.
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
else
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH=/home/travis/miniconda/bin:$PATH
- conda update --yes conda
- conda config --add channels defaults
- conda config --add channels bioconda
- conda config --add channels conda-forge

cache:
pip: true
apt: true
#directories:
#- /home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages
#- /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages
#- /home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/slamdunk/plot/Rslamdunk
#- /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/slamdunk/plot/Rslamdunk
addons:
apt:
packages:
- r-base
install:

# command to install dependencies
install:
- pip install pytest
- pip install -r requirements.txt
- python setup.py -q install
# We just set up a conda environment with the right Python version. This
# should not need changing.

- conda env create -f environment.yml
- source activate slamdunk
- pip install pytest
- pip install .

# command to run tests
script:
Expand All @@ -31,4 +39,3 @@ script:
- splash -h
- slamdunk/test/test_sample.sh
- pytest

15 changes: 15 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: slamdunk
dependencies:
- nextgenmap=0.5.5
- samtools=1.10
- varscan=2.4.4
- r-tidyverse=1.3.0
- r-matrixstats=0.55.0
- r-gridextra=2.3
- r-getopt=1.20.3
- joblib=0.14.0
- pandas=0.25.3
- cython=0.29.14
- biopython=1.74
- pybedtools=0.8.0
- intervaltree=3.0.2
88 changes: 15 additions & 73 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
#
# Slamdunk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
#
# Slamdunk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

Expand All @@ -33,10 +33,10 @@
#Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

# now we have a `__version__` variable
exec(open(path.join(here, name, 'version.py')).read())

# Copy bin recursively
def package_files(directory):
paths = []
Expand All @@ -47,82 +47,27 @@ def package_files(directory):

bin_files = package_files(name + os.sep + 'contrib')
plot_files = package_files(name + os.sep + 'plot')
def _runExternalBuilds(dir, externalNGM, externalSamtools, skipRLibraries):

def _runExternalBuilds(dir):

import subprocess

print("Setting up R package destination.")
syscall = "mkdir -p " + os.path.join(dir, name, "plot", "Rslamdunk")
print(syscall)
subprocess.call([syscall], shell=True)

if (skipRLibraries is None) :
print("Installing R packages.")
syscall = "export R_LIBS_SITE=" + os.path.join(dir, name, "plot", "Rslamdunk") + " ; "
syscall += "R --vanilla -e 'libLoc = .libPaths()[grep(\"Rslamdunk\",.libPaths())]; source(\"" + os.path.join(dir, name, "plot", "checkLibraries.R") + "\"); checkLib(libLoc)'"
print(syscall)
p = subprocess.Popen(syscall, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
lines_iterator = iter(p.stdout.readline, b"")
for line in lines_iterator:
print(line, end="")
p.wait();
if(p.returncode != 0):
raise RuntimeError("Error while executing command: \"" + syscall + "\"")
else :
print("Skipping R package installation.")
print("(Retrying upon first alleyoop / splash run).")

if (externalSamtools is None) :
print("Building Samtools.")
syscall = "(cd " + os.path.join(dir, name, "contrib") + " ; ./build-samtools.sh)"
print(syscall)
subprocess.call([syscall], shell=True)
else :
print("External Samtools will be manually linked. Skipping.")

if (externalNGM is None) :
print("Building NGM.")
syscall = "(cd " + os.path.join(dir, name, "contrib") + " ; ./build-ngm.sh)"
print(syscall)
subprocess.call([syscall], shell=True)
else :
print("External NGM will be manually linked. Skipping.")

print("Building Varscan2.")
syscall = "(cd " + os.path.join(dir, name, "contrib") + " ; ./build-varscan.sh)"
print(syscall)
subprocess.call([syscall], shell=True)


print("Building RNASeqReadSimulator.")
syscall = "(cd " + os.path.join(dir, name, "contrib") + " ; ./build-rnaseqreadsimulator.sh)"
subprocess.call([syscall], shell=True)

class install(_install):

user_options = _install.user_options + [
('externalNGM', None, None),
('externalSamtools', None, None),
('skipRLibraries', None, None)
]


def initialize_options(self):
_install.initialize_options(self)
self.externalNGM = None
self.externalSamtools = None
self.skipRLibraries = None


def finalize_options(self):
_install.finalize_options(self)

def run(self):
global externalNGM, externalSamtools
externalNGM = self.externalNGM
externalSamtools = self.externalSamtools
skipRLibraries = self.skipRLibraries
_install.run(self)
self.execute(_runExternalBuilds, (self.install_lib, externalNGM, externalSamtools, skipRLibraries),msg="Installing external dependencies")
self.execute(_runExternalBuilds, (self.install_lib) ,msg="Installing external dependencies")

setup(
name = name,

Expand Down Expand Up @@ -222,7 +167,4 @@ def run(self):
'splash=slamdunk.splash:run',
],
},
#scripts= ['bin/slamdunk', 'bin/alleyoop', 'bin/slamsim'],

cmdclass={'install': install},
)
Loading

0 comments on commit 385ffda

Please sign in to comment.