---
title: GATK4 非Spark模式运行
description: 1. 使用PuTTY工具，以root用户登录服务器。
url: "https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/kunpenggatk_02_0013.html"
---

# GATK4 非Spark模式运行

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令，BWA中“index”对“fasta”文件构建索引。

```
bwa index -a bwtsw human_g1k_v37.fasta
```


3. 执行以下命令，BWA中“mapping”对“fastq”文件进行比对。

```
gatk CreateSequenceDictionary -R human_g1k_v37.fasta -O human_g1k_v37.dict
bwa mem -M -t 64 human_g1k_v37.fasta SRR742200_1.fastq SRR742200_2.fastq > SRR7.sam
```


4. 执行以下命令，Reorder对基因序列进行重新排序。

```
gatk ReorderSam -I SRR7.sam -O SRR7_reorder.bam -R human_g1k_v37.fasta
```


5. 执行以下命令，Sort对基因序列按照坐标顺序从大到小排序。

```
gatk SortSam -I SRR7_reorder.bam -O SRR7_sorted.bam --SORT_ORDER coordinate
```


6. 执行以下命令，Add head对基因序列进行加头处理。

```
gatk AddOrReplaceReadGroups -I SRR7_sorted.bam -O SRR7_addhead.bam -LB lib1 -PL illumina -PU unit1 -SM 20
```


7. 执行以下命令，Mark Duplicates对基因序列去重。

```
gatk MarkDuplicates -I SRR7_addhead.bam -M test.metric -O SRR7_markdup.bam
```


8. 执行以下命令，BQSR进行重新校准。

  a. 对“fasta”参考文件进行重新排列生成“fai”文件。

```
samtools faidx human_g1k_v37.fasta > human_g1k_v37.fai
```


  b. 给“vcf”文件加“index”。

```
gatk IndexFeatureFile -F dbsnp132_20101103.vcf
gatk BaseRecalibrator -I SRR7_markdup.bam --known-sites dbsnp132_20101103.vcf -O SRR7_bqsr.bam -R human_g1k_v37.fasta
gatk ApplyBQSR -bqsr SRR7_bqsr.bam -I SRR7_markdup.bam -O SRR7_aybqsr.bam
```


9. 执行以下命令，进行HaplortypeCaller变异流程检测。

```
gatk HaplotypeCaller -I SRR7_aybqsr.bam -O SRR7_raw.vcf -R human_g1k_v37.fasta
```
