一、下載數據
GSE111229 :https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE111229
只下載7個SRR進行學習;
數據下載的話可以參考前面寫的一篇筆記:
二、安裝conda
參考前面的筆記:
安裝軟件:
conda install -y sra-tools multiqc fastp hisat2
三、SRA轉fastq文件
ls * |while read id; do (nohup fastq-dump --gzip --split-3 -O ./ ${id} &); done
四、質控
ls *gz |xargs fastqc
五、過濾
- 新建幾個文件夾
mkdir 01clean 02mapping 03count
- 批量fastp
ls *.fastq.gz | while read id; do (nohup fastp -i ${id} -o ../01clean/$(basename ${id} ".gz").clean);done
六、比對
下載參考基因組
hisat2官網有建好索引的基因組下載:
http://daehwankimlab.github.io/hisat2/download/#m-musculus
批量比對
cd 02mapping/
ls ../01clean/*clean |while read id;do (nohup hisat2 -p 2 -x /mnt/e/bioinfo/mmreference/mm10/genome -U $id -S ${id%%.*}.hisat.sam &);done
%%.* 語法參考:
https://blog.csdn.net/qq_30130417/article/details/80911989
file=/dir1/dir2/dir3/my.file.txt
{file#*/}: 刪掉第一個 / 及其左邊的字符串:dir1/dir2/dir3/my.file.txt
{file##*/}: 刪掉最后一個 / 及其左邊的字符串:my.file.txt
{file#*.}: 刪掉第一個 . 及其左邊的字符串:file.txt
{file##*.}: 刪掉最后一個 . 及其左邊的字符串:txt
{file%/*}: 刪掉最后一個 / 及其右邊的字符串:/dir1/dir2/dir3
{file%%/*}: 刪掉第一個 / 及其右邊的字符串:(空值)
{file%.*}: 刪掉最后一個 . 及其右邊的字符串:/dir1/dir2/dir3/my.file
{file%%.*}: 刪掉第一個 . 及其右邊的字符串:/dir1/dir2/dir3/my
由于是在自己電腦上跑數據,沒用服務器,結果死機了,還是一個個數據單獨比對吧,這里只演示一個:
nohup hisat2 -p 2 -x /mnt/e/bioinfo/mmreference/mm10/genome -U ../01clean/SRR6790711.fastq.clean -S SRR6790711.hisat.sam &
sam格式 轉bam格式
ls *.sam | while read id;do (samtools sort -O bam -@ 2 -o $(basename ${id} ".sam").bam ${id});done
為bam文件構建index
ls *.bam |xargs -i samtools index {}
七、count
下載featureCounts
wget https://sourceforge.net/projects/subread/files/subread-2.0.2/subread-2.0.2-Linux-x86_64.tar.gz
下載gtf文件
genecode: https://www.gencodegenes.org/mouse/
全路徑運行featureCounts
/mnt/d/bioinfo/biosoft/featureCounts/subread-2.0.2-Linux-x86_64/bin/featureCounts -T 5 -t exon -g gene_id -a /mnt/e/bioinfo/mmreference/gencode.vM30.annotation.gtf -o ../03count/all.id.txt *.bam 1>counts.id.log 2>&1 &
參考:
B站生信技能樹: