# BBTools Config File Readme

**Written by Brian Bushnell**  
**Last updated May 12, 2015**

## Overview

A config file is a text file with a set of parameters that will be added to the command line. The format is one parameter per line, with the `#` symbol indicating comments.

To use a config file, use the `config=file` flag. For example, take BBDuk:

```bash
bbduk.sh in=reads.fq out=trimmed.fq ref=ref.fa k=23 mink=11 hdist=1 tbo tpe
```

## Usage Example

That is equivalent to:

```bash
bbduk.sh in=reads.fq out=trimmed.fq ref=ref.fa config=trimadapters.txt
```

...if `trimadapters.txt` contained these lines:

```
k=23
mink=11
hdist=1
tbo
tpe
```

## Parameter Override Behavior

Any parameter placed **AFTER** the config file will override the same parameter if it is in the config file.

### Example 1: Command Line Override
For example, in this case `k=20` will be used:
```bash
bbduk.sh in=reads.fq out=trimmed.fq ref=ref.fa config=trimadapters.txt k=20
```

### Example 2: Config File Takes Precedence
But in this case, `k=23` will be used, from the config file:
```bash
bbduk.sh in=reads.fq out=trimmed.fq ref=ref.fa k=20 config=trimadapters.txt
```

## Purpose and Benefits

What are config files for? Well, mainly, to overcome difficulties like:
- **Whitespace in file paths**
- **Command lines that are too long**

There are some example config files in `bbmap/config/`. They are not used unless you specifically tell a program to use them.