diff --git a/install.sh b/install.sh index 1b06765e..82c83e3d 100755 --- a/install.sh +++ b/install.sh @@ -7,6 +7,7 @@ set -e PYTHON_VERSION='3.6.0' PYTHON_INTERPRETER='python3.6' ROOT=$(readlink -f $(dirname ${BASH_SOURCE})) +mkdir -p ${ROOT}/tmpdata export TMPDIR=${ROOT}/tmpdata # Write temporary files to tmpdata export CPIPE_ROOT=$ROOT TEMP_SUBDIR=`mktemp -d` diff --git a/tasks/common.py b/tasks/common.py index cf2f9b81..d37b2b07 100644 --- a/tasks/common.py +++ b/tasks/common.py @@ -163,7 +163,7 @@ def unzip_todir(input, directory, type): tar = tarfile.open(fileobj=input, mode='r:bz2') tar.extractall(tempdir) else: - raise ValueError('Can only download .tar.gz, .tar.bz2, or .zip file') + raise ValueError('Type: {0} given. Can only download .tar.gz, .tar.bz2, or .zip file'.format(type)) # If there is only one subdirectory, take the files inside that files = [os.path.join(tempdir, f) for f in os.listdir(tempdir)] @@ -207,7 +207,7 @@ def download_zip(url_str, directory, type=None): input = BytesIO(url.read()) # Try to deduce the type from the URL - if not type: + if type is None: [name, ext2] = os.path.splitext(url_str) [name, ext1] = os.path.splitext(name) @@ -217,6 +217,9 @@ def download_zip(url_str, directory, type=None): type = 'tgz' elif (ext1 == '.tar' and ext2 == '.bz2') or ext2 == '.tbz2': type = 'tbz2' + else: + raise ValueError ("Unknow filetype: ext1: {}, ext2: {}\nurl_str: {}".format(ext1, ext2, + url_str)) unzip_todir(input, directory, type) diff --git a/tasks/download/download_reference_files.py b/tasks/download/download_reference_files.py index 2e3a175f..8c7f0fac 100644 --- a/tasks/download/download_reference_files.py +++ b/tasks/download/download_reference_files.py @@ -130,7 +130,15 @@ def task_download_ucsc(): ["ucsc.hg19.dict.gz", "ucsc.hg19.fasta.gz", "ucsc.hg19.fasta.fai.gz"], UCSC_ROOT, 'bundle/hg19/' - ) + ), + cmd(''' + mkdir -p ucsc\ + && pushd {data_dir}/ucsc\ + && gunzip -c ucsc.hg19.dict.gz >ucsc.hg19.dict\ + && gunzip -c ucsc.hg19.fasta.fai.gz >ucsc.hg19.fasta.fai\ + && gunzip -c ucsc.hg19.fasta.gz >ucsc.hg19.fasta + '''.format(data_dir=DATA_ROOT), cwd=DATA_ROOT, executable='bash') + ], 'uptodate': [run_once], } @@ -311,7 +319,7 @@ def task_bwa_index_ucsc_reference(): return { 'targets': [UCSC_BWA_INDEX], 'actions': [ - '{tools}/bwa/bwa index -a bwtsw {data}/ucsc/ucsc.hg19.fasta'.format(tools=TOOLS_ROOT, data=DATA_ROOT) + '{tools}/bin/bwa index -a bwtsw {data}/ucsc/ucsc.hg19.fasta'.format(tools=TOOLS_ROOT, data=DATA_ROOT) ], 'task_dep': [ 'install_bwa', diff --git a/tasks/download/download_tools.py b/tasks/download/download_tools.py index 7deff6ec..9f2cb6cb 100644 --- a/tasks/download/download_tools.py +++ b/tasks/download/download_tools.py @@ -67,6 +67,9 @@ def action(): curl -L https://cpanmin.us/ -o cpanm chmod +x cpanm ''', cwd=temp_dir) + return { + 'dir': temp_dir + } return { 'actions': [action], @@ -99,7 +102,7 @@ def task_download_bwa(): if swift_install(): return nectar_download('bwa') else: - return download_task("https://codeload.github.com/lh3/bwa/tar.gz/v{0}".format(BWA_VERSION)) + return download_task("https://codeload.github.com/lh3/bwa/tar.gz/v{0}".format(BWA_VERSION), type='tgz') def task_download_htslib(): @@ -130,7 +133,7 @@ def task_download_bedtools(): if swift_install(): return nectar_download('bedtools') else: - return download_task("https://codeload.github.com/arq5x/bedtools2/tar.gz/v{0}".format(BEDTOOLS_VERSION)) + return download_task("https://codeload.github.com/arq5x/bedtools2/tar.gz/v{0}".format(BEDTOOLS_VERSION), type='tgz') def task_download_vep(): if swift_install(): @@ -331,7 +334,7 @@ def task_download_zlib(): return nectar_download('zlib') else: return download_task( - 'https://codeload.github.com/madler/zlib/tar.gz/v{}'.format(ZLIB_VERSION)) + 'https://codeload.github.com/madler/zlib/tar.gz/v{}'.format(ZLIB_VERSION), type='tgz') def task_download_vcfanno(): if has_swift_auth():