STAR下載地址
https://github.com/alexdobin/STAR
STAR的優(yōu)勢(shì):
1.快速
2.推薦在RNAseq數(shù)據(jù)中使用。
STAR經(jīng)常出現(xiàn)在哪些應(yīng)用中:
10x cellranger中
RNAseq數(shù)據(jù)
單細(xì)胞數(shù)據(jù)。
下載安裝:
tar -xzf 2.5.3a.tar.gz
cd STAR-2.5.3a
make STAR
第一步build index:
任何一款比對(duì)軟件在比對(duì)前都需要對(duì)reference建立一個(gè)index,目的是為了減少比對(duì)時(shí)間或降低算法復(fù)雜度(算法使然)。
(1)使用現(xiàn)成的
10x genomics 的ref data中有現(xiàn)成的index文件。可以在官網(wǎng)下載下來直接用,但僅限于對(duì)應(yīng)的ref。
比如你下載的是refdata-cellranger-GRCh38-3.0.0,
那么就有如下這些內(nèi)容都是STAR 比對(duì)所需的index文件。并且STAR軟件也自帶下載了。

(2)自己構(gòu)建:
需要用到的文件有g(shù)enome.fa,gtf文件,兩種即可,如下命令:
/cygene/work/STAR-2.5.3a/source/STAR \
--runThreadN 20 \
--runMode genomeGenerate \
--genomeDir ./ \
--genomeFastaFiles /home/database/refdata-cellranger-GRCh38-1.2.0/fasta/genome.fa \
--sjdbGTFfile /home/database/refdata-cellranger-GRCh38-1.2.0/genes/genes.gtf
$ sh work.sh
Aug 28 09:16:14 ..... started STAR run
Aug 28 09:16:14 ... starting to generate Genome files
Aug 28 09:17:10 ... starting to sort Suffix Array. This may take a long time...
Aug 28 09:17:24 ... sorting Suffix Array chunks and saving them to disk...
Aug 28 09:58:43 ... loading chunks from disk, packing SA...
Aug 28 10:01:53 ... finished generating suffix array
Aug 28 10:01:53 ... generating Suffix Array index
Aug 28 10:04:37 ... completed Suffix Array index
Aug 28 10:04:37 ..... processing annotations GTF
Aug 28 10:04:50 ..... inserting junctions into the genome indices
Aug 28 10:07:26 ... writing Genome to disk ...
Aug 28 10:07:28 ... writing Suffix Array to disk ...
Aug 28 10:09:05 ... writing SAindex to disk
Aug 28 10:09:22 ..... finished successfully
20個(gè)線程,大約耗時(shí)35分鐘。消耗內(nèi)存30G,
比對(duì):
最簡(jiǎn)單的比對(duì)參數(shù):
STAR --runThreadN $CPU --genomeDir $index_dir --readFilesIn [PE_1.fq] [PE_2.fq] --outFileNamePrefix [prefix.] --outSAMtype BAM SortedByCoordinate
得到的是bam文件。
Example:
STAR --runThreadN 20 --genomeDir $star_index
--readFilesCommand zcat
--outSAMtype BAM Unsorted
--readFilesIn sample1.fastq.gz.tagged.fastq.gz,sample2.fastq.gz.tagged.fastq.gz,sample3.fastq.gz.tagged.fastq.gz,sample4.fastq.gz.tagged.fastq.gz
--outFileNamePrefix L006
example2:
/cygene/work/STAR-2.5.3a/source/STAR \
--runThreadN 20 \
--genomeDir /cygene/work/02.dropEst/star \
--readFilesCommand zcat \
--outSAMtype BAM Unsorted \
--readFilesIn /cygene/work/02.dropEst/01_dropTag/sample1.fastq.gz.tagged.fastq.gz
example3: STAR 輸出 unmapped reads (STAR 輸出未必對(duì)上的reads)
STAR-2.7.6a/bin/Linux_x86_64/STAR --runThreadN 10 --genomeDir /path/to/database/mm10/STAR-2.7.6a --readFilesCommand zcat --readFilesIn myfile1_1.fq.gz myfile2_2.fq.gz --outFileNamePrefix myfile_prefix. --outSAMtype BAM SortedByCoordinate --outReadsUnmapped Fastx --outSAMattributes All
注意--outSAMattributes ALL指輸出所有tag,如:NH:i:1 HI:i:1 AS:i:202 nM:i:3 NM:i:2 MD:Z:57T14C32 jM:B:c,-1 jI:B:i,-1 MC:Z:45S105M
默認(rèn)情況下(指不加該參數(shù))只有: NH:i:1 HI:i:1 AS:i:292 nM:i:3 這幾個(gè)(好像是,待驗(yàn)證),也可以指定只輸出哪幾個(gè)。因?yàn)橛行┫掠畏治鲕浖?huì)要求bam中藥有NM才能統(tǒng)計(jì)。
關(guān)于STAR使用時(shí)的一些報(bào)錯(cuò)收集及解決方法:STAR報(bào)錯(cuò)合集。
STAR報(bào)錯(cuò)1:
STAR Segmentation Fault
$ STAR --runThreadN 10 \
--genomeDir refdata-cellranger-GRCh38-1.2.0/star \
--readFilesCommand zcat \
--readFilesIn /my/data/G88E3L2_R1.fq.gz /my/data/G88E3L2_R2.fq.gz \
--outFileNamePrefix mysamplename. \
--outSAMtype BAM SortedByCoordinate
Mar 27 11:00:11 ..... started STAR run
Mar 27 11:00:11 ..... loading genome
Mar 27 11:00:19 ..... started mapping
Segmentation fault (core dumped)
嘗試解決方法:
1.不設(shè)置--runThreadN 仍然報(bào)錯(cuò)。
2.設(shè)置-- outSAMtype BAM Unsorted 仍然報(bào)錯(cuò)
3.設(shè)置 --genomeLoad LoadAndRemove --limitBAMsortRAM 10000000000 仍然報(bào)錯(cuò)
4.設(shè)置 --outSAMtype SAM 仍然報(bào)錯(cuò)
5.檢查read1與read2 文件大小是否一致。結(jié)果文件大小一致。
6.換其他版本STAR,換了cellranger自帶的STAR,不再報(bào)錯(cuò)。
STAR 報(bào)錯(cuò)2:
STAR Error: the read ID should start with @ or >
這個(gè)報(bào)錯(cuò)主要是你放入的fastq的壓縮文件。
解決方法:設(shè)置讀取文件參數(shù):
--readFilesCommand zcat
或者
--readFilesCommand "gunzip -c"
STAR 報(bào)錯(cuò)3:
FATAL ERROR,number of bytes expected from the BAM bin does not agree with the actual size on disk:

解決方法:
- 設(shè)置 --outSAMtype SAM
- 或者更新到最新版本
STAR報(bào)錯(cuò)4:
$ STAR --version
2.7.3a
$ STAR --runThreadN 70 \
--genomeDir /hg19_star2.7_index \
--readFilesCommand zcat \
--readFilesIn XXX_R1.fastq.gz XXX_R2.fastq.gz \
--outFileNamePrefix samplename. \
--outSAMtype BAM SortedByCoordinate
Apr 10 22:15:50 ..... started STAR run
Apr 10 22:15:50 ..... loading genome
Apr 10 22:16:35 ..... started mapping
BAMoutput.cpp:27:BAMoutput: exiting because of *OUTPUT FILE* error: could not create output file GB001._STARtmp//BAMsort/20/16
SOLUTION: check that the path exists and you have write permission for this file. Also check ulimit -n and increase it to allow more open files.
Apr 10 22:16:37 ...... FATAL ERROR, exiting
解決方法:將--runThreadN 設(shè)置為20,原因還需要深究。
或更新到最新版本。
STAR報(bào)錯(cuò)5:
(這里忘記收集報(bào)錯(cuò)的截圖了,以后遇到再補(bǔ))
解決方法:
檢查read1 和read2是否一致。多半是PE read 不一致造成。
STAR報(bào)錯(cuò)6:
EXITING because of fatal ERROR: not enough memory for BAM sorting:

解決方法:
根據(jù)報(bào)錯(cuò)信息,增加--limitBAMsortRAM 36949420170參數(shù)即可??梢栽O(shè)置數(shù)值大一點(diǎn)也沒問題
總結(jié):最新版bug少。
參考文獻(xiàn):
https://hbctraining.github.io/Intro-to-rnaseq-hpc-O2/lessons/03_alignment.html
https://academic.oup.com/bioinformatics/article/29/1/15/272537
如果你還在找其他比對(duì)軟件,可以點(diǎn)這里:http://www.itdecent.cn/p/bf0cd9bfa4b4
20210301修改補(bǔ)充
20200422修改補(bǔ)充