---
# System prepended metadata

title: Running the container version of MetaboDirect in the UA HPC

---

# Running the container version of MetaboDirect in the UA HPC

#### Christian Ayala-Ortiz (cayalaortiz@arizona.edu)

## 1. Start an interactive session

An interactive session is required to pull the container. TO start and interactive session use the following command:

```
interactive -a tfaily -t 2:00:00
```

If you want to create an interactive session with more cpus or with more time you can check the help of the interactive command with `interactive --help`.

## 2. Pull the container

MetaboDirect's container is publicly available in [DockerHub](https://hub.docker.com/repository/docker/coayala/metabodirect/general). It can be converted to an Apptainer container (formerly known as Singularity) so it can be run in the HPC.

```
cd ~
apptainer pull metabodirect.sif docker://coayala/metabodirect:v0.3.5
```

## 3. Use the container

The previous steps will download the container to your `$HOME` directory, from here it can be used in an interactive session or submmited as a job to the SLURM scheduler.

To use the container start your command with `~/metabodirect.sif` followed by the normal commands that are used for runnin MetaboDirect.

### 3.1 Example on an interactive session

This will run MetaboDirect immediately, good for fast analysis. If you close the terminal the run will be terminated.

a.  Start an interactive session with the desired number of cpus (`-n`) and time (`t`).

```
interactive -a tfaily -n 20 -t 10:00:00
```

b.  Run the MetaboDirect container

```
~/metabodirect.sif metabodirect Report.csv metadata.csv -n sum -g Treatment -k -o results
```

### 3.2 Example submitting to the SLURM scheduler

This will submit a job to the SLURM scheduler. The job will have to wait in the queue before starting, but you can close the terminal and come back when the job has finished.

For more information about running jobs in the UA HPC, check their [User Guide](https://public.confluence.arizona.edu/display/UAHPC/Running+Jobs+with+SLURM)

a.  Create a "slurm" file to submit to the scheduler

```
nano metabodirect_job.slurm
```

b.  Put the SLURM parameters and the metabodirect commands into the file. Here you can set the number of cpus (`ntasks`), the time (`time`) and your email to receive notifications (`mail-user`).

```
#!/bin/bash
#SBATCH --job-name=metabodirect
#SBATCH --nodes=1
#SBATCH --ntasks=20
#SBATCH --mem=5gb
#SBATCH --time=10:00:00
#SBATCH --partition=standard
#SBATCH --account=tfaily
#SBATCH --mail-user=your_email@arizona.edu
#SBATCH --mail-type=ALL
#SBATCH -o %x-%j.out

~/metabodirect.sif metabodirect Report.csv metadata.csv -n sum -g Treatment -k -o results
```

c. Submit the job to the scheduler.

```
sbatch metabodirect_job.slurm
```


