常用转录组数据的比对工具有Tophat2、Hisat2和STAR。不同的工具有各自的优势,目前比较流行的工具是Hisat2和STAR,它俩的比对速度都比较快,STAR的uniquely mapping reads比例较高。
1. 安装
编译按装 https://github.com/alexdobin/STAR/
conda install star
2. 建立索引
STAR -h # 获取帮助
index_dir="/home/ref/star_index"
thread=50
genome_fasta="/home/ref/seq/hg38.fa"
genome_gtf="/home/ref/anno/hg38.refGene.gtf"
STAR --runThreadN ${thread} --runMode genomeGenerate --genomeDir ${index_dir} --genomeFastaFiles ${genome_fasta} --sjdbGTFfile ${genome_gtf} --sjdbOverhang 149
主要参数:
--runThreadN:线程数。
--runMode genomeGenerate:构建基因组索引。
--genomeDir:索引目录。(index_dir一定要是存在的文件夹,需提前建好)
--genomeFastaFiles:基因组文件。
--sjdbGTFfile:基因组注释文件。
--sjdbOverhang:reads长度减1。
3. 比对
## 进行 reads 比对
index_dir="/home/zheng/ref/star_index"
# bug:thread=50时,软件运行出错,出现临时文件不能写入的问题
thread=20
out_prefix="./star_align/test_sample"
seq1_file="test_1.fq.gz" #fq.gz格式
seq2_file="test_2.fq.gz"
STAR --twopassMode Basic --quantMode TranscriptomeSAM GeneCounts --runThreadN ${thread} --genomeDir ${index_dir} --alignIntronMin 20 --alignIntronMax 50000 --outSAMtype BAM SortedByCoordinate --sjdbOverhang 149 --outSAMattrRGline ID:sample SM:sample PL:ILLUMINA --outFilterMismatchNmax 2 --outSJfilterReads Unique --outSAMmultNmax 1 --outFileNamePrefix ${out_prefix} --outSAMmapqUnique 60 --readFilesCommand gunzip -c --readFilesIn ${seq1_file} ${seq2_file}
主要参数:
--twopassMode Basic:使用two-pass模式进行reads比对。简单来说就是先按索引进行第一次比对,而后把第一次比对发现的新剪切位点信息加入到索引中进行第二次比对。
--quantMode TranscriptomeSAM GeneCounts:将reads比对至转录本序列以及基因组位置,生产连个bam文件
--runThreadN:线程数。
--genomeDir:索引目录。
--alignIntronMin:最短的内含子长度。(根据GTF文件计算)
--alignIntronMax:最长的内含子长度。(根据GTF文件计算)
--outSAMtype BAM SortedByCoordinate:输出BAM文件并进行排序。
--sjdbOverhang:junction周围的序列长度,推荐100, 也可设置reads长度减1。
--outSAMattrRGline:ID代表样本ID,SM代表样本名称,PL为测序平台。在使用GATK进行SNP Calling时同一SM的样本可以合并在一起。
--outFilterMismatchNmax:比对时允许的最大错配数。
--outSJfilterReads Unique:对于跨越剪切位点的reads(junction reads),只考虑跨越唯一剪切位点的reads。
--outSAMmultNmax:每条reads输出比对结果的数量。
--outFileNamePrefix:输出文件前缀。
参考:
https://github.com/alexdobin/STAR
https://zhuanlan.zhihu.com/p/103606826
https://blog.51cto.com/u_14782715/5083001