From 4386025bdb6bc707626934a521819e8ab31cb9d7 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Mon, 18 Mar 2019 22:38:24 -0400 Subject: [PATCH 01/38] add deploy script --- deploy.py | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 deploy.py diff --git a/deploy.py b/deploy.py new file mode 100644 index 000000000..2f993a4bb --- /dev/null +++ b/deploy.py @@ -0,0 +1,129 @@ +import os +import tempfile +import argparse +import subprocess as sp +import datetime +import json + +HERE = os.path.dirname(__file__) + +usage = """ +This script assists in the deployment of lcdb-wf to working directories. + +The lcdb-wf repository contains infrastructure for testing that is not +typically needed when using it in practice. Furthermore, you might not need all +possible workflows. + +This script copies over only the files requred for each "flavor" of analysis +(rnaseq, chipseq, colocalization, full) and also stores a file, +`.lcdb-wf-deployment.yaml`, containing details about the git commit that was +used and the timestamp. This can be used to compare changes and stay +up-to-date. +""" + +ap = argparse.ArgumentParser(usage=usage) +ap.add_argument('--flavor', default='full', help='''Options are rnaseq, chipseq, colocalization, full. Default is full.''') +ap.add_argument('--dest', help='''Destination directory in which to copy files''') +args = ap.parse_args() +dest = args.dest +flavor = args.flavor + +flavors = { + 'all': { + 'include': [ + 'wrappers/wrappers', + 'include', + 'lib', + 'requirements.txt', + ], + 'exclude': [ + 'wrappers/wrappers/demo', + 'workflows/*/run_test.sh', + + # The following files to exclude are those that are created from + # a test run. + 'lib/__pycache__', + 'lib/postprocess/__pycache__', + 'include/AnnotationHubCache', + 'workflows/*/Snakefile.test', + 'workflows/*/references_data', + 'workflows/*/.snakemake', + 'workflows/*/data', + 'workflows/rnaseq/downstream/rnaseq_cache', + 'workflows/rnaseq/downstream/rnaseq_files', + 'workflows/rnaseq/downstream/final_clusters', + 'workflows/rnaseq/downstream/*.tsv*', + 'workflows/rnaseq/downstream/*log', + 'workflows/rnaseq/downstream/*html', + 'workflows/colocalization/results', + ], + }, + 'chipseq': [ + 'workflows/chipseq', + 'workflows/references', + ], + 'rnaseq': [ + 'workflows/rnaseq', + 'workflows/rnaseq/downstream/', + 'workflows/references', + ], + 'colocalization': [ + 'workflows/colocalization', + ], + + 'full': [ + 'workflows', + ], +} + +paths = set(flavors['all']['include']) +paths = paths | set(flavors[flavor]) + +exclude = tempfile.NamedTemporaryFile(delete=False).name +with open(exclude, 'w') as fout: + fout.write('\n'.join(flavors['all']['exclude'])) + +include = tempfile.NamedTemporaryFile(delete=False).name +with open(include, 'w') as fout: + fout.write('\n'.join(paths) + '\n') + + +sp.check_call([ + 'rsync', + '--relative', + '-ar', + '--files-from={}'.format(include), + '--exclude-from={}'.format(exclude), + HERE, + dest]) + + +commit, message = sp.check_output( + ['git', 'log', '--oneline', '-1'], + universal_newlines=True +).strip().split(' ', 1) +now = datetime.datetime.strftime(datetime.datetime.now(), '%Y%m%d%H%M') +remotes = sp.check_output( + ['git', 'remote', '-v'], + universal_newlines=True +) +remotes = [i.strip() for i in remotes.splitlines()] +branch = sp.check_output([ + 'git', 'branch'], universal_newlines=True) +branch = [i for i in branch.splitlines() if i.startswith('*')] +assert len(branch) == 1 +branch = branch[0] +branch = branch.split('* ')[1] + +d = { + 'git': { + 'commit': commit, + 'message': message, + 'remotes': remotes, + 'branch': branch, + }, + 'timestamp': now} +log = os.path.join(dest, '.lcdb-wf-deployment.json') +with open(log, 'w') as fout: + fout.write(json.dumps(d) + '\n') +os.chmod(log, 0o440) From ead86b0a782bb362520d8889c7313d65a57e952e Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Mon, 18 Mar 2019 22:38:50 -0400 Subject: [PATCH 02/38] update docs about missing lcdblib and new deploy script --- docs/deploy.rst | 34 ++++++++++++++++++++++++++++++++++ docs/getting-started.rst | 19 ++++++++++++------- docs/index.rst | 1 + 3 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 docs/deploy.rst diff --git a/docs/deploy.rst b/docs/deploy.rst new file mode 100644 index 000000000..da8bc9ac9 --- /dev/null +++ b/docs/deploy.rst @@ -0,0 +1,34 @@ +Deploying ``lcdb-wf`` and staying up-to-date +============================================ +The repository comes with lots of infrastructure for testing that is not +necessarily needed in practice when using lcdb-wf for a project. To get +a simplified version: + +.. code-block:: bash + + python deploy.py --flavor rnaseq project-dir + + +The script will use ``rsync`` to copy over files to `project-dir`, excluding +various test files and excluding any files that may have been created in the +process of testing. For "flavor", choose ``chipseq``, ``rnaseq``, +``colocalization``, or ``full`` to get everything. + +This script also writes a file in the destination called +``.lcdb-wf-deployment.json`` which stores details about what commit was used to +deploy and the timestamp. This can come in handy later when comparing +a deployed directory with the main repository to decide whether to update. + +Updating +-------- +The most straightforward approach to updating is to use a diff tool like `meld +`_ to visually compare differences between a deployed +project and a freshly-cloned version of lcdb-wf: + +.. code-block:: bash + + git clone https://github.com/lcdb/lcdb-wf.git comparison-directory + meld project-dir comparison-directory + +This way you can pick and choose which updates are relevant without having to +resort to arcane git commands and difficult merges. diff --git a/docs/getting-started.rst b/docs/getting-started.rst index d7e40d923..b155ac9cc 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -29,10 +29,9 @@ Otherwise, install `Miniconda `_. .. code-block:: bash - conda config --add channels lcdb conda config --add channels defaults - conda config --add channels conda-forge conda config --add channels bioconda + conda config --add channels conda-forge Setup required once per project @@ -77,11 +76,7 @@ use anything. Note that here we specify the channels to use, which include :: - conda create -n lcdb-wf \ - --file requirements.txt \ - --channel bioconda \ - --channel conda-forge \ - --channel lcdb + conda create -n lcdb-wf --file requirements.txt Then activate the environment:: @@ -93,6 +88,16 @@ You might want to hold off on this for now if you'll be running the tests:: source deactivate +.. note:: + + An alternative approach is to create an environment at a specific path, for + example inside a project directory: + + .. code-block:: bash + + conda create -p ./env --file requirements.txt + source activate ./env + Next steps ---------- diff --git a/docs/index.rst b/docs/index.rst index 861b88f3e..f19efd245 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -89,6 +89,7 @@ See :ref:`getting-started` to get started. getting-started tests + deploy workflows config references From 583a39d090bda5ec1ea5bb0b183a1a2fc7e38cb4 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Mon, 18 Mar 2019 22:41:35 -0400 Subject: [PATCH 03/38] update changelog --- docs/changelog.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4059694c7..5e766c623 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,14 @@ Changelog Changes since v1.2 ------------------ +Infrastructure +~~~~~~~~~~~~~~ +- new deploy script to copy over only the files necessary for an analysis, + avoiding the clutter of testing infrastructure. +- lcdblib, an external package, is no longer a dependency. In the interest of + transparency, the relevant code was copied over to the ``lib`` directory in + this repository. + ChIP-seq and RNA-seq ~~~~~~~~~~~~~~~~~~~~ @@ -236,4 +244,4 @@ Both RNA-seq and ChIP-seq v1.0 ---- -First full release. \ No newline at end of file +First full release. From 9c012f595f8799bc689860bd8f8005779767cb13 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 10:44:07 -0400 Subject: [PATCH 04/38] add task to print environment --- .circleci/config.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d1ceee31d..f95c8911f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -217,6 +217,19 @@ jobs: name: Build and upload docs command: ci/build-docs.sh + report-env: + <<: *defaults + steps: + - add_ssh_keys: + fingerprints: + - 99:b4:dd:2c:82:9a:27:07:ca:b4:eb:bf:9c:49:4a:72 + - checkout + - *restore_cache + - *set-path + - run: + name: Report environment + command: conda env export -n lcdb-wf-test + workflows: version: 2 @@ -269,3 +282,15 @@ workflows: - build-docs: requires: - initial-setup + + - report-env: + requires: + - rnaseq + - rnaseq-star + - chipseq + - references + - colocalization + filters: + branches: + ignore: + - master From 0049bfef452489efb7acc35c2ba72d359ba2903a Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 11:08:16 -0400 Subject: [PATCH 05/38] rm lcdb channel; fix channel order --- .circleci/setup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 0e372b7cf..fd13e1b8b 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -27,9 +27,8 @@ if ! type conda > /dev/null; then bash miniconda.sh -b -p $WORKSPACE/miniconda conda config --system --add channels defaults - conda config --system --add channels conda-forge conda config --system --add channels bioconda - conda config --system --add channels lcdb + conda config --system --add channels conda-forge # After SSHing in, for some reason this seems to fix it... conda install -y r-base=3.4.1 bioconductor-genomeinfodbdata bioconductor-annotationhub From d2fb1f4638c45cc5dab5e072c8270283e736c241 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 11:08:51 -0400 Subject: [PATCH 06/38] update reqs to trigger rebuild --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 9f5486176..c6c4b35ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,8 +17,10 @@ cutadapt deeptools >=3.0.1 fastqc fastq-screen + # for fastqc running on circleci font-ttf-dejavu-sans-mono + gat gffutils >=0.8.7.1 ghostscript From 1803388a36dbcf4bf479176f7e28f5e1971a520c Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 11:30:30 -0400 Subject: [PATCH 07/38] disable circleci on this branch --- .circleci/config.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f95c8911f..67e82f1d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -239,6 +239,10 @@ workflows: - pytest: requires: - initial-setup + filters: + branches: + ignore: + - gitlab-runner-config - chipseq: requires: - initial-setup @@ -246,7 +250,7 @@ workflows: filters: branches: ignore: - - master + - gitlab-runner-config - rnaseq: requires: - initial-setup @@ -254,7 +258,7 @@ workflows: filters: branches: ignore: - - master + - gitlab-runner-config - rnaseq-star: requires: - initial-setup @@ -262,7 +266,7 @@ workflows: filters: branches: ignore: - - master + - gitlab-runner-config - references: requires: - initial-setup @@ -270,7 +274,7 @@ workflows: filters: branches: ignore: - - master + - gitlab-runner-config - colocalization: requires: - initial-setup @@ -278,7 +282,7 @@ workflows: filters: branches: ignore: - - master + - gitlab-runner-config - build-docs: requires: - initial-setup @@ -293,4 +297,4 @@ workflows: filters: branches: ignore: - - master + - gitlab-runner-config From 92a2d64257972a17e33a56614296f5cadeccc6e2 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 11:32:23 -0400 Subject: [PATCH 08/38] disable intial setup as well --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67e82f1d6..e09514f46 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -235,7 +235,11 @@ workflows: version: 2 test-suite: jobs: - - initial-setup + - initial-setup: + filters: + branches: + ignore: + - gitlab-runner-config - pytest: requires: - initial-setup From 588745a383b1a0a33994e66ff0762c08694dff3f Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 11:36:06 -0400 Subject: [PATCH 09/38] add test install script --- .circleci/setup.sh | 9 +++------ .gitlab-ci.yml | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.circleci/setup.sh b/.circleci/setup.sh index fd13e1b8b..8bf5b7662 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -2,11 +2,11 @@ set -e WORKSPACE=`pwd` -MINICONDA_VER=4.3.21 +MINICONDA_VER=latest # Set path -echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> $BASH_ENV -source $BASH_ENV +echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc +source ~/.bashrc if ! type conda > /dev/null; then echo "Setting up conda..." @@ -31,11 +31,8 @@ if ! type conda > /dev/null; then conda config --system --add channels conda-forge # After SSHing in, for some reason this seems to fix it... - conda install -y r-base=3.4.1 bioconductor-genomeinfodbdata bioconductor-annotationhub conda update -y conda conda create -n lcdb-wf-test -y --file requirements.txt - conda remove -y r-base - yum install -y git fi diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..629636705 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,2 @@ +job: + script: "bash .circleci/setup.sh" From e185d2c33df6280f488b2069d0ca5d5e6250c858 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:34:24 -0400 Subject: [PATCH 10/38] try caching --- .gitlab-ci.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 629636705..815bd14c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,2 +1,22 @@ -job: + +initialize-conda: script: "bash .circleci/setup.sh" + image: "debian:latest" + cache: + key: "$(md5sum requirements.txt | cut -f1 -d ' ')" + paths: + - "miniconda" + policy: "push" + +run-chipseq: + script: + - source activate lcdb-wf-test + - python ci/get-data.py + - cd workflows/chipseq + - ./run_test.sh -n + cache: + key: "$(md5sum requirements.txt | cut -f1 -d ' ')" + paths: + - "miniconda" + policy: "pull" + From 9cf95ee6eca903e3a32941a2912fb132bd92a057 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:37:36 -0400 Subject: [PATCH 11/38] install curl --- .circleci/setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 8bf5b7662..ded00941a 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -4,6 +4,8 @@ set -e WORKSPACE=`pwd` MINICONDA_VER=latest +sudo apt-get install curl + # Set path echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc source ~/.bashrc From 2ab5f2b85b3a02ea738c6846949f0555a06bd7e9 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:38:45 -0400 Subject: [PATCH 12/38] use steps --- .gitlab-ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 815bd14c8..7c3f9b58b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,11 @@ +steps: + - init + - workflows initialize-conda: - script: "bash .circleci/setup.sh" + step: "init" image: "debian:latest" + script: "bash .circleci/setup.sh" cache: key: "$(md5sum requirements.txt | cut -f1 -d ' ')" paths: @@ -9,6 +13,8 @@ initialize-conda: policy: "push" run-chipseq: + step: "workflows" + image: "debian:latest" script: - source activate lcdb-wf-test - python ci/get-data.py From 0ba5f86c54a10187349fe16975aebc5d2b7ddee4 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:40:11 -0400 Subject: [PATCH 13/38] s/step/stage --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c3f9b58b..f9d6ab1e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,9 @@ -steps: +stages: - init - workflows initialize-conda: - step: "init" + stage: "init" image: "debian:latest" script: "bash .circleci/setup.sh" cache: @@ -13,7 +13,7 @@ initialize-conda: policy: "push" run-chipseq: - step: "workflows" + stage: "workflows" image: "debian:latest" script: - source activate lcdb-wf-test From f31228e179bb44e71272af619334165bd98d9cf4 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:41:22 -0400 Subject: [PATCH 14/38] no sudo --- .circleci/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index ded00941a..9124b40fb 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -4,7 +4,7 @@ set -e WORKSPACE=`pwd` MINICONDA_VER=latest -sudo apt-get install curl +apt-get install curl # Set path echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc From defa967c2008b12741f2f1ce304f69a68f8b08d6 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:50:12 -0400 Subject: [PATCH 15/38] install curl --- .circleci/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 9124b40fb..dd6ef0126 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -4,7 +4,8 @@ set -e WORKSPACE=`pwd` MINICONDA_VER=latest -apt-get install curl +apt-get upate +apt-get install -y curl # Set path echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc From 720ae8355d5c848fe3e7abe793bc37436d679b3b Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:51:09 -0400 Subject: [PATCH 16/38] install curl --- .circleci/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index dd6ef0126..4efb0aa51 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -4,7 +4,7 @@ set -e WORKSPACE=`pwd` MINICONDA_VER=latest -apt-get upate +apt-get update apt-get install -y curl # Set path From bc5f90d232be7dd824096e83661e028c141305f9 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:55:58 -0400 Subject: [PATCH 17/38] s/debian/ubuntu/ --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9d6ab1e3..96df418ec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: initialize-conda: stage: "init" - image: "debian:latest" + image: "ubuntu:latest" script: "bash .circleci/setup.sh" cache: key: "$(md5sum requirements.txt | cut -f1 -d ' ')" @@ -14,7 +14,7 @@ initialize-conda: run-chipseq: stage: "workflows" - image: "debian:latest" + image: "ubuntu:latest" script: - source activate lcdb-wf-test - python ci/get-data.py From d796dd278606ca6c32570313e61372ffee292c69 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 13:59:46 -0400 Subject: [PATCH 18/38] always install --- .circleci/setup.sh | 48 +++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 4efb0aa51..5cac5e7c3 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -11,31 +11,27 @@ apt-get install -y curl echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc source ~/.bashrc -if ! type conda > /dev/null; then - echo "Setting up conda..." - - # setup conda if not loaded from cache - mkdir -p $WORKSPACE - - # step 1: download and install miniconda - if [[ $OSTYPE == darwin* ]]; then - tag="MacOSX" - elif [[ $OSTYPE == linux* ]]; then - tag="Linux" - else - echo "Unsupported OS: $OSTYPE" - exit 1 - fi - curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh - bash miniconda.sh -b -p $WORKSPACE/miniconda - - conda config --system --add channels defaults - conda config --system --add channels bioconda - conda config --system --add channels conda-forge - - # After SSHing in, for some reason this seems to fix it... - conda update -y conda - conda create -n lcdb-wf-test -y --file requirements.txt - +echo "Setting up conda..." + +# setup conda if not loaded from cache +mkdir -p $WORKSPACE + +# step 1: download and install miniconda +if [[ $OSTYPE == darwin* ]]; then + tag="MacOSX" +elif [[ $OSTYPE == linux* ]]; then + tag="Linux" +else + echo "Unsupported OS: $OSTYPE" + exit 1 fi +curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh +bash miniconda.sh -b -p $WORKSPACE/miniconda + +conda config --system --add channels defaults +conda config --system --add channels bioconda +conda config --system --add channels conda-forge +# After SSHing in, for some reason this seems to fix it... +conda update -y conda +conda create -n lcdb-wf-test -y --file requirements.txt From 115f3a8ec47489b38c933448d1f816075a77b163 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 14:38:00 -0400 Subject: [PATCH 19/38] simplify setup --- .circleci/setup.sh | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 5cac5e7c3..76996e6ca 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -3,31 +3,19 @@ set -e WORKSPACE=`pwd` MINICONDA_VER=latest +tag="Linux" apt-get update apt-get install -y curl # Set path -echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc -source ~/.bashrc - -echo "Setting up conda..." - -# setup conda if not loaded from cache -mkdir -p $WORKSPACE - -# step 1: download and install miniconda -if [[ $OSTYPE == darwin* ]]; then - tag="MacOSX" -elif [[ $OSTYPE == linux* ]]; then - tag="Linux" -else - echo "Unsupported OS: $OSTYPE" - exit 1 -fi curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh bash miniconda.sh -b -p $WORKSPACE/miniconda +echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc +source ~/.bashrc +echo $PATH + conda config --system --add channels defaults conda config --system --add channels bioconda conda config --system --add channels conda-forge From 0adbe0a57c03f99e72136be98342ee64b4a94865 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 14:43:35 -0400 Subject: [PATCH 20/38] avoid using ~ --- .circleci/setup.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 76996e6ca..534652634 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -12,9 +12,11 @@ apt-get install -y curl curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh bash miniconda.sh -b -p $WORKSPACE/miniconda -echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> ~/.bashrc -source ~/.bashrc +set -x +echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> $WORKSPACE/.bashrc +source $WORKSPACE/.bashrc echo $PATH +set +x conda config --system --add channels defaults conda config --system --add channels bioconda From 0398ac326134757dd1e5ffe9b6c61e092497b344 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Tue, 19 Mar 2019 16:52:29 -0400 Subject: [PATCH 21/38] global path --- .circleci/setup.sh | 9 ++------- .gitlab-ci.yml | 3 +++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 534652634..466595bcb 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -1,7 +1,6 @@ #!/bin/bash set -e -WORKSPACE=`pwd` MINICONDA_VER=latest tag="Linux" @@ -10,13 +9,9 @@ apt-get install -y curl # Set path curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh -bash miniconda.sh -b -p $WORKSPACE/miniconda +bash miniconda.sh -b -p /miniconda -set -x -echo "export PATH=$WORKSPACE/miniconda/bin:$PATH" >> $WORKSPACE/.bashrc -source $WORKSPACE/.bashrc -echo $PATH -set +x +export PATH=/miniconda/bin:$PATH conda config --system --add channels defaults conda config --system --add channels bioconda diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 96df418ec..8947c1968 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,9 @@ stages: - init - workflows +before_script: + - export PATH="/miniconda/bin:$PATH" + initialize-conda: stage: "init" image: "ubuntu:latest" From b29f5b29978e3bf0847af00f695270679d85a9c0 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Wed, 20 Mar 2019 16:07:31 -0400 Subject: [PATCH 22/38] show path --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8947c1968..fbf8a3bf3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ run-chipseq: stage: "workflows" image: "ubuntu:latest" script: + - echo $PATH - source activate lcdb-wf-test - python ci/get-data.py - cd workflows/chipseq From 018be90d1d6d27109ca249ce21c491eaa9f91101 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Wed, 20 Mar 2019 16:07:47 -0400 Subject: [PATCH 23/38] which conda --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fbf8a3bf3..efbee93df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ run-chipseq: image: "ubuntu:latest" script: - echo $PATH + - which conda - source activate lcdb-wf-test - python ci/get-data.py - cd workflows/chipseq From a202263ea1a277e48bac767c2e0ae6b0b76ea5bd Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Fri, 22 Mar 2019 09:06:30 -0400 Subject: [PATCH 24/38] change cache location --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index efbee93df..e94031e5e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ initialize-conda: cache: key: "$(md5sum requirements.txt | cut -f1 -d ' ')" paths: - - "miniconda" + - "/miniconda" policy: "push" run-chipseq: From 9b7214c7aeb601e911582b1f1d370093ab9bdf1e Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Fri, 22 Mar 2019 09:32:02 -0400 Subject: [PATCH 25/38] cache key --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e94031e5e..6529305bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ initialize-conda: image: "ubuntu:latest" script: "bash .circleci/setup.sh" cache: - key: "$(md5sum requirements.txt | cut -f1 -d ' ')" + key: "v1" paths: - "/miniconda" policy: "push" @@ -26,7 +26,7 @@ run-chipseq: - cd workflows/chipseq - ./run_test.sh -n cache: - key: "$(md5sum requirements.txt | cut -f1 -d ' ')" + key: "v1" paths: - "miniconda" policy: "pull" From d48a58daec55caaa2fcdedd6a25f157f4c8edf83 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Fri, 22 Mar 2019 09:52:15 -0400 Subject: [PATCH 26/38] fix cache --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6529305bf..8cda9a802 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ run-chipseq: image: "ubuntu:latest" script: - echo $PATH + - ls /miniconda/bin - which conda - source activate lcdb-wf-test - python ci/get-data.py @@ -28,6 +29,6 @@ run-chipseq: cache: key: "v1" paths: - - "miniconda" + - "/miniconda" policy: "pull" From ce9c235690776a0ac135642540e3a21476150902 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Fri, 22 Mar 2019 11:36:25 -0400 Subject: [PATCH 27/38] add trailing "/" to cache dir --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cda9a802..186be7d66 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ initialize-conda: cache: key: "v1" paths: - - "/miniconda" + - "/miniconda/" policy: "push" run-chipseq: @@ -29,6 +29,6 @@ run-chipseq: cache: key: "v1" paths: - - "/miniconda" + - "/miniconda/" policy: "pull" From dada0dd73b08a66d648f40800f3f4055b6c76b34 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sat, 13 Apr 2019 22:35:06 +0000 Subject: [PATCH 28/38] try different cache dir --- .circleci/setup.sh | 4 ++-- .gitlab-ci.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 466595bcb..ce6f8924d 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -9,9 +9,9 @@ apt-get install -y curl # Set path curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh -bash miniconda.sh -b -p /miniconda +bash miniconda.sh -b -p $CI_PROJECT_DIR/miniconda -export PATH=/miniconda/bin:$PATH +export PATH=$CI_PROJECT_DIR/miniconda/bin:$PATH conda config --system --add channels defaults conda config --system --add channels bioconda diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 186be7d66..d47666959 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - workflows before_script: - - export PATH="/miniconda/bin:$PATH" + - export PATH="$CI_PROJECT_DIR/miniconda/bin:$PATH" initialize-conda: stage: "init" @@ -12,7 +12,7 @@ initialize-conda: cache: key: "v1" paths: - - "/miniconda/" + - "miniconda/" policy: "push" run-chipseq: @@ -29,6 +29,6 @@ run-chipseq: cache: key: "v1" paths: - - "/miniconda/" + - "miniconda/" policy: "pull" From 913e1b13f3fdd0ef08d1ba681670fc4e307472c9 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sun, 14 Apr 2019 19:17:16 +0000 Subject: [PATCH 29/38] be clear about path --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d47666959..608736222 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ initialize-conda: cache: key: "v1" paths: - - "miniconda/" + - "$CI_PROJECT_DIR/miniconda/" policy: "push" run-chipseq: @@ -20,7 +20,6 @@ run-chipseq: image: "ubuntu:latest" script: - echo $PATH - - ls /miniconda/bin - which conda - source activate lcdb-wf-test - python ci/get-data.py @@ -29,6 +28,6 @@ run-chipseq: cache: key: "v1" paths: - - "miniconda/" + - "$CI_PROJECT_DIR/miniconda/" policy: "pull" From 8315bb33affca005fe50f827ea6fec2a50011398 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sun, 14 Apr 2019 19:43:36 +0000 Subject: [PATCH 30/38] change cache policy --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 608736222..7bafe13d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,6 @@ initialize-conda: key: "v1" paths: - "$CI_PROJECT_DIR/miniconda/" - policy: "push" run-chipseq: stage: "workflows" From 226826d9626680a254d4e84664fbaeadbca2f7ac Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sun, 14 Apr 2019 20:31:57 +0000 Subject: [PATCH 31/38] do not install if miniconda exists --- .circleci/setup.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index ce6f8924d..944a1954a 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -6,10 +6,10 @@ tag="Linux" apt-get update apt-get install -y curl - -# Set path -curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh -bash miniconda.sh -b -p $CI_PROJECT_DIR/miniconda +if ! [ -x "$(command -v conda)" ]; then + curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh + bash miniconda.sh -b -p $CI_PROJECT_DIR/miniconda +fi export PATH=$CI_PROJECT_DIR/miniconda/bin:$PATH @@ -17,6 +17,5 @@ conda config --system --add channels defaults conda config --system --add channels bioconda conda config --system --add channels conda-forge -# After SSHing in, for some reason this seems to fix it... conda update -y conda conda create -n lcdb-wf-test -y --file requirements.txt From f80cf9caf08f9c7d1d75af342f12454be2e6bcac Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sun, 14 Apr 2019 20:38:35 +0000 Subject: [PATCH 32/38] only do updates if not using cache --- .circleci/setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 944a1954a..37b2d0b4c 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -4,11 +4,12 @@ set -e MINICONDA_VER=latest tag="Linux" -apt-get update -apt-get install -y curl if ! [ -x "$(command -v conda)" ]; then + apt-get update + apt-get install -y curl curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh bash miniconda.sh -b -p $CI_PROJECT_DIR/miniconda + conda update -y conda fi export PATH=$CI_PROJECT_DIR/miniconda/bin:$PATH @@ -17,5 +18,4 @@ conda config --system --add channels defaults conda config --system --add channels bioconda conda config --system --add channels conda-forge -conda update -y conda conda create -n lcdb-wf-test -y --file requirements.txt From 431017b4aa0c5934a5a41785f82d9d36823e7137 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sun, 14 Apr 2019 20:47:28 +0000 Subject: [PATCH 33/38] only install if not cached --- .circleci/setup.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/setup.sh b/.circleci/setup.sh index 37b2d0b4c..aba20c175 100755 --- a/.circleci/setup.sh +++ b/.circleci/setup.sh @@ -10,12 +10,13 @@ if ! [ -x "$(command -v conda)" ]; then curl -L -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VER-$tag-x86_64.sh bash miniconda.sh -b -p $CI_PROJECT_DIR/miniconda conda update -y conda -fi + export PATH=$CI_PROJECT_DIR/miniconda/bin:$PATH + -export PATH=$CI_PROJECT_DIR/miniconda/bin:$PATH + conda create -n lcdb-wf-test -y --file requirements.txt +fi conda config --system --add channels defaults conda config --system --add channels bioconda conda config --system --add channels conda-forge -conda create -n lcdb-wf-test -y --file requirements.txt From f26e90753ad91dff81e80a176f87e1820df7d079 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Mon, 15 Apr 2019 19:31:34 +0000 Subject: [PATCH 34/38] minor --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7bafe13d1..c23d731c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,4 +29,3 @@ run-chipseq: paths: - "$CI_PROJECT_DIR/miniconda/" policy: "pull" - From 80122fde252af782ac71b8f8d9000f8256f89eee Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Mon, 15 Apr 2019 20:07:59 +0000 Subject: [PATCH 35/38] export env.yaml as artifact --- .gitlab-ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c23d731c7..e343b30ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,22 +8,26 @@ before_script: initialize-conda: stage: "init" image: "ubuntu:latest" - script: "bash .circleci/setup.sh" + script: + - "bash .circleci/setup.sh" + - "conda env export -n lcdb-wf > env.yaml" cache: key: "v1" paths: - "$CI_PROJECT_DIR/miniconda/" + artifact: + paths: + - '$CI_PROJECT_DIR/env.yaml' + run-chipseq: stage: "workflows" image: "ubuntu:latest" script: - - echo $PATH - - which conda - source activate lcdb-wf-test - python ci/get-data.py - cd workflows/chipseq - - ./run_test.sh -n + - ./run_test.sh --use-conda -j8 -k -p -r cache: key: "v1" paths: From 1eaaa6eceb1a297774fb605cf39d81d8d94fc92e Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Mon, 15 Apr 2019 20:11:29 +0000 Subject: [PATCH 36/38] export env.yaml as artifact --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e343b30ee..f3059415a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ initialize-conda: key: "v1" paths: - "$CI_PROJECT_DIR/miniconda/" - artifact: + artifacts: paths: - '$CI_PROJECT_DIR/env.yaml' From 45dfc67811c18e9935e79e5acb065e179b3a1f8d Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sat, 20 Apr 2019 20:30:31 +0000 Subject: [PATCH 37/38] support chipseq paired end --- lib/patterns_targets.py | 1 + workflows/chipseq/config/chipseq_patterns.yaml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/patterns_targets.py b/lib/patterns_targets.py index 643d8316a..0b837932f 100644 --- a/lib/patterns_targets.py +++ b/lib/patterns_targets.py @@ -161,6 +161,7 @@ def __init__(self, config, patterns, workdir=None): # First, the samples... self.patterns_by_sample = self.patterns['patterns_by_sample'] self.fill_by_sample = dict( + n=[1,2], sample=self.samples.values, label=self.sampletable.label.values, ip_label=self.sampletable.label[ diff --git a/workflows/chipseq/config/chipseq_patterns.yaml b/workflows/chipseq/config/chipseq_patterns.yaml index 94130b546..1e7a4fd63 100644 --- a/workflows/chipseq/config/chipseq_patterns.yaml +++ b/workflows/chipseq/config/chipseq_patterns.yaml @@ -1,7 +1,7 @@ patterns_by_sample: - fastq: 'data/chipseq_samples/{sample}/{sample}_R1.fastq.gz' - cutadapt: 'data/chipseq_samples/{sample}/{sample}_R1.cutadapt.fastq.gz' + fastq: 'data/chipseq_samples/{sample}/{sample}_R{n}.fastq.gz' + cutadapt: 'data/chipseq_samples/{sample}/{sample}_R{n}.cutadapt.fastq.gz' bam: 'data/chipseq_samples/{sample}/{sample}.cutadapt.bam' fastqc: From 82f84ace6b2e94c4bdf4f94784f035be98db7bd0 Mon Sep 17 00:00:00 2001 From: Ryan Dale Date: Sat, 20 Apr 2019 20:40:09 +0000 Subject: [PATCH 38/38] export correct env --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3059415a..ef2b1ab77 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ initialize-conda: image: "ubuntu:latest" script: - "bash .circleci/setup.sh" - - "conda env export -n lcdb-wf > env.yaml" + - "conda env export -n lcdb-wf-test > env.yaml" cache: key: "v1" paths: