在GATK(Genome Analysis Toolkit)中,Haplotype
类用于表示和处理基因组中的可能基因型(haplotype)。这个类是GATK中重要的数据结构之一,尤其在变异检测和基因组组装过程中具有关键作用。以下是Haplotype
类的设计和功能的详细介绍:
设计目标
Haplotype
类的设计旨在提供一个灵活的数据结构,以表示基因组中的不同基因型序列。这个类可以处理各种类型的变异,包括单核苷酸变异(SNPs)和插入/缺失变异(Indels),并支持对这些变异的详细分析。
主要功能
-
存储基因型序列:
Haplotype
类用于存储一个基因型的完整序列,包括参考序列和变异序列。- 它可以包含在给定位置的变异(SNPs、Indels)以及这些变异的上下文。
-
管理变异信息:
- 提供方法来获取和管理变异信息,例如变异的位置、类型以及影响。
- 支持对基因型序列的变异进行详细分析和注释。
-
变异比对:
- 支持与参考基因组的比对,以确定基因型序列的准确性和变异的性质。
- 提供方法来比较不同的
Haplotype
对象,以识别和分析基因型之间的差异。
-
序列操作:
- 提供对基因型序列的操作功能,例如插入、删除和替换变异。
- 支持对序列进行编辑和更新,以便于进一步的分析和处理。
-
质量评估:
- 包括质量评估功能,用于评估基因型的可靠性和准确性。
- 提供与变异质量相关的信息,如支持度、置信度等。
源码:
package org.broadinstitute.hellbender.utils.haplotype;
import htsjdk.samtools.Cigar;
import htsjdk.samtools.CigarElement;
import htsjdk.samtools.CigarOperator;
import htsjdk.samtools.util.Locatable;
import htsjdk.variant.variantcontext.Allele;
import htsjdk.variant.variantcontext.SimpleAllele;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.broadinstitute.hellbender.utils.SimpleInterval;
import org.broadinstitute.hellbender.utils.Utils;
import org.broadinstitute.hellbender.utils.read.AlignmentUtils;
import org.broadinstitute.hellbender.utils.read.CigarBuilder;
import org.broadinstitute.hellbender.utils.read.ReadUtils;
import java.util.Arrays;
import java.util.Comparator;
public class Haplotype extends SimpleAllele implements Locatable{
private static final long serialVersionUID = 1L;
/**
* Compares two haplotypes first by their lengths and then by lexicographic order of their bases.
*/
public static final Comparator<Haplotype> SIZE_AND_BASE_ORDER =
Comparator.comparingInt((Haplotype hap) -> hap.getBases().length)
.thenComparing(Allele::getBaseString);
private Locatable genomeLocation = null;
private EventMap eventMap = null;
private Cigar cigar;
private int alignmentStartHapwrtRef; //NOTE: this is the offset to a supposed array of reference bases held in memory and has nothing to do with start positions
private double score = Double.NaN;
/**
* see {@link org.broadinstitute.hellbender.tools.walkers.haplotypecaller.LongHomopolymerHaplotypeCollapsingEngine} for a description of the semantics of collapsing
*/
private boolean isCollapsed;
private int uniquenessValue; // uniquely diffrentiates the haplotype from others with same ref/bases.
// debug information for tracking kmer sizes used in graph construction for debug output
private int kmerSize = 0;
/**
* Main constructor