README.md 4.37 KB
Newer Older
peguerin's avatar
peguerin committed
1
# REFERENCE DATABASE
peguerin's avatar
peguerin committed
2

peguerin's avatar
peguerin committed
3
Collection of scripts to build a reference database for metabarcoding analysis.
peguerin's avatar
peguerin committed
4

peguerin's avatar
peguerin committed
5
# Reference database built from EMBL taxonomy and sequences
peguerin's avatar
peguerin committed
6
7
8
9
10

This method is based on [OBItools](https://pythonhosted.org/OBITools/welcome.html#installing-the-obitools)'s reference database.

## Installation

peguerin's avatar
peguerin committed
11
To build this reference database, you will need a local copy of this repository
peguerin's avatar
peguerin committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

* open a shell
* make a folder, name it yourself, I named it workdir

```
mkdir workdir
cd workdir
```
* clone the project and switch to the main folder, it's your working directory

```
git clone http://gitlab.mbb.univ-montp2.fr/edna/reference_database.git
cd reference_database
```

## Dependencies

You will also need to have the following programs installed on your computer.


- [OBItools](https://pythonhosted.org/OBITools/welcome.html#installing-the-obitools)
- [ecoPCR](https://git.metabarcoding.org/obitools/ecopcr/wikis/home)
peguerin's avatar
stampa    
peguerin committed
34
35
36
37
- [python 3.6.6](https://www.python.org/downloads/release/python-366/)
- `python 3 library` [biopython](https://biopython.org/)
- `python 3 library` [etetoolkit](http://etetoolkit.org/)

peguerin's avatar
peguerin committed
38
39
40
41
42

## Preparation

- install dependencies
- clone the project (see [Installation](#installation) section)
peguerin's avatar
peguerin committed
43
- fill in [config.sh](config.sh) and read [ecoPCR ](https://pythonhosted.org/OBITools/scripts/ecoPCR.html?highlight=ecopcr) documentation
peguerin's avatar
peguerin committed
44

peguerin's avatar
peguerin committed
45
## Build a reference database (MISEQ)
peguerin's avatar
peguerin committed
46

peguerin's avatar
peguerin committed
47
* Overview of the steps
peguerin's avatar
stampa    
peguerin committed
48
	1. Download the sequences
peguerin's avatar
peguerin committed
49
50
51
52
	2. Download the taxonomy
	3. Use [ecoPCR](https://git.metabarcoding.org/obitools/ecopcr/wikis/home)
 to simulate an *in silico* PCR
	4. Clean the database
peguerin's avatar
peguerin committed
53
	5. (optionnal : only if you use [bash_swarm](https://gitlab.mbb.univ-montp2.fr/edna/bash_swarm) pipeline) Convert the database into STAMPA format
peguerin's avatar
peguerin committed
54
55
56

* Run the script

peguerin's avatar
peguerin committed
57
After you have filled in the [config.sh](config.sh) files with the right parameters, simply run the following command into the current folder `reference_database`
peguerin's avatar
peguerin committed
58
59
60
61
62
63
64
65
66
67
68
69
```
bash build_bdr.sh
```
It will be very long to download the sequences and process the *in silico* PCR and filtering steps. Be sure you can run without interruption this script for several days.

I recommand you to open [build_bdr.sh](build_bdr.sh) and to run it step by step. For more information, this script is based on the [OBItools](https://pythonhosted.org/OBITools/welcome.html#installing-the-obitools)'s tutorial available [here](https://pythonhosted.org/OBITools/wolves.html).

## Results
let's define {prefix} as the prefix of the names of reference database as it's defined in [config.sh](config.sh)

The folder of the project will contain `{prefix}_*.sdx` files and a `db_{prefix}.fasta` file. 

peguerin's avatar
peguerin committed
70
In addition, it includes `EMBL` folder which contains all the sequences and `TAXO` folder which contains taxonomic information files.
peguerin's avatar
peguerin committed
71
72
73

## Use the reference database

peguerin's avatar
peguerin committed
74
Now, your reference database can be used for taxonomic assignment in our pipeline to generate species environmental presence from raw eDNA data.
peguerin's avatar
peguerin committed
75

peguerin's avatar
peguerin committed
76
77
You can use the absolute path of the folder of your reference database as the `/path/to/reference_database` argument in the following pipelines :
* [only_obitools](http://gitlab.mbb.univ-montp2.fr/edna/only_obitools)
peguerin's avatar
peguerin committed
78
* [nextflow_obitools](https://gitlab.mbb.univ-montp2.fr/edna/nextflow_obitools)
peguerin's avatar
peguerin committed
79
* [snakemake_only_obitools](http://gitlab.mbb.univ-montp2.fr/edna/snakemake_only_obitools)
peguerin's avatar
peguerin committed
80

peguerin's avatar
peguerin committed
81

peguerin's avatar
stampa    
peguerin committed
82
83
## Reference database in STAMPA format

peguerin's avatar
peguerin committed
84
Once you generated your reference database, you need the `db_{prefix}.fasta` file (see Results section above).
peguerin's avatar
peguerin committed
85
Type the following command to convert your reference database into STAMPA format :
peguerin's avatar
stampa    
peguerin committed
86
```
peguerin's avatar
peguerin committed
87
python3 scripts/formatDB_obifasta_to_stampa.py -f /path/to/db_{prefix}.fasta -o /path/to/reference_database_stampa.fasta
peguerin's avatar
stampa    
peguerin committed
88
```
peguerin's avatar
peguerin committed
89
This command generates a file `/path/to/reference_database_stampa.fasta` which you can use as a reference database for the pipeline :
peguerin's avatar
peguerin committed
90
91
92
* [bash_swarm](https://gitlab.mbb.univ-montp2.fr/edna/bash_swarm)


peguerin's avatar
peguerin committed
93
94
95
96
97
98
99
100
101
102
103
104
105
# Build a reference database (RAPIDRUN)

1. Write a table [infos/markers.csv](infos/markers.csv) with name of marker, primer 5' and primer 3'
2. Fill configuration field into [config.sh](config.sh)
3. Execute main script

```
bash build_bdr_rapidrun.sh
```

This will generate a folder for each marker with a database of reference sequences belonging to the marker sequences.


peguerin's avatar
peguerin committed
106
107
108
109
110
111
112
113
114
# Authors

* Pierre-Edouard GUERIN, CNRS, CEFE
* Virginie Marques, CNRS, MARBEC


# License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details