Skip to content

Commit 3bdadab

Browse files
version 20240828 resulting from development over IBIS2024 (#576)
* added version 20240828 resulting from development over IBISI2024 * fix branch tag
1 parent 60ba043 commit 3bdadab

File tree

1 file changed

+292
-0
lines changed

1 file changed

+292
-0
lines changed

rsat/20240828/Dockerfile

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
## <---- Create a clone of Ubuntu image
2+
FROM ubuntu:focal
3+
4+
## <----- METADATA
5+
LABEL base_image="ubuntu:focal"
6+
LABEL version="1"
7+
LABEL about.summary="Tools to analyse cis elements in genomes: motif discovery, TF factor binding analysis, comparative genomics, regulatory variations"
8+
LABEL software="rsat"
9+
LABEL software.version="20240828"
10+
LABEL about.tags="implemented-in::perl,R,python,C"
11+
LABEL about.home="http://rsat.eu"
12+
LABEL extra.identifiers.biotools="rsat"
13+
LABEL about.software="https://github.com/rsa-tools/rsat-code"
14+
LABEL about.documentation="https://github.com/rsa-tools"
15+
LABEL about.license="AGPL-3.0-only"
16+
LABEL about.license_file="see also licenses at $RSAT/public_html/motif_databasess"
17+
LABEL maintainer="[email protected]"
18+
19+
## <----- maintainers
20+
MAINTAINER "[email protected]"
21+
22+
## <---- Prevent to open interactive dialogs during the installation process
23+
ENV DEBIAN_FRONTEND=noninteractive
24+
25+
## <---- Set the language environment in the docker container: should be included before installing any other package
26+
RUN apt-get update \
27+
&& apt-get install -y locales \
28+
&& locale-gen en_US.UTF-8 \
29+
&& update-locale LANG=en_US.UTF-8 \
30+
&& apt-get autoremove
31+
32+
ENV LANG en_US.UTF-8
33+
ENV LANGUAGE en_US.UTF-8
34+
ENV LC_ALL en_US.UTF-8
35+
36+
## <---- Install required packages, including git
37+
RUN apt-get install -y --no-install-recommends \
38+
apt-transport-https \
39+
git \
40+
wget \
41+
less \
42+
vim-tiny \
43+
vim \
44+
time \
45+
lsb-release \
46+
# gnupg2 needed for gpg command and FOR R key installation
47+
gnupg2 \
48+
dirmngr \
49+
ca-certificates\
50+
software-properties-common \
51+
# optimize the space in your docker
52+
&& rm -rf /var/lib/apt/lists/*
53+
54+
55+
## <---- Add the CRAN repository to your system sources list, 4.0 for focal
56+
RUN echo "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" > /etc/apt/sources.list.d/cran.list
57+
RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
58+
&& gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9| apt-key add -
59+
60+
61+
## <---- Now install R and littler, and create a link for littler in /usr/local/bin
62+
## <---- Also set a default CRAN repo, and make sure littler knows about it too
63+
RUN apt-get update \
64+
&& apt-get install -y --no-install-recommends \
65+
littler \
66+
r-cran-littler \
67+
r-base \
68+
r-base-dev \
69+
r-recommended \
70+
&& echo 'options(repos = c(CRAN = "https://cloud.r-project.org/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
71+
&& echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
72+
&& ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
73+
&& ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
74+
&& ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
75+
&& ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
76+
&& install.r docopt \
77+
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
78+
&& rm -rf /var/lib/apt/lists/*
79+
80+
81+
## <---- Now we will install RSAT from the GitHub repository; requires git see,
82+
# https://rsa-tools.github.io/installing-RSAT/unix-install-rsat/installing_RSAT_procedure.html#5_Configuring_RSAT
83+
84+
RUN apt-get update \
85+
&& apt-get install -y --no-install-recommends \
86+
git \
87+
git-lfs \
88+
&& rm -rf /var/lib/apt/lists/*
89+
90+
91+
## <---- Create INSTALL_ROOT directory and set as working directory:
92+
ENV INSTALL_ROOT=/packages
93+
RUN echo $INSTALL_ROOT \
94+
&& mkdir -p ${INSTALL_ROOT}/
95+
WORKDIR /packages
96+
97+
98+
## <---- Actually clone RSAT repository into your working dir and rename to rsat
99+
RUN git clone https://github.com/rsa-tools/rsat-code.git --branch 2024-08-28c --single-branch
100+
RUN mv rsat-code rsat
101+
102+
# Repositories 'demo_files' and 'sample_ouput' are skipped to save space
103+
# git clone https://github.com/rsa-tools/demo_files.git
104+
# git clone https://github.com/rsa-tools/sample_outputs.git
105+
106+
## <---- Download licensed motif_databases, move to /packages/motif_databases and symb link
107+
RUN wget --no-parent -r --reject "index.html*" https://rsat.eead.csic.es/plants/motif_databases/ \
108+
&& mv /packages/rsat.eead.csic.es/plants/motif_databases/ /packages \
109+
&& rm -rf /packages/rsat.eead.csic.es
110+
RUN cd rsat/public_html/ \
111+
&& ln -s ../../motif_databases/
112+
113+
114+
## <---- Remove bulky motif_databases
115+
RUN rm -rf /packages/motif_databases/cisBP2
116+
RUN grep -v cisBP2 /packages/motif_databases/db_matrix_files.tab > /packages/motif_databases/db_matrix_files.filt.tab
117+
RUN mv /packages/motif_databases/db_matrix_files.filt.tab /packages/motif_databases/db_matrix_files.tab
118+
119+
120+
## <---- Declare the environment path and set the new working directory
121+
ENV RSAT /packages/rsat
122+
RUN echo $RSAT
123+
WORKDIR $RSAT
124+
125+
## <---- define your IP, this step is needed to have access to web interface
126+
ENV MY_IP "localhost"
127+
RUN echo "MY_IP ${MY_IP}"
128+
129+
## <----Choose your RSAT site name
130+
ENV RSAT_SITE=my_rsat
131+
132+
## <---- Configure RSAT to be used internally and in web server, this step is needed to generate the RSAT_config.bashrc
133+
RUN perl perl-scripts/configure_rsat.pl -auto rsat=${RSAT} rsat_site=${RSAT_SITE} rsat_www=http://${MY_IP}/rsat/ \
134+
rsat_ws=http://${MY_IP}/rsat/ package_manager="apt-get" ucsc_tools=1 ensembl_tools=1
135+
136+
137+
138+
## <---- Read config and run bash installation scripts: requires sudo and apt-utils
139+
RUN apt-get update \
140+
&& apt-get install -y --no-install-recommends \
141+
sudo \
142+
apt-utils
143+
144+
######################################################## Notes ########################################################
145+
# To run the bash installation scripts, we need sudo access
146+
# To run source RSAT_config.bashrc we need a bash shell; however, the default shell for RUN instructions is ["/bin/sh", "-c"].
147+
# Using SHELL instruction SHELL ["/bin/bash", "-c"], we can change default shell for subsequent RUN instructions in Dockerfile
148+
# then RUN "source file" # now translates to: RUN /bin/bash -c "source file"
149+
150+
151+
## <---- switch to bash
152+
SHELL ["/bin/bash", "-c"]
153+
154+
155+
## <---- make sure you are in your working dir
156+
RUN cd ${RSAT}
157+
WORKDIR ${RSAT}
158+
159+
160+
## <---- Read config and run bash installation scripts
161+
RUN source /packages/rsat/RSAT_config.bashrc \
162+
&& bash installer/01_ubuntu_packages.bash \
163+
&& bash installer/02_python_packages.bash
164+
165+
######################################################## Notes ########################################################
166+
# When installinng python dependencies you might error with rpy2-3.5.12.tar.gz or PySimpleSOAP-1.16.2.tar.gz
167+
# "note: This error originates from a subprocess, and is likely not a problem with pip"
168+
# To fix this, we need to pgrade versions of pip, setuptools and wheel -> see installer/02_python_packages.bash
169+
# end https://bobbyhadz.com/blog/python-note-this-error-originates-from-subprocess
170+
171+
RUN bash installer/03_install_rsat.bash \
172+
&& bash installer/04_perl_packages.bash \
173+
# && bash installer/06_install_organisms.bash \ skipped to save 243MB
174+
&& bash installer/07_R-and-packages.bash \
175+
&& bash installer/08_apache_config.bash \
176+
&& bash installer/10_clean_unnecessary_files.bash
177+
178+
179+
RUN echo "source ${RSAT}/RSAT_config.bashrc" >> /etc/bash.bashrc \
180+
&& echo "service apache2 start" >> /etc/bash.bashrc
181+
182+
183+
184+
## <---- remove some uneeded folders to save space
185+
RUN rm -rf ${RSAT}/ext_lib/ensemblgenomes*/ensembl-*/modules/t \
186+
${RSAT}/ext_lib/ensemblgenomes*/ensembl-*/.git \
187+
${RSAT}/ext_lib/bioperl*/bioperl-live/t \
188+
${RSAT}/ext_lib/bioperl*/bioperl-live/.git \
189+
${RSAT}/.git
190+
191+
192+
## <---- add new user called rsat_user and give it permission to $RSAT
193+
ENV RSATUSER="rsat_user"
194+
ENV RSATPASS="rsat_2020"
195+
ENV RSATUSERHOME="/home/${RSATUSER}"
196+
ENV TESTPATH="${RSATUSERHOME}/test_data"
197+
ENV EXTMOTIFPATH="${RSATUSERHOME}/ext_motifs"
198+
199+
RUN useradd ${RSATUSER} \
200+
&& echo "${RSATUSER}:${RSATPASS}" | chpasswd \
201+
&& adduser ${RSATUSER} sudo \
202+
&& chown -R "${RSATUSER}:${RSATUSER}" ${RSAT} \
203+
&& chmod 755 ${RSAT} \
204+
&& mkdir -p ${TESTPATH} \
205+
&& mkdir -p ${EXTMOTIFPATH} \
206+
&& chmod -R a+w ${RSATUSERHOME}
207+
208+
## <---- Set env variables
209+
ENV R_LIBS_SITE="${RSAT}/R-scripts/Rpackages/"
210+
ENV PATH="${PATH}:${RSAT}/ext_lib/ensemblgenomes-44-97/ensembl-git-tools/bin:${RSAT}/python-scripts:${RSAT}/perl-scripts/parsers:${RSAT}/perl-scripts:${RSAT}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
211+
212+
## <---- Create new folder with test _data
213+
ENV TESTMAKEURL="https://raw.githubusercontent.com/eead-csic-compbio/coexpression_motif_discovery/master/makefile/peak-motifs.mk"
214+
ENV TESTRSATURL="https://raw.githubusercontent.com/eead-csic-compbio/coexpression_motif_discovery/master/peach/Modules/M11"
215+
ENV TESTRSATFILEREMOTE="${TESTRSATURL}/genesM11.txt"
216+
ENV TESTRSATFILELOCAL="${TESTPATH}/M11.txt"
217+
ENV TESTMAKEFILELOCAL="${TESTPATH}/peak-motifs.mk"
218+
219+
RUN wget ${TESTRSATFILEREMOTE} -O ${TESTRSATFILELOCAL}
220+
RUN wget ${TESTMAKEURL} -O ${TESTMAKEFILELOCAL}
221+
222+
# not needed unless installer/06_install_organisms.bash is run above
223+
## <---- Rename the container's folder for installing genomes, local volume to be used instead,
224+
# this also allows to use preinstalled genomes elsewhere in the file system.
225+
#
226+
# Note that ${RSAT}/public_html/data_container takes 243MB including
227+
# Escherichia_coli_GCF_000005845.2_ASM584v2
228+
# Escherichia_coli_K_12_substr__MG1655_uid57779
229+
# Saccharomyces_cerevisiae
230+
#
231+
# This is a a result of installer/06_install_organisms.bash
232+
#RUN mv ${RSAT}/public_html/data ${RSAT}/public_html/data_container
233+
234+
## <---- set default user and path
235+
USER ${RSATUSER}
236+
237+
WORKDIR "/home/${RSATUSER}"
238+
239+
240+
241+
################################# Useful command lines #################################
242+
#
243+
#
244+
## 1) Build RSAT Docker container
245+
#
246+
# export RSATDOCKERVERSION=`date '+%Y%m%d'`
247+
# docker build --tag rsat:$RSATDOCKERVERSION --tag rsat:latest --force-rm --compress .
248+
#
249+
#
250+
## 2) Create local folders for input data and results, outside the container, as these might be large
251+
#
252+
# mkdir -p ~/rsat_data/genomes ~/rsat_results
253+
# chmod -R a+w ~/rsat_data/genomes ~/rsat_results
254+
#
255+
#
256+
## 3) Launch Docker RSAT container:
257+
#
258+
# docker run --rm -v ~/rsat_data:/packages/rsat/public_html/data/ -v ~/rsat_results:/home/rsat_user/rsat_results -it rsat:latest
259+
#
260+
#
261+
## 4) Download organism from public RSAT server, such as the Plants server.
262+
## Other available servers: http://fungi.rsat.eu, http://metazoa.rsat.eu, http://protists.rsat.eu
263+
#
264+
# download-organism -v 2 -org Prunus_persica.Prunus_persica_NCBIv2.38 -server https://rsat.eead.csic.es/plants
265+
#
266+
#
267+
## 5) Test container
268+
#
269+
# cd rsat_results
270+
# make -f ../test_data/peak-motifs.mk RNDSAMPLES=2 all
271+
#
272+
#
273+
## 6) Install any organism, please follow
274+
## https://rsa-tools.github.io/managing-RSAT/genome_installation/install_organisms_FASTA_GTF.html
275+
#
276+
#
277+
## 7) To connect to RSAT Web server running from Docker
278+
#
279+
# If you run Docker as a normal user Apache will not start properly and you will see these messages:
280+
#
281+
# * Starting Apache httpd web server apache2
282+
# (13)Permission denied: AH00091: apache2: could not open error log file /var/log/apache2/error.log.
283+
# AH00015: Unable to open logs
284+
# Action 'start' failed.
285+
# The Apache error log may have more information
286+
#
287+
# If you really want lo launch the Docker Web server launch tge container and do (see RSATPASS above):
288+
#
289+
# sudo service apache2 restart
290+
# hostname -I
291+
#
292+
# open the following URL in your browser, using the obtained the IP address: http://172.17.0.2/rsat

0 commit comments

Comments
 (0)