GATK AlleleList接口介绍
在 GATK(Genome Analysis Toolkit)中,AlleleList
接口是一个用来表示等位基因(alleles)列表的接口。Allele
是遗传学中用于表示某一特定基因座的不同形式的一个基本单位。AlleleList
接口定义了一些操作,使得处理和访问一组等位基因更加方便。
AlleleList
的实现类和继承接口
使用场景
AlleleList
及其实现类在 GATK 中主要用于表示和操作基因型数据中的等位基因集合。典型场景包括:
- 变异检测:在不同样本中检测和分析不同的等位基因时,需要管理多个等位基因的集合,这时候会用到
AlleleList
。 - 基因型计算:在计算样本的基因型时,可能需要迭代多个等位基因,并根据等位基因的组合进行计算。
通过 AlleleList
接口,GATK 提供了一个统一的方式来处理等位基因列表,增强了代码的可读性和模块化,使得等位基因的管理变得更加直观和高效。
AlleleList接口源码
package org.broadinstitute.hellbender.utils.genotyper;import htsjdk.variant.variantcontext.Allele;
import org.broadinstitute.hellbender.utils.Utils;import java.util.AbstractList;
import java.util.List;/*** Minimal interface for random access to a collection of Alleles.*/
//Note: Names in this interface are unusual because of name clash in a subclass.
// For example the name of AlleleList.alleleCount() cannot be simply size(), as would be usual,
// because {@link ReadLikelihoods} implements AlleleList and SampleList and then size() would be ambiguous.
public interface AlleleList<A extends Allele> {static <A extends Allele> AlleleList<A> newList(final List<A> alleles) {return new IndexedAlleleList<A>(alleles);}/*** Returns the number of alleles in this AlleleList.*/int numberOfAlleles();/*** Returns the index of the given Allele in this AlleleList.* Returns a negative number if the given allele is not present in this AlleleList.* @throws IllegalArgumentException if allele is null.*/int indexOfAllele(final Allele allele);/*** Returns the allele at the given index in this AlleleList.* @throws IllegalArgumentException if index is negative or equal* to or higher than the number of elements in this AlleleList {@link AlleleList#numberOfAlleles()}).