Diff of /README.md [000000] .. [4c33d4]

Switch to unified view

a b/README.md
1
# exSEEK
2
3
exSEEK is an integrated computational framework to discover and evaluate exRNA biomarkers for liquid biopsy.
4
5
![Pipeline of Tutorial](tutorial/pipeline.png)
6
7
The exSEEK framework consists of:
8
+ Pre_processing:
9
   
10
   + Building index with various types of genomes and annotations. [`exseek build-index`]
11
   + Quality control and removing adaptors. [`exseek quality_control`] [`exseek cutadapt`] [`exseek quality_control_clean`]
12
   + Sequential mapping for small/long RNA-seq. [`exseek mapping`]
13
14
+ Main function:
15
   
16
   + Peak calling for recurring fragments of long RNAs. [`exseek bigwig`] [`exseek call_domains`]
17
   + Counting expression matrix. [`exseek count_matrix`]
18
   + Normalization and batch removal. [`exseek normalization`]
19
   + Feature selection and classification. [`exseek feature_selection`]
20
   + Biomarker evaluation. [`exseek feature_selection`]
21
22
Table of Contents:
23
24
* [Installation](#installation)
25
* [Usage](#usage)
26
  * [Index preparing](#index-preparing)
27
  * [Small RNA-seq mapping](#small-rna-seq-mapping)
28
  * [Peak calling](#peak-calling)
29
  * [Long RNA-seq mapping](#long-rna-seq-mapping)
30
  * [Counting expression matrix](#counting-expression-matrix)
31
  * [Normalization and batch removal](#normalization-and-batch-removal)
32
  * [Feature selection and biomarker evaluation](#feature-selection-and-biomarker-evaluation)
33
* [Copyright and License Information](#copyright-and-license-information)
34
* [Citation](#citation)
35
* [Tutorial](tutorial/)
36
37
38
## Installation
39
40
For easy installation, you can use the [exSEEK image](https://hub.docker.com/r/ltbyshi/exseek) of [docker](https://docs.docker.com/) with all dependencies installed:
41
```bash
42
docker pull ltbyshi/exseek
43
```
44
45
All required software and packages are already installed in docker, so there are no more requirements. To test the installation and get information about the command-line interface of exSEEK, you can execute:
46
```bash
47
docker run --rm -it -v $PWD:/workspace -w /workspace ltbyshi/exseek exseek.py -h
48
```
49
The -v flag mounts the current working directory `$PWD` into the `/workspace` in docker image, so you can easily check the output files in `/workspace` directory after exiting docker.
50
51
You can create a bash script named `exseek` and set the script executable: 
52
```bash
53
#! /bin/bash
54
docker run --rm -it -v $PWD:/workspace -w /workspace ltbyshi/exseek exseek.py "$@"
55
```
56
After adding the file to one of the directories in the `$PATH` variable, you can simply run: `exseek`.
57
58
59
A helper message is shown:
60
```bash
61
usage: exseek.py [-h] --dataset DATASET [--config-dir CONFIG_DIR] [--cluster]
62
                 [--cluster-config CLUSTER_CONFIG]
63
                 [--cluster-command CLUSTER_COMMAND] [--singularity]  
64
                 {build_index,quality_control,cutadapt,quality_control_clean,mapping,
65
                 call_domains,count_matrix,normalization,feature_selection}
66
67
exseek main program
68
69
positional arguments:
70
  {build_index,quality_control,cutadapt,quality_control_clean,mapping,
71
  call_domains,count_matrix,normalization,feature_selection}
72
73
optional arguments:
74
  -h, --help                                    show this help message and exit
75
  --dataset DATASET, -d DATASET                 dataset name
76
  --config-dir CONFIG_DIR, -c CONFIG_DIR        directory for configuration files
77
  --cluster                                     submit to cluster
78
  --cluster-config CLUSTER_CONFIG               cluster configuration file ({config_dir}/cluster.yaml by default)
79
  --cluster-command CLUSTER_COMMAND             command for submitting job to cluster (default read from
80
                                                {config_dir}/cluster_command.txt
81
  --singularity                                 use singularity
82
```
83
84
The basic usage of exSEEK is:
85
```bash
86
exseek ${step_name} -d ${dataset}
87
```
88
89
> **Note:**
90
> * `${step_name}` is one of the step listed in 'positional arguments'.
91
> * `${dataset}` is the name of your dataset that should match the prefix of your configuration file described in the following section.
92
93
94
95
## Usage
96
97
You can use the provided `example_data` to run exSEEK:
98
```bash
99
cp /apps/example_data /workspace
100
```
101
102
The `example_data` folder has the following structure:
103
```
104
example_data/
105
├── config
106
|   ├── example.yaml
107
|   ├── default_config.yaml
108
│   └── machine_learning.yaml
109
110
├── data
111
│   └── example
112
|       ├── fastq
113
│       ├── batch_info.txt
114
│       ├── compare_groups.yaml
115
│       ├── sample_classes.txt
116
│       └── sample_ids.txt
117
└── output
118
    └── example
119
        └── ...
120
```
121
122
> **Note:**
123
> * `config/example.yaml`: configuration file with frequently adjusted parameters, such as file paths and mapping parameters.
124
> * `config/default_config.yaml`: configuration file with additional detailed parameters for each step. The default file is not supposed to be changed. If you want to adjust parameters contained in this file, it is **recommended** to add your adjusted parameters in `config/example.yaml`.
125
> * `config/machine_learning.yaml`: configuration file with parameters used for feature selection and classification steps. It is **recommended** to add your adjusted parameters in `config/example.yaml` if you want to adjust parameters contained in this file.
126
> * `data/example/batch_info.txt`: table of batch information.
127
> * `data/example/compare_groups.yaml`: table for definition of positive and negative samples.
128
> * `data/example/sample_classes.txt`: table of sample labels.
129
> * `output/example/`: output folder.
130
131
---
132
133
### Index preparing
134
135
exSEEK docker contains a variety of commonly used genomes and annotations. Besides of RNA types extracted from GENCODE V27, exSEEK can also analyze rRNA from NCBI refSeq 109, miRNA from miRBase, piRNA from piRNABank, circRNA from circBase, lncRNA and TUCP from mitranscriptome, repeats from UCSC Genome Browser (rmsk) and promoter and enhancer from ChromHMM tracks. You can download these `.fa`, `.gtf` and `.bed` files here and build index with these genomes and annotations.
136
```bash
137
138
```
139
140
For mapping small RNA-seq, the index of each transcript type can be built with bowtie2, and the index used for mapping long RNA-seq can be built with STAR. You can get these index by executing:
141
```bash
142
exseek build_index -d example
143
```
144
It might take hours to generate the index. It is **recommended** to specify the number of threads in `config/example.yaml` file by adding `threads: N`, or you can simply add `-j N` parameter in the exseek command.
145
The output folder is `genome/hg38/index/`.
146
147
The detailed information for each transcript type is in `genome/hg38/transcript_table/` directory.
148
The summary for transcript types is listed below:
149
| RNA type | Number of transcripts |
150
| :--- | :--- |
151
| rRNA | 37 |
152
| mature_miRNA | 2656 |
153
| miRNA | 1917 |
154
| piRNA | 23410 |
155
| snoRNA | 943 |
156
| snRNA | 1900 |
157
| srpRNA | 680 |
158
| tRNA | 649 |
159
| mRNA | 19836 |
160
| lncRNA | 15778 |
161
| TUCP | 3730 |
162
| Y_RNA | 756 |
163
| univec | 6093 |
164
| spikein_long | 92 |
165
| spikein_small | 52 |
166
167
---
168
169
### Small RNA-seq mapping
170
171
#### Quality control \(before adaptor removal\)
172
You can check reads quality with FastQC by running:
173
174
```bash
175
exseek quality_control -d example
176
```
177
> **Note:**
178
> * The detailed results for each sample are in folder `output/example/fastqc/`. 
179
> * You can quickly check the summary results for all samples with the `fastqc.txt` file in `output/example/summary/fastqc_data/multiqc_fastqc.txt`.
180
181
#### Remove adapter
182
exSEEK removes reads adaptor with cutadapt software. You can change the adaptor sequences in `config/example.yaml` file.
183
184
```bash
185
exseek cutadapt -d example
186
```
187
> **Note:**
188
> * You can check the additional parameters for cutadapt in `config/default_config.yaml` file. 
189
> * You can check the adaptor revmoval summary with `output/example/summary/cutadapt.txt` file.
190
191
#### Quality control \(after adapter removal\)
192
```bash
193
exseek quality_control_clean -d example
194
```
195
> **Note:**
196
> * The detailed results for each sample are in folder `output/example/fastqc_clean/`. 
197
> * You can quickly check the summary results for all samples with the `fastqc.txt` file in `output/example/summary/fastqc_clean_data/multiqc_fastqc.txt`.
198
199
#### Update sequential mapping order
200
exSEEK allows user-defined sequential mapping, which is particularly useful for small RNA-seq samples because short RNA reads are more likely to be mapped to multiple locations. The default mapping order is set as `rna_types` variable in `config/default_config.yaml`:
201
```yaml
202
rna_types: [univec, rRNA, lncRNA, mature_miRNA, miRNA, mRNA, 
203
  piRNA, snoRNA, snRNA, srpRNA, tRNA, tucpRNA, Y_RNA]
204
```
205
206
You can change the mapping order based on the confidence of each RNA type in your samples by adding a `rna_types` variable in `config/example.yaml`. For example, you can add spike-in sequences as the first RNA type:
207
```yaml
208
rna_types: [spikein_small, univec, rRNA, lncRNA, mature_miRNA, miRNA, 
209
  mRNA, piRNA, snoRNA, snRNA, srpRNA, tRNA, tucpRNA, Y_RNA]
210
```
211
212
#### Add new reference sequence
213
214
If a new RNA type is added, you should also add a sequence file in FASTA format: `${genome_dir}/fasta/${rna_type}.fa`. Then build a FASTA index \(`${genome_dir}/fasta/${rna_type}.fa.fai`\):
215
```bash
216
samtools faidx ${genome_dir}/fasta/${rna_type}.fa
217
```
218
219
Then build a bowtie2 index \(`${genome_dir}/index/bowtie2/${rna_type}`\):
220
```bash
221
bowtie2-build ${genome_dir}/fasta/${rna_type}.fa ${genome_dir}/index/bowtie2/${rna_type}
222
```
223
224
#### Mapping
225
exSEEK provides bowtie2 for mapping small RNA-seq. You can specify the `paired_end` parameter as `false` or `true` in `config/example.yaml`. It is **recommended** to specify the number of threads in `config/example.yaml` file by adding `threads_mapping: N`, or you can simply add `-j N` parameter in the exseek command. The other parameters for mapping can be found in `config/default_config.yaml`.
226
```bash
227
exseek mapping -d example
228
```
229
230
> **Note:**
231
> * Make sure that the parameter `small_rna` is ***`True`*** in `config/example.yaml`.
232
> * The output folder `output/example/gbam` contains genome bam files.
233
> * The output folder `output/example/tbam` contains transcriptome bam files for all types of RNA.
234
> * The output folders `output/example/stats/mapped_read_length*/` contain the summary of read length distribution for each RNA type.
235
> * The output file `output/example/summary/read_counts.txt` is the summary of read counts mapped to each RNA type for all samples.
236
237
---
238
239
### Peak calling
240
exSEEK provides local maximum-based peak calling methods for identifying recurring fragments (which are recurrently detected among samples,defined as domains) of long exRNAs (such as mRNA, srpRNA, and lncRNA). These called domains can be combined into the expression matrix and serve as potential biomarker candidates.
241
```bash
242
exseek bigwig -d example
243
exseek call_domains -d example
244
```
245
246
**Notes:**
247
* Domain calling parameters in `config/default_config.yaml`:
248
> * `bin_size: 20`: size of bins for calculating read coverage.
249
> * `cov_threshold: 0.05`: The proportion of samples that have the called peak. Peaks with cov_threshold higher than 0.05 are defined as domains. 
250
251
* Output files:
252
> * `output/example/domains_localmax_recurrence/recurrence.bed` contains all recurring peaks (domains).
253
> * `output/example/domains_localmax/domains.bed` contains filtered (domains shorter than 10nt are filtered out) and merged domains. 
254
255
The `recurrence.bed` file looks like this:
256
| Transcript ID | TransStart | TransEnd | X | Frequency | Strand |
257
| :--- | :--- | :--- | :--- | :--- | :--- |
258
| ENST00000365118.2 | 0 | 30 | X | 8 | + |
259
| ENST00000365223.1 | 0 | 61 | X | 12 | + |
260
| ENST00000365436.1 | 69 | 92 | X | 2 | + |
261
| ENST00000366365.2 | 236 | 261 | X | 1 | + |
262
263
The `domains.bed` file looks like this:
264
| Transcript ID | TransStart | TransEnd | filtered_merged Peak_ID | Weighted_ave_frequency | Strand |
265
| :--- | :--- | :--- | :--- | :--- | :--- |
266
| ENST00000006015.3 | 1506 | 1523 | peak_1 | 14.2353 | + |
267
| ENST00000006015.3 | 1971 |1986 | peak_2 | 10 | + |
268
| ENST00000008938.4 | 20 | 35 | peak_3 | 7 | + |
269
| ENST00000025301.3 | 8580 | 8597 | peak_4 | 37.2353 | + |
270
| ENST00000192788.5 | 2649 | 2665 | peak_5 | 72.5625 | + |
271
272
---
273
274
### Long RNA-seq mapping
275
276
The methods for long RNA-seq mapping are very similar to **Small RNA-seq mapping**. You can use the above command lines for long RNA-seq by setting ***`small_rna`*** to ***`False`*** in file `config/example.yaml`. It is **recommended** to specify the number of threads in `config/example.yaml` file by adding `threads_mapping: N`, or you can simply add `-j N` parameter in the exseek command. There is no peak calling step for long RNA-seq datasets because recurring fragment (domain) is not a distinctive feature of extracellular long RNA-seq datasets. 
277
278
---
279
280
### Counting expression matrix
281
exSEEK use featureCounts for counting expression matrix. 
282
```bash
283
exseek.py count_matrix -d example
284
```
285
286
**Notes:**
287
* For small RNA-seq, the ouput folder `output/example/count_matrix/` contains 4 types of expression matrix:
288
> | Name | Transcript type |
289
> | :--- | :--- |
290
> | transcript.txt | all full_length transcripts |
291
> | transcript_mirna.txt | only miRNA |
292
> | long_fragments.txt | recurring peaks (domain) |
293
> | mirna_and_long_fragments.txt | miRNA and recurring peaks (domain) |
294
295
* For long RNA-seq, the ouput folder `output/example/count_matrix/` contains 2 types of expression matrix:
296
> | Name | Transcript type |
297
> | :--- | :--- |
298
> | featurecounts.txt | genome_long_rna |
299
> | circRNA.txt | circRNA |
300
301
---
302
303
### Normalization and batch removal
304
305
exSEEK supports 5 normalization methods and 4 batch removal methods in `config/example.yaml`:
306
```yaml
307
normalization_method: ["TMM", "RLE", "CPM", "CPM_top", "null"]
308
batch_removal_method: ["null", "ComBat", "limma", "RUV", "null"]
309
count_method: [transcript, transcript_mirna, long_fragments, mirna_and_long_fragments, featurecounts(for long RNA-seq)]
310
batch_index: 1
311
```
312
313
You can get the normalized expression matrix generated by any combinations of normalization and batch removal methods by executing:
314
```bash
315
exseek normalization -d example
316
```
317
318
> **Notes:**
319
> * When the method name is set to `null`, the step is skipped.
320
> * You can specify the expression matrix type to be normalized via the `count_method` variable.
321
> * `batch_index` is the column index of `data/example/batch_info.txt` to be used for ComBat batch removal.
322
> * The name pattern of **output** files in folder `output/example/matrix_processing` is: **`filter.null.Norm_${normalization_method}.Batch_${batch_removal_method}_${batch_index}.${count_method}.txt`**.
323
324
You can choose the best combination methods based on the ***UCA*** score and then ***mKNN*** score, which is summarized in folder: `output/example/select_preprocess_method/uca_score/` and `output/example/select_preprocess_method/knn_score`.
325
326
The UCA metric quantifies the separation of samples from different biological groups, while the mKNN metric measures the uniformity of the distribution of samples from different batches. For a perfectly corrected expression matrix, both the ***UCA*** score and the ***mKNN*** score approach ***1***.
327
328
The UCA score files look like this:
329
| preprocess_method | uca_score |
330
| :--- | :--- |
331
| filter.null.Norm_CPM_top.Batch_limma_1 | 0.578 |
332
| filter.null.Norm_CPM.Batch_limma_1 | 0.563 |
333
| filter.null.Norm_CPM_top.Batch_ComBat_1 | 0.563 |
334
| filter.null.Norm_CPM_top.Batch_RUV_1 | 0.564 | 
335
336
And the mKNN score files look like this:
337
| preprocess_method | knn_score |
338
| :--- | :--- |
339
| filter.null.Norm_CPM_top.Batch_limma_1 | 0.940 |
340
| filter.null.Norm_CPM.Batch_limma_1 | 0.936 |
341
| filter.null.Norm_CPM_top.Batch_ComBat_1 | 0.936 |
342
| filter.null.Norm_CPM_top.Batch_RUV_1 | 0.927 | 
343
344
***Alternatively, you can simply get the best-performance combination method (the highest averaged UCA and mKNN score) listed in `output/example/select_preprocess_method/combined_score/${count_method}/selected_methods.txt`.***
345
346
After deciding the most proper combination of normalization and batch removal methods, you can specify the exact normalization and batch removal method by adjusting `normalization_method` and `batch_removal_method` parameters in `config/sample.yaml`, and the generated matrix will be used for the next step.
347
348
---
349
350
### Feature selection and biomarker evaluation
351
352
This step identifies and evaluates exRNA biomarker panels selected by various combinations of feature selection methods and machine learning classifiers. 
353
354
exSEEK supported feature selection and classification methods:
355
```yaml
356
selector: [DiffExp_TTest, RandomForest, LogRegL1, LogRegL2, SIS, ReliefF, SURF, MultiSURF]
357
358
classifier: [LogRegL2, RandomForest, RBFSVM, DecisionTree, MLP]
359
```
360
361
You can evaluate all combinations of feature selection and classification methods based on the cross-validation results by running:
362
```bash
363
exseek feature_selection -d example
364
```
365
366
> **Note:**
367
> * You can adjust the maximum number of selected features `n_features_to_select` in `config/example.yaml`.
368
> * You can setup the comparison groups for classification in `data/config/compare_groups.yaml`.
369
> * The detailed parameters of machine learning can be found in `config/default_congfig.yaml`. 
370
> * The cross-validation results and trained models for individual combinations are in this directory:
371
**`output/example/cross_validation/filter.null.Norm_${normalization_method}.Batch_${batch_removal_method}_${batch_index}.${count_method}/${compare_group}/${classifier}.${n_select}.${selector}.${fold_change_filter_direction}`**.
372
> * Selected features (biomarker panels) for each model can be found in `features.txt` in the above-mentioned directory.
373
374
Three summary files will be generated in this step:
375
```bash
376
 output/example/summary/cross_validation/metrics.test.txt
377
 output/example/summary/cross_validation/metrics.train.txt
378
 output/sxample/summary/cross_validation/feature_stability.txt
379
 ```
380
381
You can choose the most proper combination and its identified features (biomarker panel) base on ***ROC_AUC*** and ***feature stability*** score summarized in the above three files.
382
383
The `metrics.*.txt` file looks like:
384
385
| classifier | n_features | selector | fold_change_direction | compare_group | filter_method | imputation | normalization | batch_removal | count_method | preprocess_method | split | accuracy | average_precision | f1_score | precision | recall | roc_auc |
386
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
387
| LogRegL2 | 5 | MaxFeatures_RandomForest | any | Normal-HCC | filter | null | Norm_RLE | Batch_limma_1 | mirna_and_domains_rna | filter.null.Norm_RLE.Batch_limma_1 | 1 | 0.928 | 0.916 | 0.800 | 1.000 | 0.666 | 0.969 |
388
| LogRegL2 | 5 | DiffExp_TTest| any | Normal-HCC | filter | null | Norm_RLE | Batch_limma_1 | mirna_and_domains_rna | filter.null.Norm_RLE.Batch_limma_10 | 1 | 0.928 | 0.743 | 0.800 | 1.000 | 0.666 | 0.696 |
389
390
The `feature_stability.txt` file looks like:
391
392
| classifier | n_features | selector | fold_change_direction | compare_group | filter_method | imputation | normalization | batch_removal | count_method | preprocess_method | feature_stability
393
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
394
| LogRegL2 | 5 | DiffExp_TTest | any | Normal-HCC | filter | null | Norm_RLE | Batch_limma_1 | mirna_and_domains_rna | filter.null.Norm_RLE.Batch_limma_1 | 0.450 |
395
| RBFSVM | 5 | DiffExp_TTest | any | Normal-stage_A | filter | null | Norm_RLE | Batch_limma_1 | mirna_and_domains_rna | filter.null.Norm_RLE.Batch_limma_1 | 0.473 |
396
 
397
398
399
## Copyright and License Information
400
401
Copyright (C) 2019 Tsinghua University, Beijing, China 
402
403
This program is licensed with commercial restriction use license. Please see the [LICENSE](https://github.com/lulab/exSEEK_docs/blob/master/LICENSE) file for details.