Galaxy tools 平台使用簡介 - WES分析
===
###### tags: `生物資訊`, `生物資訊計算平台`, `Galaxy`, `基因體`, `WES`, `2022/11/30+20221130`
<br>
目錄
[TOC]
<br>
## 資訊來源
- 提供單位:NCHC教育訓練網
- 報名網址:[課程名稱:Galaxy tools 平台使用簡介](https://edu.nchc.org.tw/course/one_course_introduction.asp?lms_auto_course_id=4017&from_course_list_url=homepage)
[](https://edu.nchc.org.tw/course/one_course_introduction.asp?lms_auto_course_id=4017&from_course_list_url=homepage)
<br>
## 課程介紹
- ### (一) 課程名稱: Galaxy tools 平台使用簡介
- ### (二) 介紹:
Galaxy是一種應用在生物資訊的工作流管理與分析系統,
這個系統讓使用者能夠用圖形使用者介面,以拖拉圖形方式,
建立多重基因流程分析組合,並實現一鍵執行完成,
整套基因相關分析流程與產出結果, 其應用領域涵蓋了
整個生命科學領域的廣泛領域。有基因組學、宏基因組學、
轉錄組學、蛋白質組學、藥物發現甚至一些外部生物學的資源,
如自然語言處理(其中幾個)和社會科學。
- ### (三) 課程規劃:本課程包含兩部分
1. 如何快速佈屬Galaxy於國網雲端服務上 (7/21)
2. 如何用利用Galaxy 自行組裝一完整基因數據分析流程,
並一鍵自動執行 (11/30)
- ### (四) 本次課程簡介:
透過於國網上架設之Galaxy 平台將所需要基因分析的tools 匯入,
進行 whole exome sequencing(WES)之分析
- ### (五) 本次課程大綱:
1. 簡介Galaxy 平台
2. Galaxy 平台於國網上之運用
3. 簡介 WES 分析tools
4. 實際操作
<br>
## 課程外部資源
- **本次課程講義**
https://drive.google.com/file/d/1CKRteZjwim6TBN1WTpnKhM08mI37Xfv1/view?usp=sharing
- 主要針對第 8 號染色體的 WES 分析
- 探索小孩骨硬化可能來源 (父母為近親,但都無此症狀)
<br>
- **上次課程錄影**
https://www.youtube.com/watch?v=2FoMbsA9fB4
- [利用 Oneai 容器建立建置 Galaxy 服務](https://hackmd.io/dK3Bzkk3RA6VCCnuC_9DRw)
- https://ctnservice.oneai.twcc.ai:30067/ (Galaxy: QIIME 2 Tools)
<br>
- **國網資源文宣**
https://drive.google.com/file/d/1wu4I6Pd533J13ygXMrsUyX5rspxe0q0F/view?usp=sharing
<br>
- **Galaxy for Scientists**
https://usegalaxy.org/training-material/
<br>
<hr>
<br>
## 課程講義細節
> https://drive.google.com/file/d/1CKRteZjwim6TBN1WTpnKhM08mI37Xfv1/view?usp=sharing
> - 主要針對第 8 號染色體的 WES 分析
> - 探索小孩骨硬化可能來源(父母為近親,但都無此症狀)
### Agenda
1. **Introduction**
> 介紹
2. **Data Preparation**
> 準備資料
>
• Get data (獲取資料)
3. **Quality Control**
> 品質控制
4. **Read Mapping**
> 映射片段序列,其實就是對齊(alignment)
5. **Mapped Reads Post-processing**
> 已映射片段序列之後製處理
>
• Filtering on mapped reads properties
• Removing duplicate reads (移除重複片段序列)
6. **Variant Calling**
> 變異偵測
>
• Generating [FreeBayes](https://github.com/freebayes/freebayes) calls
(生成 [FreeBayes](https://github.com/freebayes/freebayes) 偵測)
• Post-processing FreeBayes calls
(FreeBayes 偵測的後製處理)
7. **Variant Annotation and Reporting**
• Get data (獲取資料)
• Variant annotation with functional genomic effects
(具有功能基因體作用的變異標註)
• Generating a GEMINI database of variants for further annotation and efficient variant queries
(生成一個 GEMINI 變異體資料庫,用於進一步的標註和高效的變異體查詢)
• Candidate variant detection
(候選的變異偵測)
8. **Conclusion**
<br>
<hr>
<br>
# WES 分析的操作步驟
> Exome sequencing data analysis
> (HANDS-ON PRACTICE)
## 0. 前言
底下的工具選項,若沒有特別說明,就都是使用**預設選項**。
## 1. Account Registration
> 在 Galaxy 上註冊帳號
>
https://ctnservice.oneai.twcc.ai:30673/
- 註冊帳號

---

- 登入
<hr>
## 2. 認識 Galaxy 界面

- **左側欄**:工具集
- **右側欄**:執行任務,可以多個分支同時並行
- **中間**:主要用來設定工具執行選項、或是查看任務執行結果
<hr>
## 3. 在右側欄建立新的歷史紀錄
> 1. Create a new history for this tutorial and give it a meaningful name
>

<hr>
## 4. 上傳資料
> 2. Obtain the raw sequencing data
https://zenodo.org/record/3243160/files/father_R1.fq.gz
https://zenodo.org/record/3243160/files/father_R2.fq.gz
https://zenodo.org/record/3243160/files/mother_R1.fq.gz
https://zenodo.org/record/3243160/files/mother_R2.fq.gz
https://zenodo.org/record/3243160/files/proband_R1.fq.gz
https://zenodo.org/record/3243160/files/proband_R2.fq.gz
> 3. Check that the newly created datasets in your history have their datatypes assigned correctly
to fastqsanger.gz, and fix any missing or wrong datatype assignment
> 4. Rename datasets
> 5. Add #father/#mother/#child tags to the datasets
> 6. Obtain the reference genome
> https://zenodo.org/record/3243160/files/hg19_chr8.fa.gz
> 7. Rename reference genome
### 資料來源
- https://zenodo.org/record/3243160/files/father_R1.fq.gz
- https://zenodo.org/record/3243160/files/father_R2.fq.gz
- https://zenodo.org/record/3243160/files/mother_R1.fq.gz
- https://zenodo.org/record/3243160/files/mother_R2.fq.gz
- https://zenodo.org/record/3243160/files/proband_R1.fq.gz
- https://zenodo.org/record/3243160/files/proband_R2.fq.gz
**說明**
- 6 個 fq.gz 檔,共 867.83 MB
- father 爸爸, mother 媽媽, proband 小孩
- proband: 確診病患, 發病者
- 有 R1, R2 資料表示雙端定序
- 一條 **片段序列(read)** 可以從頭尾兩端定序
[](https://www.illumina.com/science/technology/next-generation-sequencing/plan-experiments/paired-end-vs-single-read.html)
- 好處:
[](https://www.illumina.com/science/technology/next-generation-sequencing/plan-experiments/paired-end-vs-single-read.html)
1. 讓數據量變成 2 倍
2. 提高比對的精準度,尤其是在重複序列上
3. 有能力檢測 插入-刪除(indel) 變異
### 透過 Galaxy 工具,下載定序資料
1. 點選右側欄的**上傳**圖示,會出現**上傳表單**
[](https://i.imgur.com/iGJxyDs.png)
<br>
[](https://i.imgur.com/OXcah2h.png)
<br>
2. 點選下方的 **Paste/Fetch data** 按鈕
[](https://i.imgur.com/gNd35ib.png)
<br>
3. 貼上下載 link
```
https://zenodo.org/record/3243160/files/father_R1.fq.gz
https://zenodo.org/record/3243160/files/father_R2.fq.gz
https://zenodo.org/record/3243160/files/mother_R1.fq.gz
https://zenodo.org/record/3243160/files/mother_R2.fq.gz
https://zenodo.org/record/3243160/files/proband_R1.fq.gz
https://zenodo.org/record/3243160/files/proband_R2.fq.gz
```
[](https://i.imgur.com/myaFv1W.png)
<br>
4. 再按 
- 隨後歷史任務清單,就會出現 6 個(並行)任務,用於抓取每個下載點。
- 粉桃色表示執行中;淺綠色表示執行完畢。
 
<br>
5. 查看資料
- 點選**眼睛**,查看檔案內容
[](https://i.imgur.com/q0JY4s1.png)
<br>
- 點選**選項**本身,展開任務的執行細節

<br>
- 點選**驚嘆號**,可查看指令的**工具名稱**、**版本**、**參數**,以及更多資訊

<br>
6. 為資料打上 tag ,方便辨識檢體,tag 就會一路跟著後面的分析操作
1. 點選**選項**本身,展開任務的執行細節

<br>
2. 點選**編輯數據集標籤**

<br>
3. 點選**標籤**,並輸入 `#father` (:warning: 需打上`#`),並按 Enter 鍵

<br>

<br>
:::warning
:warning: **比較 `#father` vs `father`**
- `#father` (任務名稱下方多了 tag)

- `father` (任務名稱下方沒有 tag)

:::
4. 分別對 6 份 fastq 打上 tag
- father_R1.fq.gz -> `#father`
- father_R2.fq.gz -> `#father`
- mother_R1.fq.gz -> `#mother`
- mother_R2.fq.gz -> `#mother`
- proband_R1.fq.gz -> `#child`
- proband_R2.fq.gz -> `#child`
<br>
5. 後面在操作資料時,第一眼就可以看出 tag 優勢
[](https://i.imgur.com/dXNREGX.png)
<br>
:::warning
:warning: **比較有`#`和沒`#`的差異**
#1 為 `#father`, #2 為 `father`, 比較其差異
#3 為 `#mother`, #4 為 `mother`, 比較其差異
[](https://i.imgur.com/ROqDtC3.png)
:::
<br>
7. 亦可以對任務名稱進行編輯,方便辨識資料來源
1. 點選**鉛筆**圖示(**編輯屬性**)

2. 編輯任務名稱
- 編輯前:
[](https://i.imgur.com/VOh16Np.png)
- 編輯後:
[](https://i.imgur.com/k9wY2sz.png)
- 按**儲存**
[](https://i.imgur.com/rZr5uIA.png)
3. 編輯後結果:
- 編輯前:

- 編輯後:

- 後面在操作資料時,第一眼就可以看出**資料來源**優勢

4. 編輯前 vs 編輯後
 
8. 查看資料類型
1. 點選**鉛筆**圖示(**編輯屬性**)

2. 點選頁籤:**Datatypes**
[](https://i.imgur.com/A3Tq4pw.png)
3. 確認檔案類型是否為 `fastqsanger.gz`
[](https://i.imgur.com/L1L7bSf.png)
- 可以點選 `Detect datatype` 進行偵測
9. Database/Build 版本
> 不清楚帶來的用途、好處是什麼?
>
1. 點選**鉛筆**圖示(**編輯屬性**)

2. 查看 dataset 屬性:**Database/Build**
[](https://i.imgur.com/UDzOMLq.png)
3. 在過濾欄位上輸入 `hg`
[](https://i.imgur.com/dBPbl32.png)
4. 再挑選 `hg19`
[](https://i.imgur.com/5qEKuyk.png)
### 透過 Galaxy 工具,下載參考序列
1. 步驟同「**下載定序資料**」一樣,資料來源為:
https://zenodo.org/record/3243160/files/hg19_chr8.fa.gz
下載完:

2. 對任務名稱進行編輯,方便辨識資料來源
- 編輯前

- 編輯後

- 套用後

<hr>
## 5. 品質控制
> Quality control
> 1. Run FastQC on each of your six fastq datasets
> 2. Use MultiQC tool to aggregate the raw FastQC data of all input datasets into one report
> 3. Inspect the Webpage output produced by the tool
### 使用 FastQC 分析 6 個資料集
1. 開啟 FastQC

<br>
2. 點選 Multiple datasets,並選擇 6 個 fastq 資料集

<br>
3. 點選 Execute,產生 12 個結果

- RawData 是處理後的純文字結果
[](https://i.imgur.com/DBdbESc.png)
- Webpage 則是用 HTML 來呈現結果
[](https://i.imgur.com/NNpgaB8.png)
### 使用 MultiQC 匯總前面 6 個 RawData
1. 開啟 MultiQC,並選擇 FastQC 子工具,來源為 6 個 FastQC 的 RawData
[](https://i.imgur.com/JUlgUT3.png)
<br>
2. 點選 Execute,產生 1 個結果
[](https://i.imgur.com/gnCBGjD.png)
實際上產生兩個結果:一為 Webpage,另一為 Stats
[](https://i.imgur.com/NjzrRmU.png)
- **Webpage**
[](https://i.imgur.com/V85t37i.png)
- **Stats**

- **fastqc**
[](https://i.imgur.com/HnN0Ju8.png)
- **general_stats**
[](https://i.imgur.com/0MQGPbD.png)
- **sources**
[](https://i.imgur.com/1LOdYLR.png)
<hr>
## 6. 組裝序列
> Read mapping
> 1. Map with BWA-MEM tool to map the reads from the father sample to the reference genome
> 2. Map with BWA-MEM tool to map the reads from the mother sample to the reference
genome
> 3. Map with BWA-MEM tool to map the reads from the child sample to the reference genome
### 組裝爸爸的序列
1. **開啟 BWA-MEM (Burrow-Wheeler Aligner)**
[](https://i.imgur.com/sM6fiaj.png)
<br>
2. **設定:挑選前面下載的 hg19_chr8.fa.gz (hg19中的8號染色體 )**
[](https://i.imgur.com/0qFFd4p.png)
3. **設定:選擇序列來源**
[](https://i.imgur.com/yjDT7bv.png)
- 選擇雙端定序(Paired)
- 選擇第一組序列(讀數):`father_R1.fq.gz`
- 選擇第二組序列(讀數):`father_R2.fq.gz`
4. **設定:樣本資訊(?)**
> 如果後面有用到 analysis software,就設定

- **Set read groups information?**
Set read groups (SAM/BAM specification)
- **Read group identifier (ID)**
000
- **Read group sample name (SM)**
father
- 術語 (參考:[[HackMD] 二級分析 / VCF Format](https://hackmd.io/6rATKTvURVSKia8K_9kBeQ))
- @RG: [Read Groups](https://gatk.broadinstitute.org/hc/en-us/articles/360035890671-Read-groups)
- `ID` = Read group identifier
- `PU` = Platform Unit
- `SM` = Sample
- `PL` = Platform/technology used to produce the read
- `LB` = DNA preparation library identifier
5. 點 Execute
[](https://i.imgur.com/sv4Edhf.png)