Conda Create Exercise
15 Minutes
We’ve covered the basics of Conda, including how to create environments, as well as activate and deactivate them. We’ll use those same ideas in this exercise to create a conda environment with all of the software that we’ve used so far.
In this exercise, we’ll use a special tool that enhances Conda, called Mamba. It is used for environment creation, so you will use it in place of conda create
in this exercise.
Instructions:
- Work independently in the main room, posting any questions that arise to slack.
- Recommendations for writing your own code:
- Read function documentation
- Test out ideas - it’s okay to make mistakes and generate errors
- Use a search engine to look up errors or recommended solutions using keywords
- We’ll review possible solutions after time is up as a group.
- When a solution is found DO NOT have all users create the environment. Instead, choose only a subset of interested learners to complete this exercise. We do not want to overwhelm the AWS instance.
- Use
mamba
to create an environment with all of the software that we used today:
- cutadapt
- fastqc
- multiqc
- star
- rsem
- Use two channels when building the environment:
Hint: The tool mamba
is a drop-in replacement for conda create
and similar commands. It is powerful and fast, which allows us to easily replicate our whole environment from today. conda create
can be very slow or uncooperative when creating environments with certain software combinations, and mamba
helps us get around that in this case. The command is exactly the same as a conda create
command, e.g.:
mamba create -n <env-name> -c <channel> <package1> ...
Solution - Conda Create Exercise
# Check to see if mamba is installed
which mamba
# If you don't have mamba installed, you can install it to your base conda environment
conda install -c conda-forge mamba
# Use mamba to create an environment with Cutadapt, FastQC, MultiQC, STAR, and RSEM.
mamba create -n RSD_environment -c conda-forge -c bioconda cutadapt fastqc multiqc star rsem
# Activate the environment and use which to check for software presence
conda activate RSD_environment
which cutadapt
which fastqc
which multiqc
which STAR
which rsem-calculate-expression
# Deactivate the environment
deactivate
LS0tCnRpdGxlOiAiRXhlcmNpc2UgMDQgU29sdXRpb24iCmF1dGhvcjogIlVNIEJpb2luZm9ybWF0aWNzIENvcmUiCm91dHB1dDoKICAgICAgICBodG1sX2RvY3VtZW50OgogICAgICAgICAgICBpbmNsdWRlczoKICAgICAgICAgICAgICAgIGluX2hlYWRlcjogaGVhZGVyLmh0bWwKICAgICAgICAgICAgdGhlbWU6IHBhcGVyCiAgICAgICAgICAgIGZpZ19jYXB0aW9uOiB0cnVlCi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