查看原文
其他

star的twopassMode问题

jimmy 生信技能树 2022-06-07

如果只有一个样本,那么通常推荐加上这个 --twopassMode Basic参数,可以保证更精准的比对情况,也方便去找变异,其官方文档解释如下:

Annotated junctions will be included in both the 1st and 2nd passes. To run STAR 2-pass mapping for each sample separately, use --twopassMode Basic option. STAR will perform the 1st pass mapping, then it will automatically extract junctions, insert them into the genome index, and, finally, re-map all reads in the 2nd mapping pass.

但是如果有多个样本,每个样本都走 twopassMode 就浪费时间了,通常是把所有样本都比对一次,然后收集好他们产生的SJ.out.tab文件重新构建一次参考基因组的index,然后批量再比对一次。

  1. ~/biosoft/STAR/STAR-2.5.3a/bin/Linux_x86_64/STAR --runMode genomeGenerate \

  2. --genomeDir  second_index  \

  3. --genomeFastaFiles ~/reference/genome/mm10/mm10.fa \

  4. --sjdbGTFfile ~/reference/gtf/gencode/gencode.v25lift37.annotation.gtf \

  5. --sjdbFileChrStartEnd all_raw_star.tab --runThreadN 4

再次比对,代码是:

  1. $star --runThreadN  5  --genomeLoad  LoadAndKeep   --limitBAMsortRAM 13045315604 \

  2. --outSAMtype BAM SortedByCoordinate  --genomeDir $second_index  \

  3. --readFilesCommand zcat --readFilesIn  $fq1 $fq2 --outFileNamePrefix  ${sample}_

一个样本正常比对是:

  1. ## 测序数据如下:

  2. 6.7G Dec 12 15:55 clean.1.fq.gz

  3. 6.6G Dec 12 18:03 clean.2.fq.gz

  4. ## 比对代码如下,需要自行安装好软件已经参考基因组文件及索引

  5. $star --runThreadN  5 --genomeDir $hg19_star_index --readFilesCommand zcat --outSAMtype BAM  SortedByCoordinate \

  6. --readFilesIn  $fq1 $fq2 --outFileNamePrefix  ${sample}_star ## --alignEndsType EndToEnd

比对后的结果如下:

  1. 14G Dec 30 22:38 DH01_starAligned.sortedByCoord.out.bam

  2. 1.9K Dec 30 22:38 DH01_starLog.final.out

  3. 21K Dec 30 22:38 DH01_starLog.out

  4. 4.6K Dec 30 22:38 DH01_starLog.progress.out

  5. 8.1M Dec 30 22:38 DH01_starSJ.out.tab

比对耗时如下:

  1. Dec 30 21:43:03 ..... started STAR run

  2. Dec 30 21:43:03 ..... loading genome

  3. Dec 30 21:49:28 ..... started mapping

  4. Dec 30 22:27:57 ..... started sorting BAM

  5. Dec 30 22:38:20 ..... finished successfully

两次比对是:

  1. $star --runThreadN  5 --genomeDir $hg19_star_index --readFilesCommand zcat --outSAMtype BAM SortedByCoordinate  \

  2. --twopassMode Basic --outReadsUnmapped None --chimSegmentMin 12 \

  3. --chimJunctionOverhangMin 12  --alignSJDBoverhangMin 10  --alignMatesGapMax 100000 \

  4. --alignIntronMax 100000 --chimSegmentReadGapMax parameter 3  --alignSJstitchMismatchNmax 5 -1 5 5 \

  5. --readFilesIn  $fq1 $fq2 --outFileNamePrefix  ${sample}_star ## --alignEndsType EndToEnd

  6. ## 这样会比较耗费内存哦

耗费内存,并且耗时:

  1. Dec 31 09:33:17 ..... started STAR run

  2. Dec 31 09:33:17 ..... loading genome

  3. Dec 31 09:38:55 ..... started 1st pass mapping

  4. Dec 31 10:14:14 ..... finished 1st pass mapping

  5. Dec 31 10:14:29 ..... inserting junctions into the genome indices

  6. Dec 31 10:19:55 ..... started mapping

  7. Dec 31 11:24:54 ..... started sorting BAM

  8. Dec 31 11:31:11 ..... finished successfully

可以看到前面的基础比对才不到一个小时,这个两次比对消耗2个小时了。

得到的文件如下;

  1. 6.7G Dec 12 15:55 clean.1.fq.gz

  2. 6.6G Dec 12 18:03 clean.2.fq.gz

  3. 12G Dec 31 11:31 DH01_starAligned.sortedByCoord.out.bam

  4. 126M Dec 31 11:25 DH01_starChimeric.out.junction

  5. 874M Dec 31 11:25 DH01_starChimeric.out.sam

  6. 1.9K Dec 31 11:31 DH01_starLog.final.out

  7. 24K Dec 31 11:31 DH01_starLog.out

  8. 12K Dec 31 11:31 DH01_starLog.progress.out

  9. 8.0M Dec 31 11:31 DH01_starSJ.out.tab

我开启了 chimeric模式,所以可以看到输出文件也多了一点,主要是为了找fusion基因准备的。


您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存