Sign inSign up

jysgro/mycotools

By jysgro

Updated over 2 years ago

Debian container to run mycotools

Image
Data science
0

1.2K

jysgro/mycotools repository overview

PURPOSE: follow mycotools tutorial at https://github.com/xonq/mycotools

TAG TO USE: jysgro/mycotools:beta_mtdb_v9

NOTE:

I only keep TAG :beta_mtdb_v9 as other images were not created properly.

The long Dockerfile contains multiple source of solution links.


In the test directory it is said: "UNFORTUNATELY, MACS THAT USE THE NEW M SERIES CPUS DO NOT HAVE PACKAGE SUPPORT FOR MANY OF THE DEPENDENCIES."*

Also, the very last OPTIONAL software requires blast which is not available for ARM on Mac (apparently even within a Linux container...?) See https://stackoverflow.com/questions/77441981/problems-installing-with-conda-under-macos-14-1-m1

Docker is great but making an image from a Docker file is full of ambushes... I added the INFO tags to the help pages that helped..

NOTE: M1 Macs may have to pull with the following command, (update :beta_mtdb_v9 tag if necessary.)

docker pull --platform=linux/amd64 jysgro/mycotools:beta_mtdb_v9

HOW TO RUN:

Mac: open a Terminal.
Windows: Open PowerShell or cmd Terminal.

docker run -it --rm -v ${PWD}:/home -w /home jysgro/mycotools:beta_mtdb_v9

The current directory will be shared and all files saved even after the container is exited (exit when done) and deleted automatically (thanks to --rm.) All files created will remain on the host computer thanks to the sharing (-v.)

Once "within" the container, users should activate the environment as suggested in the tutorial:

conda activate mycotools

NOTES

Since this container is based on continuumio/miniconda3 some users may be interested in using this container with Jupyter notebook, as provided in their Overview page. However, this is not the best method for the mycotools workshop which runs from bash even though it is written in Python.

Dockerfile for TAG:beta_mtdb_v9

This is the current "best" version. Thanks to this note: do-something-using-dockerfile-run-but-ignore-errors it is possible to finalize a container with the suggested command mtdb -d which files without || True added due to the final warning about using pip to install under root. By adding ||true the warning is ignored and the Docker image is created.

FROM continuumio/miniconda3:24.3.0-0

# ADD GCC NEEDED TO COMPILE BIOPYTHON
# INFO https://stackoverflow.com/questions/77073996/trouble-installing-gcc-on-debian-linux-distribution-in-dockerfile

RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive \
    apt-get install --assume-yes --no-install-recommends \
      gcc

# ADD TO COMPILE BIOPYTHON
# INFO: https://stackoverflow.com/questions/19580758/gcc-fatal-error-stdio-h-no-such-file-or-directory
# AND: https://stackoverflow.com/questions/19580758/gcc-fatal-error-stdio-h-no-such-file-or-directory/29284967#29284967
# ADD file less and nano for file editing and manipulation

RUN apt-get install -y libc6-dev file less nano wget curl

# NECESSARY for "crap" program otherwise "ete3" cannot import "faces"
# FROM Issue: https://github.com/etetoolkit/ete/issues/354
# check command in ....site-packages/PyQt5: ldd *.so | grep 'not found'| sort | uniq
# INSTALL INFO: https://superuser.com/questions/1404875/how-to-dowload-libgl-so-1

RUN apt-get install -y --reinstall libgl1-mesa-glx && \
    apt-get clean

ENV SHELL /bin/bash

###########################################
# INSTALL MYCOTOOLS
# INFO at https://gitlab.com/xonq/mycotools
###########################################
# See activation from
# https://stackoverflow.com/questions/55123637/activate-conda-environment-in-docker
#
RUN conda config --add channels defaults && \
    conda config --add channels bioconda && \
    conda config --add channels conda-forge && \
    conda config --set channel_priority strict && \
    conda create -n mycotools python pip

RUN /bin/bash -c "source activate mycotools && \
    python3 -m pip install mycotools --upgrade && \
    mtdb -d || true"

# || TRUE shoud avoid image not build due to error caused
# by warning of using pip under root.
# INFO FROM https://stackoverflow.com/questions/71500601/do-something-using-dockerfile-run-but-ignore-errors

###########################################
# OPTIONAL
# INFO https://github.com/xonq/mycotools/blob/master/test/mycotools_workshop.md
###########################################

RUN  /bin/bash -c "source activate mycotools && \
     conda install clinker-py -c conda-forge -c bioconda"

#########################################################
# NOTE: THIS SECTION ONLY FOUND ON AMD64
## SEE https://stackoverflow.com/questions/77441981/problems-installing-with-conda-under-macos-14-1-m1

RUN /bin/bash -c "source activate mycotools && \
    conda install orthofinder -c bioconda"

# ADDITIONAL
# CLIP KIT MAY BE ADDED WITH mtdb -d...
# RUN /bin/bash -c "source activate mycotools && \
#       conda install clipkit -c bioconda"

# Overcoming problem installing ete3 
# Config option found at https://github.com/rapidsai/cuml/issues/4016
# Other solutions not user at https://github.com/etetoolkit/ete/issues/500
# Default info: https://anaconda.org/etetoolkit/ete3
# also: http://etetoolkit.org/download/
# Need to reactivate mycotools environment!

RUN /bin/bash -c "source activate mycotools &&\
    conda config --set channel_priority flexible && \
    conda install etetoolkit::ete3"

# ADD MISSING MODULES FOR ete3 - Add one and check what's still missing
# INFO FROM https://stackoverflow.com/questions/49193417/ete3-module-on-python3-cannot-import-treestyle-faces-attrface-nodestyle

RUN /bin/bash -c "source activate mycotools && \
    conda install qt pyqt numpy six scipy"

# ONE MORE
# INFO https://www.roseindia.net/answers/viewqa/pythonquestions/87872-ModuleNotFoundError-No-module-named-dna_features_viewer.html

# SHOULD BE ADDED BY 'mtdb -d'
#RUN /bin/bash -c "source activate mycotools" && \
#    conda install bioconda::dna_features_viewer

# Reclaim - clean up space

RUN  rm /opt/conda/pkgs/cache/*.*

RUN set -e \
      && apt-get clean \
      && rm -rf /var/lib/apt/lists/*

Dockerfile v8s

OLDER FILE.

All commands were combined to limit the number of layers, which result in a smaller docker image once downloaded. (On Hub they are compressed.)

Currently:

REPOSITORYTAGIMAGE IDSIZE
jysgro/mycotoolsbeta_v7s9ba0e0034c125.53GB
jysgro/mycotoolsbeta_v7b72bebe2cb597.98GB

The "simplified" Dockerfile for version beta_v8s does not contain the # annotation found in beta_v7.

FROM continuumio/miniconda3:24.3.0-0

RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive \
    apt-get install --assume-yes --no-install-recommends \
      gcc

RUN apt-get install -y libc6-dev file less nano
RUN apt-get install -y --reinstall libgl1-mesa-glx

RUN conda config --add channels defaults && \
    conda config --add channels bioconda && \
    conda config --add channels conda-forge && \
    conda config --set channel_priority strict

ENV SHELL /bin/bash

# ENVIRONMENT FIXES -
# INFO https://stackoverflow.com/questions/55123637/activate-conda-environment-in-docker

RUN conda create -n mycotools python pip
ENV PATH /opt/conda/envs/mycotools/bin:$PATH

# NOTE LOCATION OF QUOTES BELOW TO STAY INSIDE ENVIRONMENT!

RUN /bin/bash -c "source activate mycotools  && \
    python3 -m pip install mycotools --upgrade && \
    conda config --add channels defaults && \
    conda config --add channels bioconda && \
    conda config --add channels conda-forge && \
    conda config --set channel_priority strict && \
    conda install qt pyqt numpy six scipy &&\
    conda install clinker-py -c conda-forge -c bioconda && \
    conda install bioconda::blast conda-forge::gnutls conda-forge::nettle && \
    conda install orthofinder -c bioconda"

RUN /bin/bash -c "source activate mycotools  && \
    conda config --set channel_priority flexible && \
    conda install clipkit -c bioconda && \
    conda install etetoolkit::ete3  && \
    conda install bioconda::dna_features_viewer "

RUN  rm /opt/conda/pkgs/cache/*.*

RUN set -e \
      && apt-get clean \
      && rm -rf /var/lib/apt/lists/*

Building ambushes

It is hard to understand phrases such as "just pip" or "just use Conda" as things are a lot (LOT) more complicated than that. A few hours later, now at Tag version v7 I discovered the missing links, one by one... The worst to deal with was ete3 and thanks to the suggestion of importing ete3 within python and checking what's missing was I able to figure out that the missing ones were: qt pyqt numpy six --- who knew?

The mycotools program crap still issues syntax errors like SyntaxWarning: invalid escape sequence but at least it works.

The final Dockerfile contains the web links necessary to understand various issues. One even disappeared by moving the installation further down the list in the Dockerfile but is explained in libmamba-solver-libarchive-so-19-error which just "went away" by moving the installation downward.

Tag summary

Content type

Image

Digest

sha256:3aeae9323

Size

2.5 GB

Last updated

over 2 years ago

docker pull jysgro/mycotools