README.md 8.28 KB
Newer Older
1
2
[![DOI](https://zenodo.org/badge/86720601.svg)](https://zenodo.org/badge/latestdoi/86720601)

3
4
# RADSex

5
6
Current pre-release : 0.2.0

Romain Feron's avatar
Romain Feron committed
7
8
The RADSex pipeline is **currently under development** and has not been officially released yet.
Missing features are been implemented, some bugs are to be expected in this current development version, and parameters are subject to change.
9
Please contact me by email or on Github, or open an issue if you encounter bugs or would like to discuss a feature !
10

Romain Feron's avatar
Romain Feron committed
11
## Overview
12

Romain Feron's avatar
Romain Feron committed
13
14
15
16
RADSex is a software package for the analysis of sex-determination using RAD-Sequencing data.
The `process` function generates a data structure summarizing a set of demultiplexed RAD reads,
and other functions use this data structure to infer information about the type of sex-determination system, identify sex-biased sequences, and map the RAD sequences to a reference genome.
The results of RADSex are meant to be visualized with the `radsex-vis` R package, available here: https://github.com/RomainFeron/RADSex-vis.
17

Romain Feron's avatar
Romain Feron committed
18
This pipeline was developed in the [LPGP](https://www6.rennes.inra.fr/lpgp/) lab from INRA, Rennes, France for the PhyloSex project, which investigates sex determining factors in a wide range of fish species.
Romain Feron's avatar
Romain Feron committed
19

20
## Documentation
Romain Feron's avatar
Romain Feron committed
21

Romain Feron's avatar
Romain Feron committed
22
This README file contains a simple documentation, including a basic installation guide as well as a quick start section.
23

Romain Feron's avatar
Romain Feron committed
24
The full documentation for RADSex (still under construction) is available [there](https://radsex.readthedocs.io/en/latest).
Romain Feron's avatar
Romain Feron committed
25
26
27
It contains a complete Getting Started section, a detailed usage for all functions, and real-life datasets examples covering many situations.


Romain Feron's avatar
Romain Feron committed
28
## Requirements
29

30
- A C++11 compliant compiler (GCC >= 4.8.1, Clang >= 3.3)
Romain Feron's avatar
Romain Feron committed
31
32
33
- The zlib library (which should be installed on linux by default)

## Installation
34

35
- Clone: `git clone https://github.com/RomainFeron/RadSex.git`
36
- *Alternative: download the archive and unzip it*
37
38
- Go to the RadSex directory (`cd RadSex`)
- Run `make`
Romain Feron's avatar
Romain Feron committed
39
- The compiled `radsex` binary is located in `RadSex/bin/`
40

41
42
43
44
45
## Quick start

#### Before starting

Before running the pipeline, you should prepare the following elements:
46
47
48
49
- A **set of demultiplexed reads**. The current version of RADSex does not implement demultiplexing;
  raw sequencing reads can be demultiplexed using [Stacks](http://catchenlab.life.illinois.edu/stacks/comp/process_radtags.php)
  or [pyRAD](http://nbviewer.jupyter.org/gist/dereneaton/af9548ea0e94bff99aa0/pyRAD_v.3.0.ipynb#The-seven-steps-described).
- A **population map** (popmap): a tabulated file with individual ID as the first column and sex as the second column.
Romain Feron's avatar
Romain Feron committed
50
  It is important that the individual IDs in the popmap are the same as the names of the demultiplexed reads files (see the doc for details).
51
52
53
- If you want to map the sequences to a reference genome: a **reference genome** in fasta format.
  Note that when visualizing `mapping` results with `radsex-vis`, linkage groups / chromosomes are automatically inferred from scaffold names in the reference sequence
  if their name starts with *LG*, *chr*, or *chromosome* (case unsensitive).
Romain Feron's avatar
Romain Feron committed
54
  If chromosomes are named differently in the reference genome, you should prepare a tabulated file with reference scaffold ID in the first column and corresponding chromosome name in the second column (see the doc for details)
55
56
57
58
59

#### Computing the coverage table

The first step of RADSex is to create a table of coverage for the dataset using the `process` command:

60
`radsex process --input-dir ./samples --output-file coverage_table.tsv --threads 16 --min-coverage 1`
61

62
In this example, demultiplexed reads are stored in `./samples` and the coverage table generated by `process` will be stored in `coverage_table.tsv`. The parameter `--threads` specifies the number of threads to use.
63

Romain Feron's avatar
Romain Feron committed
64
65
The parameter `--min-coverage` specifies the minimum coverage value to consider a sequence present in an individual:
sequences which are not present with coverage higher than this value in at least one individual will not be retained in the coverage table.
66
It is advised to keep the minimum coverage to 1 for this step, as it can be adjusted for each analysis later.
67
68
69
70
71

#### Computing the distribution of sequences between sexes

After generating the coverage table, the `distrib` command is used to compute the distribution of sequences between sexes:

72
`radsex distrib --input-file coverage_table.tsv --output-file distribution.tsv --popmap-file popmap.tsv --min-coverage 5`
73

Romain Feron's avatar
Romain Feron committed
74
75
In this example, the input file `--input-file` is the coverage table generated in the [previous step](#computing-the-coverage-table), and the distribution of sequences between sexes will be stored in `distribution.tsv`.
The sex of each individual in the population is given by `popmap.tsv` (see the [popmap section](#population-map) for details).
76
The minimum coverage to consider a sequence present in an individual is set to 5, meaning that sequences present with coverage (depth) lower than 5 in one individual will not be counted in this individual.
77

Romain Feron's avatar
Romain Feron committed
78
This distribution can be visualized with the `plot_sex_distribution()` function of `radsex-vis`, which generates a tile plot.
79
80
81
82
83

#### Extracting sequences significantly associated with sex

Sequences significantly associated with sex can be obtained with the `signif` command:

84
`radsex signif --input-file coverage_table.tsv --output-file sequences.tsv --popmap-file popmap.tsv --min-coverage 5 [ --output-format fasta ]`
85

Romain Feron's avatar
Romain Feron committed
86
87
88
In this example, the input file `--input-file` is the coverage table generated in the [first step](#computing-the-coverage-table), and the sequences significantly associated with sex will be stored in `sequences.tsv`.
The sex of each individual in the population is given by `popmap.tsv` (see the [popmap section](#population-map) for details),
and the minimum coverage to consider a sequence present in an individual is set to 5 (see the [previous section](#computing-the-distribution-of-sequences-between-sexes)).
89
By default, the `signif` function exports a small coverage table; sequences can be exported to fasta using the `--output-format` parameter.
90

Romain Feron's avatar
Romain Feron committed
91
The coverage table generated by `signif` can be visualized with the `plot_coverage()` function of `radsex-vis`, which generates a heatmap of coverage.
92
93
94
95
96

#### Mapping sequences to a reference genome

Sequences can be mapped to a reference genome using the `map` command:

97
`radsex map --input-file coverage_table.tsv --output-file mapping.tsv --popmap-file popmap.tsv --genome-file genome.fasta --min-quality 20 --min-frequency 0.1 --min-coverage 5`
98

Romain Feron's avatar
Romain Feron committed
99
100
101
102
In this example, the input file `--input-file` is the coverage table generated in the [first step](#computing-the-coverage-table), the mapping results will be stored in `sequences.tsv`,
and the path to the reference genome file is given by `--genome-file`. The sex of each individual in the population is given by `popmap.tsv` (see the [popmap section](#population-map) for details),
and the minimum coverage to consider a sequence present in an individual is set to 5 (see the [previous section](#computing-the-distribution-of-sequences-between-sexes)).
The parameter `--min-quality` specifies the minimum mapping quality (as defined in [BWA](http://bio-bwa.sourceforge.net/bwa.shtml)) to consider a sequence mapped (`--min-quality`), here set to 20.
103
The parameter `--min-frequency` specifies the minimum frequency of a sequence in at least one sex; it is set to 0.1 here, meaning that only sequences present in at least 10% of individuals of one sex are retained for mapping.
104

Romain Feron's avatar
Romain Feron committed
105
106
The mapping results generated by `map` can be visualized with the `plot_genome()` function of `radsex-vis`, which generates a circos plot for the entire genome.
Mapping results for a specific scaffold can be visualized with the `plot_contig()` function to generate a linear plot for the specified scaffold.
107

Romain Feron's avatar
Romain Feron committed
108
## LICENSE
109

Romain Feron's avatar
Romain Feron committed
110
Copyright (C) 2018 Romain Feron
111

Romain Feron's avatar
Romain Feron committed
112
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation,
113
either version 3 of the License, or (at your option) any later version.
114

Romain Feron's avatar
Romain Feron committed
115
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
116
See the GNU General Public License for more details.
117
118

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/