From edff11c790c75568704175a4f80b3d86e27b0e60 Mon Sep 17 00:00:00 2001
From: Alex Kanitz <alexander.kanitz@alumni.ethz.ch>
Date: Sun, 10 Jul 2022 13:52:26 +0200
Subject: [PATCH] build: add Conda environment specification

---
 .gitignore      | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
 README.md       | 23 ++++++++++++++-----
 environment.yml |  6 +++++
 tests/test.sh   |  2 +-
 4 files changed, 85 insertions(+), 7 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 environment.yml

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..de149a8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,61 @@
+# Created by https://www.toptal.com/developers/gitignore/api/r
+# Edit at https://www.toptal.com/developers/gitignore?templates=r
+
+### R ###
+# History files
+.Rhistory
+.Rapp.history
+
+# Session Data files
+.RData
+.RDataTmp
+
+# User-specific files
+.Ruserdata
+
+# Example code in package build process
+*-Ex.R
+
+# Output files from R CMD build
+/*.tar.gz
+
+# Output files from R CMD check
+/*.Rcheck/
+
+# RStudio files
+.Rproj.user/
+
+# produced vignettes
+vignettes/*.html
+vignettes/*.pdf
+
+# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
+.httr-oauth
+
+# knitr and R markdown default cache directories
+*_cache/
+/cache/
+
+# Temporary files created by R markdown
+*.utf8.md
+*.knit.md
+
+# R Environment Variables
+.Renviron
+
+# pkgdown site
+docs/
+
+# translation temp files
+po/*~
+
+# RStudio Connect folder
+rsconnect/
+
+### R.Bookdown Stack ###
+# R package: bookdown caching files
+/*_files/
+
+# End of https://www.toptal.com/developers/gitignore/api/r
+tests/test_files/test.fa.gz.fai
+tests/test_files/test.fa.gz.gzi
diff --git a/README.md b/README.md
index a0fd5bc..7c75a71 100644
--- a/README.md
+++ b/README.md
@@ -13,16 +13,26 @@ ascii_alignment_pileup.R [-hv] [OPTIONS] bed bam [bam2 ...]
 
 ## Requirements
 
-* `R` 3.6.0 / 4.2.1
+* `R` 3.6.0 / 4.1.3 / 4.2.1
 * `optparse` 1.6.2 / 1.7.1
-* `rtracklayer` 1.44.0 / 1.56.1
+* `rtracklayer` 1.44.0 / 1.54.0 / 1.56.1
 
 The script was successfully tested with the indicated versions. Other versions
 may work as well, but have not been tested.
 
-For convenience, you can build a container with all required software from the
-provided `Dockerfile` with `docker build .`. Alternatively, you can also pull a
-prebuilt Docker image from
+## Installation
+
+The easiest way to install the script is via [Conda][conda]. If you have Conda
+installed, all you need to do is:
+
+```
+conda env create -f environment.yml
+conda activate ascii-alignment-pileup
+```
+
+Alternatively, you can build a container with all required software from the
+provided `Dockerfile` with `docker build .`. You can also pull a prebuilt
+Docker image from
 <https://hub.docker.com/repository/docker/zavolab/ascii-alignment-pileup>.
 
 ## Input files
@@ -204,6 +214,7 @@ Email: <zavolab-biozentrum@unibas.ch>
 [bed]: <https://www.ensembl.org/info/website/upload/bed.html>
 [bgzip]: <http://www.htslib.org/doc/bgzip.html>
 [biocontainers]: <https://biocontainers.pro/>
+[conda]: <https://docs.conda.io/en/latest/>
 [fasta]: <https://en.wikipedia.org/wiki/FASTA_format>
 [gff]: <https://en.wikipedia.org/wiki/General_feature_format>
-[htslib]: <https://github.com/samtools/htslib>
\ No newline at end of file
+[htslib]: <https://github.com/samtools/htslib>
diff --git a/environment.yml b/environment.yml
new file mode 100644
index 0000000..3452990
--- /dev/null
+++ b/environment.yml
@@ -0,0 +1,6 @@
+name: ascii-alignment-pileup
+channels:
+  - bioconda
+dependencies:
+  - r-optparse=1.7.1
+  - bioconductor-rtracklayer=1.54.0
diff --git a/tests/test.sh b/tests/test.sh
index 0ccc009..76a5864 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -17,7 +17,7 @@ user_dir=$PWD
 script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
 cd $script_dir
 
-ascii_alignment_pileup.R \
+../ascii_alignment_pileup.R \
   --verbose \
   --reference="test_files/test.fa.gz" \
   --annotations="test_files/test.gff" \
-- 
GitLab