GATK AlleleList接口介绍

ops/2024/9/20 3:57:24/ 标签: java, 生物信息学

在 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()}).*/A getAllele(final int index);/*** Returns <code>true</code> if this AlleleList contains the specified allele* and <code>false</code> otherwise.*/default boolean containsAllele(final Allele allele) {return indexOfAllele(allele) >= 0;}AlleleList<Allele> EMPTY_LIST = new AlleleList<Allele>() {@Overridepublic int numberOfAlleles() {return 0;}@Overridepublic int indexOfAllele(final Allele allele) {Utils.nonNull(allele);return -1;}@Overridepublic Allele getAllele(final int index) {throw new IllegalArgumentException("allele index is out of range");  //we know this without checking because it's an empty list}};/*** Returns an unmodifiable empty allele-list.* @param <A> the allele class.* @return never {@code null}.*/@SuppressWarnings("unchecked")static <A extends Allele> AlleleList<A> emptyAlleleList() {return (AlleleList<A>) EMPTY_LIST;}/*** Checks whether two allele lists are in fact the same.* @param first one list to compare.* @param second another list to compare.** @throws IllegalArgumentException if if either list is {@code null}.** @return {@code true} iff both list are equal.*/static <A extends Allele> boolean equals(final AlleleList<A> first, final AlleleList<A> second) {if (first == null || second == null) {throw new IllegalArgumentException("no null list allowed");}final int alleleCount = first.numberOfAlleles();if (alleleCount != second.numberOfAlleles()) {return false;}for (int i = 0; i < alleleCount; i++) {final A firstSample = first.getAllele(i);Utils.nonNull(firstSample, "no null samples allowed in sample-lists: first list at " + i);final A secondSample = second.getAllele(i);Utils.nonNull(secondSample,"no null samples allowed in sample-list: second list at " + i);if (!firstSample.equals(secondSample)) {return false;}}return true;}/*** Resolves the index of the reference allele in an allele-list.** <p>*     If there is no reference allele, it returns -1. If there is more than one reference allele,*     it returns the first occurrence (lowest index).* </p>*** @throws IllegalArgumentException if {@code list} is {@code null}.** @return -1 if there is no reference allele, or a values in [0,{@code list.alleleCount()}).*/default int indexOfReference() {final int alleleCount = this.numberOfAlleles();for (int i = 0; i < alleleCount; i++) {if (this.getAllele(i).isReference()) {return i;}}return -1;}/*** Returns a {@link List} unmodifiable view of this allele-list** @return never {@code null}.*/default List<A> asListOfAlleles() {return new AbstractList<A>() {@Overridepublic A get(final int index) {return AlleleList.this.getAllele(index);}@Overridepublic int size() {return AlleleList.this.numberOfAlleles();}};}/*** Returns a permutation between two allele lists.* @param target the target allele list.** @throws IllegalArgumentException if {@code target} is {@code null}, or* elements in {@code target} is not contained in {@code this}** @return never {@code null}*/default AlleleListPermutation<A> permutation(final AlleleList<A> target) {if (equals(this, target)) {return new NonPermutation<>(this);} else {return new ActualPermutation<>(this, target);}}/*** This is the identity permutation.*/final class NonPermutation<A extends Allele> implements AlleleListPermutation<A> {private final AlleleList<A> list;NonPermutation(final AlleleList<A> original) {list = original;}@Overridepublic boolean isPartial() {return false;}@Overridepublic boolean isNonPermuted() {return true;}@Overridepublic int toIndex(final int fromIndex) {return fromIndex;}@Overridepublic int fromIndex(final int toIndex) {return toIndex;}@Overridepublic boolean isKept(final int fromIndex) { return true; }@Overridepublic int fromSize() {return list.numberOfAlleles();}@Overridepublic int toSize() {return list.numberOfAlleles();}@Overridepublic List<A> fromList() {return list.asListOfAlleles();}@Overridepublic List<A> toList() {return list.asListOfAlleles();}@Overridepublic int numberOfAlleles() {return list.numberOfAlleles();}@Overridepublic int indexOfAllele(final Allele allele) {return list.indexOfAllele(allele);}@Overridepublic A getAllele(final int index) {return list.getAllele(index);}}final class ActualPermutation<A extends Allele> implements AlleleListPermutation<A> {private final AlleleList<A> from;private final AlleleList<A> to;private final int[] fromIndex;private final boolean[] keptFromIndices;private final boolean nonPermuted;private final boolean isPartial;private ActualPermutation(final AlleleList<A> original, final AlleleList<A> target) {this.from = original;this.to = target;keptFromIndices = new boolean[original.numberOfAlleles()];final int toSize = target.numberOfAlleles();final int fromSize = original.numberOfAlleles();if (fromSize < toSize) {throw new IllegalArgumentException("target allele list is not a permutation of the original allele list");}fromIndex = new int[toSize];boolean nonPermuted = fromSize == toSize;this.isPartial = !nonPermuted;for (int i = 0; i < toSize; i++) {final int originalIndex = original.indexOfAllele(target.getAllele(i));if (originalIndex < 0) {throw new IllegalArgumentException("target allele list is not a permutation of the original allele list");}keptFromIndices[originalIndex] = true;fromIndex[i] = originalIndex;nonPermuted &= originalIndex == i;}this.nonPermuted = nonPermuted;}@Overridepublic boolean isPartial() {return isPartial;}@Overridepublic boolean isNonPermuted() {return nonPermuted;}@Overridepublic int toIndex(final int fromIndex) {return to.indexOfAllele(from.getAllele(fromIndex));}@Overridepublic int fromIndex(final int toIndex) {return fromIndex[toIndex];}@Overridepublic boolean isKept(final int fromIndex) {return keptFromIndices[fromIndex];}@Overridepublic int fromSize() {return from.numberOfAlleles();}@Overridepublic int toSize() {return to.numberOfAlleles();}@Overridepublic List<A> fromList() {return from.asListOfAlleles();}@Overridepublic List<A> toList() {return to.asListOfAlleles();}@Overridepublic int numberOfAlleles() {return to.numberOfAlleles();}@Overridepublic int indexOfAllele(final Allele allele) {return to.indexOfAllele(allele);}@Overridepublic A getAllele(final int index) {return to.getAllele(index);}}
}


http://www.ppmy.cn/ops/99222.html

相关文章

独立站PrestaShop安装

独立站PrestaShop安装 独立站PrestaShop安装系统需求下载PrestaShop浏览器下载命令行下载 解压PrestaShop创建数据库移动PrestaShop源码到web目录composer安装依赖包nginx配置访问域名进入安装页面选择语言许可协议系统兼容性店铺信息Content of your store系统配置数据库店铺安…

二十三设计模式速记

文字版 Java设计模式通常被分为三大类&#xff1a;创建型模式&#xff08;Creational Patterns&#xff09;、结构型模式&#xff08;Structural Patterns&#xff09;和行为型模式&#xff08;Behavioral Patterns&#xff09;。每种类型包含若干种具体的设计模式。 创建型模…

unity的 Assembly definitions- asmdef文件

手册地址》 似乎可以玩的东西有些&#xff0c;比如unsafe code. 脚本的 dll 管理. 手册有点长&#xff0c;慢慢研究

常见的视频监控RTSP RTMP 流媒体协议及开发测试工具

一 流媒体协议 RTMP (Real-Time Messaging Protocol): 封装格式&#xff1a;FLV 或 MP4协议&#xff1a;TCP端口&#xff1a;默认2200厂家&#xff1a;Adobe Systems特点&#xff1a;实时性强&#xff0c;延迟低&#xff0c;支持服务器端的推流和拉流。应用&#xff1a;主要用…

RK3588 技术分享 | 在Android系统中使用NPU实现Yolov5分类检测-迅为电子

随着人工智能和大数据时代的到来&#xff0c;传统嵌入式处理器中的CPU和GPU逐渐无法满足日益增长的深度学习需求。为了应对这一挑战&#xff0c;在一些高端处理器中&#xff0c;NPU&#xff08;神经网络处理单元&#xff09;也被集成到了处理器里。NPU的出现不仅减轻了CPU和GPU…

C语言中的预处理详解

1. 预定义符号 C语⾔设置了⼀些预定义符号&#xff0c;可以直接使⽤&#xff0c;预定义符号也是在预处理期间处理的。 举个例⼦&#xff1a; printf("file:%s line:%d\n", __FILE__, __LINE__); 2. #define 定义常量 基本语法&#xff1a; #define name stuff 举个例…

getchar(),putchar(),EOF的详细解释

文章目录 getchar(),putchar(),EOF的意义和作用一、相关函数putchar( )getchar&#xff08;&#xff09; 二、EOF 的值三、总结 getchar(),putchar(),EOF的意义和作用 在 C 语言中&#xff0c;EOF 是 End Of File 的缩写&#xff0c;即文件结束标志。 在读取文件时&#xff0…

电路笔记(PCB):数字滤波电路的拉普拉斯变换与零极点分析

拉普拉斯变换基础 拉普拉斯变换 拉普拉斯变换是一种积分变换&#xff0c;用于将一个时间域的函数&#xff08;通常是信号或系统的响应&#xff09;转换为一个复频域的函数。这种变换可以简化许多微分方程和线性系统分析的过程。其定义为&#xff1a; L { f ( t ) } F ( s )…

如何优雅的实现CRUD,包含微信小程序,API,HTML的表单(一)

前言 在开发实际项目中&#xff0c;其实CRUD的代码量并不小&#xff0c;最近要做一个小程序项目&#xff0c;由于涉及表单的东西比较多&#xff0c;就萌生了一个想法&#xff0c;小程序的写法不是和VUE类似&#xff0c;就是数据绑定&#xff0c;模块么&#xff01;那就来一个动…

高并发集群饿了么后端的登录模块

高并发集群饿了么后端的登录模块 1.数据库 非交互式python&#xff1a; 非交互式: 2.数据库的负载均衡&#xff1a;阿里巴巴的mycat 修改配置文件 /usr/local/mycat/conf/server.xml :对外的账号 密码 数据库 /usr/local/mycat/conf/schema.xml 如果出现启动异常&…

Ruby宝石光芒:探索SEO优化的瑰宝工具与库

标题&#xff1a;“Ruby宝石光芒&#xff1a;探索SEO优化的瑰宝工具与库” 在数字营销的海洋中&#xff0c;搜索引擎优化&#xff08;SEO&#xff09;是确保网站能够吸引目标受众的关键策略之一。对于使用Ruby语言的开发者来说&#xff0c;有一系列工具和库可以帮助他们提升网…

鸿蒙(API 12 Beta3版)【使用ImagePacker完成图片编码】图片开发指导

图片编码指将PixelMap编码成不同格式的存档图片&#xff08;当前仅支持打包为JPEG、WebP 和 png 格式&#xff09;&#xff0c;用于后续处理&#xff0c;如保存、传输等。 开发步骤 图片编码进文件流 创建图像编码ImagePacker对象。 // 导入相关模块包 import { image } fr…

Matlab:使用OpenMP

使用OpenMP多线程 参考资料 Using OpenMP in MATLAB Recipe and Binaries of MUMPS for MATLAB with OpenMP Support

ansible模块

tags模块 可以给任务定义标签&#xff0c;可以根据标签来运行指定的任务 [roottest41 opt]# vim test1.yaml #标签的类型 #always&#xff1a;设定标签名为always&#xff0c;除非指定跳过这个标签&#xff0c;否则该任务始终会运行&#xff0c;即使指定了标签还会运行 #never…

后端开发刷题 | 合并k个已排序的链表

描述 合并 k 个升序的链表并将结果作为一个升序的链表返回其头节点。 数据范围&#xff1a;节点总数 0≤n≤5000&#xff0c;每个节点的val满足 ∣val∣<1000 要求&#xff1a;时间复杂度 O(nlogn) 示例1 输入&#xff1a; [{1,2,3},{4,5,6,7}] 返回值&#xff1a; …

GO-REDIS的一些高级用法

1. 前言 说到Golang的Redis库&#xff0c;用到最多的恐怕是 redigo 和 go-redis。其中 redigo 不支持对集群的访问。 本文想聊聊go-redis 2个高级用法。 2. 开启对Cluster中Slave Node的访问 在一个负载比较高的Redis Cluster中&#xff0c;如果允许对slave节点进行读操作将…

指针编译后

指针编译后 指针变量解引用 指针变量 普通变量存数字 指针变量存一个地址&#xff0c;在riscv下表现为s0-x&#xff0c;即以帧指针为偏移&#xff0c;在栈上存一个地址值 解引用 行为表现为&#xff0c;会把指针变量的地址加载到寄存器&#xff0c;在去加载这个地址的所在位…

数据结构----红黑树

小编会一直更新数据结构相关方面的知识&#xff0c;使用的语言是Java&#xff0c;但是其中的逻辑和思路并不影响&#xff0c;如果感兴趣可以关注合集。 希望大家看完之后可以自己去手敲实现一遍&#xff0c;同时在最后我也列出一些基本和经典的题目&#xff0c;可以尝试做一下。…

京东-接口php

如果要在 PHP 中使用京东的官方接口&#xff0c;你可以通过京东宙斯开放平台来实现。以下是一般的步骤&#xff1a; 一、注册成为开发者 访问京东宙斯开放平台数据接口企业级数据服务商注册账号并登录&#xff0c;然后申请成为开发者。 二、创建应用 在开放平台上创建应用&…

stm32f1xx中的几个ID

目录 一、ID的作用二、ID的说明产品唯一身份标识MCU ID codeJTAG IDJEDEC-106 ID 三、自定义ID 一、ID的作用 在物联网系统中产品的ID不可或缺&#xff0c;产品组网后就需要一个身份去让网里其它的设备去识别自己&#xff1b; ID表示的含义可能多种多样&#xff0c;如一个生产批…