Skip to content

Commit

Permalink
Merge pull request #245 from NBISweden/conda-basic-change
Browse files Browse the repository at this point in the history
Conda basic change
  • Loading branch information
fasterius authored Sep 14, 2023
2 parents 5058bfb + 296ac78 commit 89f829f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions pages/conda/conda-2-the-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,66 +64,66 @@ activated.

# Adding more packages

* Now, let's add another package (*seqtk*) to our environment using `conda
* Now, let's add another package (*multiqc*) to our environment using `conda
install`. Make sure that `project_a` is the active environment first.

```bash
mamba install -c bioconda seqtk
mamba install -c bioconda multiqc
```

* If we don't specify the package version, the latest available version will be
installed. What version of seqtk got installed?
installed. What version of multiqc got installed?
* Run the following to see what versions are available:

```bash
mamba search -c bioconda seqtk
mamba search -c bioconda multiqc
```

* Now try to install a different version of seqtk, *e.g.*:
* Now try to install a different version of multiqc, *e.g.*:

```bash
mamba install -c bioconda seqtk=1.2
mamba install -c bioconda multiqc=1.13
```

Read the information that Conda displays in the terminal. It probably asks if
you want to downgrade the initial seqtk installation to the one specified
here (`1.2` in the example). You can only have one version of a given package
you want to downgrade the initial multiqc installation to the one specified
here (`1.13` in the example). You can only have one version of a given package
in a given environment.

Let's assume that you will have sequencing data in your Project A, and want to
use the latest Bowtie2 software to align your reads.
use the latest bbmap software to align your reads.

* Find out what versions of Bowtie2 are available in the Bioconda channel using
`mamba search -c bioconda bowtie2`.
* Now install the *latest* available version of Bowtie2 in your `project_a`
* Find out what versions of bbmap are available in the Bioconda channel using
`mamba search -c bioconda bbmap`.
* Now install the *latest* available version of bbmap in your `project_a`
environment.

Let's further assume that you have an old project (called *Project Old*) where
you know you used Bowtie2 `2.2.5`. You just got back reviewer comments and they
you know you used bbmap `37.10`. You just got back reviewer comments and they
want you to include some alignment statistics. Unfortunately, you haven't saved
that information so you will have to rerun the alignment. Now, it is essential
that you use the same version of Bowtie that your results are based on,
that you use the same version of bbmap that your results are based on,
otherwise the alignment statistics will be misleading. Using Conda environments
this becomes simple. You can just have a separate environment for your old
project where you have an old version of Bowtie2 without interfering with your
project where you have an old version of bbmap without interfering with your
new Project A where you want the latest version.

* Make a new environment for your old project:

```bash
mamba create -n project_old -c bioconda bowtie2=2.2.5
mamba create -n project_old -c bioconda bbmap=37.10
```

* List your environments (do you remember the command?).
* Activate `project_old` and check the Bowtie2 version (`bowtie2 --version`).
* Activate `project_a` again and check the Bowtie2 version.
* Activate `project_old` and check the bbmap version (`bbmap.sh --version`).
* Activate `project_a` again and check the bbmap version.

# Removing packages

Now let's try to remove an installed package from the active environment:

```
mamba remove seqtk
mamba remove multiqc
```

* Run `mamba deactivate` to exit your active environment.
Expand Down

0 comments on commit 89f829f

Please sign in to comment.