--- title: 'Bioinformatic:Command Line for Genomics' --- [TOC] ## Linux 環境建置 :::info 常見的 Linux 作業系統有 Ubuntu, CentOS 等,使用的指令介面有些許的不同,而 Windows 為 cmd,,PowerShell。 在 Linux 當中還有許多不同類型的 shell 如:TCSH、BASH shell。 功能有些許差異,但常見的幾個指令也有重和之處。 ::: ### 練習:TCSH (8hrs) ![螢幕擷取畫面 2024-04-04 144900](https://hackmd.io/_uploads/Sk0ta6sJA.png) CentOS 6.5系統安裝設定圖解教學 https://www.osyunwei.com/archives/7174.html VMware Workstation 9擴充Linux VM虛擬硬碟空間 https://oldbig1011.blogspot.com/2014/09/vmware-workstation-9linux-vm.html :::info 一開始花大量時間研究與練習TCSH,這是朋友的爸爸在用的, 後發現與課程指令無法通用且此版本已經沒有再更新了,因而改用BASH ::: ### 主要使用:BASH Shell (4hrs) ![BASH](https://hackmd.io/_uploads/BkqAXt91A.png) 1. 在 Windows 10 安裝虛擬機軟體 Virtualbox 2. 在 Virtualbox 安裝 Ubuntu 3. [Windows 11 share folder with Ubuntu in VirtualBox](https://puzzle-apple-6b1.notion.site/Oracle-VM-virtualBox-Ubuntu22-04-for-Bash-1392ac42b1da800b956ce1ae3d74ff79) :::info 基本上照著以上兩個安裝教學做就能正常使用,加上有用過TCSH,所以操作的還算順利 ::: > PS: > 如需與主機共用資料夾 開啟VM登入後 > Open terminal > 輸入sudo mount -t vboxsf ShareDataVM /home/andrew/Documents/ShareDataPC #### 常用的指令 | 指令 | 說明 | 使用方式 | | ------ | -------------------------- | -------------------------------- | | . | 當前資料夾 | | | .. | 上一層資料夾 | | | ~ | 家目錄 | | | / | 根目錄 | | | man | 查看指令詳細說明 | man <指令名稱> | | echo | 輸出文字 | echo <輸出內容> | | whoami | 列出目前已登入帳號 | whoami | | ls | 列出當前資料夾檔案列表 | ls | | cd | 切換資料夾 | cd <資料夾路徑> | | pwd | 輸出當前資料夾路徑 | pws | | cat | 輸出指定檔案的內容 | cat <檔案路徑> | | grep | 搜尋與關鍵字相符的檔案內容 | grep <關鍵字> <檔案路徑> | | touch | 新增一個空的檔案 | touch <檔案名稱> | | mkdir | 建立一個資料夾 | mkdir <資料夾名稱> | | find | 尋找指定的檔案 | find <路徑> -iname <關鍵字> | | file | 查看指定檔案的檔案類型 | file <檔案路徑> | | rm | 刪除檔案或資料夾 | rm <檔案或資料夾路徑> | | mv | 移動檔案或資料夾位置 | mv <檔案或資料夾路徑> <目標路徑> | | cp | 複製檔案或資料夾 | cp <複製源路徑> <目標路徑> | | sudo | 使用超級使用者權限執行命令 | sudo <命令> | | apt | 軟體包管理器 | apt <操作> | | ssh | 透過 ssh 遠端操作機器 | ssh <user>@<ip> -p <port> | | nano | 文字編輯器 | nano <檔案名稱> | * terminal中按`上下鍵`可以使用輸入過指令 * 參數忘記,按兩下`tab`顯示出建議的選項 * 輸入檔案路徑,可輸入部分後按`tab`補齊剩餘部分 * 大多數的命令加上 `--help` 參數可以獲得簡單的指令介紹 [新手入門] 003 Linux 指令教學 `極推薦` 參考:https://feifei.tw/learn-linux/ ### 練習:大氣動力學(Bash shell) :::warning 見以下連結內容 [Atmospheric dynamics](/4TqznCTaTi6F2hH4Z6UHVg) ::: ## [實作課程1:Introduction to the Command Line for Genomics](https://datacarpentry.org/shell-genomics/01-introduction.html) ### Access the remote server (1hr) 1.Logging onto a cloud instance https://datacarpentry.org/cloud-genomics/02-logging-onto-cloud#logging-onto-a-cloud-instance1 2.installed PuTTY.exe https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html #### - [ ] 依照實作課程1指示,進入另一個網站1.並照指示安裝網站2.的程式網站1.安裝完成後,回到實作課程1繼續執行 ![螢幕擷取畫面 2024-04-04 174403](https://hackmd.io/_uploads/S1RuLg210.png) > 問題:instructor 沒有給我 **ip_address** 無法繼續 待編輯 ## [實作課程2:Data Wrangling and Processing for Genomics](https://datacarpentry.org/wrangling-genomics/01-background.html) ### Background and Metadata(15mins) 閱讀內容並下載.csv ### Assessing Read Quality(3hr) *Bioinformatic workflows ![image](https://hackmd.io/_uploads/HJQVcenk0.png) 1. 品質控制 - 使用 FastQC 評估質量 2. 品質控制 - 修剪和/或過濾讀取(如有必要) 3. 將讀取與參考基因組對齊 4. 執行對齊後清理 5. 變體調用 *Starting with data(30mins) #### - [O] 依照指示下載ENA數據 ![螢幕擷取畫面](https://hackmd.io/_uploads/HJk7AZn1C.png) > 問題:沒有出現如網頁上的下載訊息,還以為是其中參數`-O`中o是小寫的 >> 解決方法:發現`curl`需先用`sudo apt install curl = 7.81.0`下載 #### - [O] 接著就是接續下載其他五個,如下 ![螢幕擷取畫面](https://hackmd.io/_uploads/H1BPXGh10.png) #### - [ ] 用`head`去讀SRR2584863_1.fastq.gz的前四行 課程指示忘記加上.gz ![螢幕擷取畫面](https://hackmd.io/_uploads/rJn6VG2JR.png) > 問題:出現的數據為亂碼 #### - [O] 用sudo apt install fastqc下載 fastqc-h ![螢幕擷取畫面](https://hackmd.io/_uploads/Sk7VIfnJR.png) *Assessing quality using FastQC(2hr) #### - [ ] 運行FastQC前,確認是否還在`untrimmed_fastq`的資料夾裡,使用ls -l -h看所有在此資料夾內的檔案大小 ![螢幕擷取畫面](https://hackmd.io/_uploads/BJlNtfh1C.png) > 問題:發現SRR2584863_1.fastq.gz的大小與課程指示不同(我的175M、他的545M) > 且他的沒有附檔名.gz,回去嘗試重載也無此檔案(如下圖) > ![螢幕擷取畫面](https://hackmd.io/_uploads/SJnZ5Mhy0.png) #### - [O] 使用FastQC運行所有.fastq檔`fastqc *.fastq*`得.zip和.html檔 ![螢幕擷取畫面](https://hackmd.io/_uploads/H1lCiMnyC.png) #### - [O] 將FastQC的結果分析檔與.fastq的數據集檔分開資料夾放,結果檔放到新資料夾result ![螢幕擷取畫面](https://hackmd.io/_uploads/B1r0TGnkC.png) #### - [ ] 因為這些檔案都在遠端AWS裡,所以我們的VM無法用瀏覽器看HTML檔,因此我們使用`scp`將檔案從遠端伺服器傳送到我們的主機 ![螢幕擷取畫面](https://hackmd.io/_uploads/H1JR8X3JR.png) > 問題:他給出的原因為connection timed out,也嘗試過課程內寫的例外處理方法,結果都一樣 待編輯