---
# System prepended metadata

title: pb-16S-nf on Bianca
tags: [UPPMAX]

---

# pb-16S-nf on Bianca
https://github.com/PacificBiosciences/HiFi-16S-workflow


1. Login to `transit.uppmax.uu.se` 
   Documentation:  
   - https://uppmax.github.io/UPPMAX-documentation/cluster_guides/transfer_bianca/#transit-server
2. Mount the `wharf` of your project.
    ```bash
    user@transit:~$ mount_wharf sens2023531
    Mounting wharf (accessible for you only) to /home/<user>/sens2023531
    <user>-sens2023531@bianca-sftp.uppmax.uu.se's password: 
    ```
4. Navigate to your `wharf` folder
5. Disable Singularity cache
   ```bash
   export SINGULARITY_DISABLE_CACHE=true
   export APPTAINER_DISABLE_CACHE=true
   unset NXF_SINGULARITY_CACHEDIR
   ```
5. Load git and Nextflow software modules
   ```bash
   module load uppmax git bioinfo-tools Nextflow/latest 
   ```
6. Clone the pipeline
   ```bash
   git clone https://github.com/PacificBiosciences/pb-16S-nf.git
   cd pb-16S-nf
   ```
7. Edit the configuration file `nextflow.config`  to adapt it for Bainca `local` executor

   ```json
    ...
    // CPU limit if using local executor
    process {
      name = "Local"
      cpus = 16
    }

    ...
    process {
      withLabel: cpu_def {
        cpus = 4
        memory = 16.GB
      }

      withLabel: cpu8 {
        cpus = 8
        memory = 32.GB
      }

      withLabel: cpu32 {
        cpus = 16
        memory = 128.GB
      }
    }

    ...
    singularity {
      singularity.enabled = true
      singularity.autoMounts = true
      //singularity.cacheDir = "$HOME/nf_conda/singularity"
      singularity.runOptions = "--bind /home"
      params.enable_container=true
      docker.enabled = false
      podman.enabled = false
      shifter.enabled = false
      charliecloud.enabled = false
    }
   ```
8. Run the test to collect the containers

   ```bash
   # Create sample TSV for testing
   echo -e "sample-id\tabsolute-filepath\ntest_data\t$(readlink -f test_data/test_1000_reads.fastq.gz)" > test_data/test_sample.tsv
   
   export NXF_OFFLINE=true
   nextflow run main.nf --input test_data/test_sample.tsv  --metadata test_data/test_metadata.tsv -profile singularity  --outdir results
   ```
   Check that you got the Singularity images
   ```bash
   ls -l work/singularity/
   total 6202312
   -rwxrwxr-x 1 pmitev pmitev 3306160128 May 29 11:24 kpinpb-pb-16s-nf-qiime-v0.7.img
   -rwxrwxr-x 1 pmitev pmitev 1805971456 May 29 11:24 kpinpb-pb-16s-nf-tools-latest.img
   -rwxrwxr-x 1 pmitev pmitev 1239023616 May 29 11:28 kpinpb-pb-16s-vis-latest.img
   ```
    :::info
    WARN: Singularity cache directory has not been defined -- Remote image will be stored in the path: pb-16S-nf/work/singularity -- Use the environment variable NXF_SINGULARITY_CACHEDIR to specify a different location
    :::
    The containers will be saved in `pb-16S-nf/work/singularity` keep this in mind if you want to change the location.
    
9. On Bianca, move the folder somewhere in the project folder.
10. Run the pipeline in a interactive job i.e. `interactive -A sens-XXXX -n 16 -t 24-00:00:00` = adapt the time to fit your needs
11. Perhaps even better in a sbatch job.

    :::success
    file: `run-nextflow.sh`
    ```bash
    #!/bin/bash -l
    #SBATCH -A sens-XXXX
    #SBATCH -t 24-00:00:00
    #SBATCH -n 16
    
    module load bioinfo-tools Nextflow/latest
    
    # just an example
    export NXF_OFFLINE=true
    nextflow run main.nf --input test_data/test_sample.tsv \
                         --metadata test_data/test_metadata.tsv \
                         -profile singularity \
                         --outdir results
    ```
    :::
    
    ```bash
    sbatch run-nextflow.sh
    ```
    http://docs.uppmax.uu.se/cluster_guides/slurm_on_bianca/

## Contacts:
- [Pavlin Mitev](https://katalog.uu.se/profile/?id=N3-1425)
- [UPPMAX](https://www.uppmax.uu.se/)
- [AE@UPPMAX - related documentation](/8sqXISVRRquPDSw9o1DizQ)

![](https://live.webb.uu.se/digitalAssets/207/c_207717-l_3-k_bg-city.png)

###### tags: `UPPMAX`