准备数据文件,GATK测试中需要两类数据文件:参考基因组数据文件(FASTA格式文件)和原始测序数据(FASTQ或BAM格式文件)。
在本测试算例中使用的数据文件如下:
human_g1k_v37.fasta
以下文件汇集的是目前几乎所有的公开人群变异数据集。
dbsnp132_20101103.vcf
变异数据集根据测序目的选择一到三种数据。
mkdir projectDir cd projectDir mkdir input
gzip -d SRR742200_1.fastq.gz gzip -d SRR742200_1.fastq.gz gzip -d human_g1k_v37.fasta.gz gzip -d dbsnp132_20101103.vcf.gz
faToTwoBit human_g1k_v37.fasta human_g1k_v37.fasta.2bit
cp human_g1k_v37.fasta human_g1k_v37.fasta.2bit SRR742200_1.fastq SRR742200_2.fastq dbsnp132_20101103.vcf input
bwa index -a bwtsw human_g1k_v37.fasta
回显显示如下信息:
[bwa_index] Pack FASTA... 27.89 sec [bwa_index] Construct BWT for the packed sequence... [BWTIncCreate] textLength=6203609478, availableWord=448508744 [BWTIncConstructFromPacked] 10 iterations done. 99999990 characters processed. [BWTIncConstructFromPacked] 20 iterations done. 199999990 characters processed. [BWTIncConstructFromPacked] 30 iterations done. 299999990 characters processed. [BWTIncConstructFromPacked] 40 iterations done. 399999990 characters processed. [BWTIncConstructFromPacked] 50 iterations done. 499999990 characters processed. [BWTIncConstructFromPacked] 60 iterations done. 599999990 characters processed. [BWTIncConstructFromPacked] 70 iterations done. 699999990 characters processed. [BWTIncConstructFromPacked] 80 iterations done. 799999990 characters processed. [BWTIncConstructFromPacked] 90 iterations done. 899999990 characters processed. <以下输出内容省略>
ls
gatk CreateSequenceDictionary -R human_g1k_v37.fasta -O human_g1k_v37.dict
回显显示如下红框中所示信息,表示执行完成。
生成的“dict”文件是为后面进行基因组的比对。
bwa mem -M -t 96 human_g1k_v37.fasta SRR742200_1.fastq SRR742200_2.fastq > SRR7.sam
参数 |
说明 |
---|---|
-t |
参数为线程数,一般与服务器核数一致。 |
回显显示如下红框中所示信息,表示执行完成。
BWA生成的“sam”文件默认按字典式排序,需要转换为按染色体组型进行排序,由picard工具完成,GATK4中已集成picard功能。
gatk ReorderSam -I SRR7.sam -O SRR7_reorder.bam -R human_g1k_v37.fasta
回显显示如下红框中所示信息,表示执行完成。
hadoop fs -mkdir /seqdata hadoop fs -put SRR7_reorder.bam /seqdata
hadoop fs -mkdir /sparklog hadoop fs -ls /
gatk SortReadFileSpark -I hdfs://$(hostname):9000/seqdata/SRR7_reorder.bam -O hdfs://$(hostname):9000/seqdata/SRR7_sorted.bam -- --spark-runner SPARK --spark-master spark://$(hostname):7077
回显显示如下红框中所示信息,表示执行完成。
hadoop fs -get /seqdata/SRR7_sorted.bam ./
ll
回显显示如下红框中所示信息,表示执行完成。
GATK2.0以上已不支持无头文件检测,该步骤可以在BWA比对时加-r进行,也可以使用GATK4中AddOrReplaceReadGroups工具完成。
gatk AddOrReplaceReadGroups -I SRR7_sorted.bam -O SRR7_header.bam -LB lib1 -PL illumina -PU unit1 -SM 20
回显显示如下红框中所示信息,表示执行完成。
hadoop fs -put SRR7_header.bam /seqdata
hadoop fs -ls /seqdata
gatk MarkDuplicatesSpark -I hdfs://$(hostname):9000/seqdata/SRR7_header.bam -O hdfs://$(hostname):9000/seqdata/SRR7_markdup.bam -- --spark-runner SPARK --spark-master spark://$(hostname):7077
回显显示如下红框中所示信息,表示执行完成。
hadoop fs -put dbsnp132_20101103.vcf /seqdata hadoop fs -put human_g1k_v37.fasta.2bit /seqdata hadoop fs -ls /seqdata
回显显示如红框中所示信息,表示执行完成。
gatk BQSRPipelineSpark -I hdfs://$(hostname):9000/seqdata/SRR7_markdup.bam -R hdfs://$(hostname):9000/seqdata/human_g1k_v37.fasta.2bit -O hdfs://$(hostname):9000/seqdata/SRR7_bqsr.bam --known-sites hdfs://$(hostname):9000/seqdata/dbsnp132_20101103.vcf --disable-sequence-dictionary-validation true -- --spark-runner SPARK --spark-master spark://$(hostname):7077
显示如下红框中所示信息表示执行完成。
gatk HaplotypeCallerSpark -R hdfs://$(hostname):9000/seqdata/human_g1k_v37.fasta.2bit -I hdfs://$(hostname):9000/seqdata/SRR7_bqsr.bam -O hdfs://$(hostname):9000/seqdata/SRR7.snp.raw.vcf -- --spark-runner SPARK --spark-master spark://$(hostname):7077
最终生成的数据信息如下所示。