当前位置: 首页 > news >正文

htsjdk库Genotype及相关类介绍

在 HTSJDK 库中,处理基因型的主要类包括 GenotypeFastGenotypeGenotypeBuilder 以及相关的类和接口。以下是这些类和接口的详细介绍:

Genotype 类

主要功能
  • 表示基因型Genotype 类用于表示个体在特定变异位置上的基因型。基因型是对个体在变异位置上的等位基因组合的描述。
  • 包含样本信息:它包括与样本相关的基因型信息,例如基因型的等位基因、深度、质量等。
源码:
/*
* Copyright (c) 2012 The Broad Institute
* 
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* 
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/package htsjdk.variant.variantcontext;import htsjdk.tribble.util.ParsingUtils;
import htsjdk.variant.vcf.VCFConstants;
import htsjdk.variant.vcf.VCFUtils;import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;/*** This class encompasses all the basic information about a genotype.  It is immutable.** @author Mark DePristo*/
public abstract class Genotype implements Comparable<Genotype>, Serializable {public static final long serialVersionUID = 1L;/*** A list of genotype field keys corresponding to values we* manage inline in the Genotype object.  They must not appear in the* extended attributes map*/public final static Collection<String> PRIMARY_KEYS = Arrays.asList(VCFConstants.GENOTYPE_FILTER_KEY,VCFConstants.GENOTYPE_KEY,VCFConstants.GENOTYPE_QUALITY_KEY,VCFConstants.DEPTH_KEY,VCFConstants.GENOTYPE_ALLELE_DEPTHS,VCFConstants.GENOTYPE_PL_KEY);public final static String PHASED_ALLELE_SEPARATOR = "|";public final static String UNPHASED_ALLELE_SEPARATOR = "/";private final String sampleName;private GenotypeType type = null;private final String filters;protected Genotype(final String sampleName, final String filters) {this.sampleName = sampleName;this.filters = filters == null || filters.isEmpty() ? null : filters;}/*** @return the alleles for this genotype.  Cannot be null.  May be empty*/public abstract List<Allele> getAlleles();/*** @return true if any allele is REF*/public boolean hasRefAllele() {return getAlleles().stream().anyMatch(A->A.isReference());};/*** @return true if any allele is ALT, (NO_CALL are ignored)*/public boolean hasAltAllele() {return getAlleles().stream().anyMatch(A->!(A.isReference() || A.isNoCall()));};/*** Returns how many times allele appears in this genotype object?** @param allele* @return a value &gt;= 0 indicating how many times the allele occurred in this sample's genotype*/public int countAllele(final Allele allele) {int c = 0;for ( final Allele a : getAlleles() )if ( a.equals(allele) )c++;return c;}/*** Get the ith allele in this genotype** @param i the ith allele, must be &lt; the ploidy, starting with 0* @return the allele at position i, which cannot be null*/public abstract Allele getAllele(int i);/*** Are the alleles phased w.r.t. the global phasing system?** @return true if yes*/public abstract boolean isPhased();/*** What is the ploidy of this sample?** @return the ploidy of this genotype.  0 if the site is no-called.*/public int getPloidy() {return getAlleles().size();}/*** @return the sequencing depth of this sample, or -1 if this value is missing*/public abstract int getDP();/*** @return the count of reads, one for each allele in the surrounding Variant context,*      matching the corresponding allele, or null if this value is missing.  MUST*      NOT BE MODIFIED!*/public abstract int[] getAD();/*** Returns the name associated with this sample.** @return a non-null String*/public String getSampleName() {return sampleName;}/*** Returns a phred-scaled quality score, or -1 if none is available* @return*/public abstract int getGQ();/*** Does the PL field have a value?* @return true if there's a PL field value*/public boolean hasPL() {return getPL() != null;}/*** Does the AD field have a value?* @return true if there's a AD field value*/public boolean hasAD() {return getAD() != null;}/*** Does the GQ field have a value?* @return true if there's a GQ field value*/public boolean hasGQ() {return getGQ() != -1;}/*** Does the DP field have a value?* @return true if there's a DP field value*/public boolean hasDP() {return getDP() != -1;}// ---------------------------------------------------------------------------------------------------------//// The type of this genotype//// ---------------------------------------------------------------------------------------------------------/*** @return the high-level type of this sample's genotype*/public GenotypeType getType() {if ( type == null ) {type = determineType();}return type;}/*** Internal code to determine the type of the genotype from the alleles vector* @return the type*/protected GenotypeType determineType() {// TODO -- this code is slow and could be optimized for the diploid casefinal List<Allele> alleles = getAlleles();if ( alleles.isEmpty() ) {return GenotypeType.UNAVAILABLE;}boolean sawNoCall = false, sawMultipleAlleles = false;Allele firstCallAllele = null;for ( int i = 0; i < alleles.size(); i++ ) {final Allele allele = alleles.get(i);if ( allele.isNoCall() ) {sawNoCall = true;} else if ( firstCallAllele == null ) {firstCallAllele = allele;} else if ( !allele.equals(firstCallAllele) )sawMultipleAlleles = true;}if ( sawNoCall ) {if ( firstCallAllele == null )return GenotypeType.NO_CALL;return GenotypeType.MIXED;}if ( firstCallAllele == null )throw new IllegalStateException("BUG: there are no alleles present in this genotype but the alleles list is not null");return sawMultipleAlleles ? GenotypeType.HET : firstCallAllele.isReference() ? GenotypeType.HOM_REF : GenotypeType.HOM_VAR;}/*** @return true if all observed alleles are the same (regardless of whether they are ref or alt); if any alleles are no-calls, this method will return false.*/public boolean isHom()    { return isHomRef() || isHomVar(); }/*** @return true if all observed alleles are ref; if any alleles are no-calls, this method will return false.*/public boolean isHomRef() { return getType() == GenotypeType.HOM_REF; }/*** @return true if all observed alleles are alt; if any alleles are no-calls, this method will return false.*/public boolean isHomVar() { return getType() == GenotypeType.HOM_VAR; }/*** @return true if we're het (observed alleles differ); if the ploidy is less than 2 or if any alleles are no-calls, this method will return false.*/public boolean isHet() { return getType() == GenotypeType.HET; }/*** @return true if we're het (observed alleles differ) and neither allele is reference; if the ploidy is less than 2 or if any alleles are no-calls, this method will return false.*/public boolean isHetNonRef() { return (getType() == GenotypeType.HET && getAllele(0).isNonReference() && getAllele(1).isNonReference()); }/*** @return true if this genotype is not actually a genotype but a "no call" (e.g

相关文章:

htsjdk库Genotype及相关类介绍

在 HTSJDK 库中,处理基因型的主要类包括 Genotype、FastGenotype、GenotypeBuilder 以及相关的类和接口。以下是这些类和接口的详细介绍: Genotype 类 主要功能 表示基因型:Genotype 类用于表示个体在特定变异位置上的基因型。基因型是对个体在变异位置上的等位基因组合的…...

C++ 最短路(spfa) 洛谷

拉近距离 题目背景 我是源点&#xff0c;你是终点。我们之间有负权环。 ——小明 题目描述 在小明和小红的生活中&#xff0c;有 N 个关键的节点。有 M 个事件&#xff0c;记为一个三元组 (Si,Ti,Wi)&#xff0c;表示从节点 Si​ 有一个事件可以转移到 Ti​&#xff0c;事件…...

MySQL的数据类型

文章目录 数据类型分类整型bit类型浮点类型字符串类型charvarchar 日期和时间类型enum和set find_ in_ set 数据类型分类 整型 在MySQL中&#xff0c;整型可以指定是有符号的和无符号的&#xff0c;默认是有符号的。 可以通过UNSIGNED来说明某个字段是无符号的。 在MySQL中如…...

xss漏洞(四,xss常见类型)

本文仅作为学习参考使用&#xff0c;本文作者对任何使用本文进行渗透攻击破坏不负任何责任。 前言&#xff1a; 1&#xff0c;本文基于dvwa靶场以及PHP study进行操作&#xff0c;靶场具体搭建参考上一篇&#xff1a; xss漏洞&#xff08;二&#xff0c;xss靶场搭建以及简单…...

繁简之争:为什么手机芯片都是 ARM

RISC 和 CISC 指令集 之前的文章《揭秘 CPU 是如何执行计算机指令的》中说到&#xff0c;如果从软件的角度来讲&#xff0c;CPU 就是一个执行各种计算机指令&#xff08;Instruction Code&#xff09;的逻辑机器。 计算机指令集是计算机指令的集合&#xff0c;包括各种类型的…...

【nnUNetv2进阶】十九、nnUNetv2 使用ResidualEncoder训练模型

nnunet使用及改进教程。 【nnUNetv2实践】一、nnUNetv2安装 【nnUNetv2实践】二、nnUNetv2快速入门-训练验证推理集成一条龙教程 【nnUNetv2进阶】三、nnUNetv2 自定义网络-发paper必会-CSDN博客 其他网络改进参考: 【nnUNetv2进阶】四、nnUNetv2 魔改网络-小试牛刀-加入…...

Unity3D ShaderGraph 场景扫描光效果实现详解

引言 在Unity3D游戏开发中&#xff0c;创建吸引人的视觉效果是提升游戏沉浸感的关键之一。场景扫描光效果&#xff0c;作为一种动态且富有表现力的视觉元素&#xff0c;能够为游戏场景增添不少亮点。通过Unity的ShaderGraph工具&#xff0c;我们可以轻松地实现这种效果&#x…...

JS中运算符优先级

优先级顺序从高到低为&#xff1a; 括号 ()成员访问 . 和 函数调用 ()一元运算符 !、、-、~乘法 *、除法 /、取余 %加法 、减法 -位移运算符 <<、>>、>>>比较运算符 <、<、>、>等于 、不等于 !、严格等于 、严格不等于 !位与 &位异或 ^位…...

分享6款有助于写论文能用到的软件app!

在学术写作中&#xff0c;选择合适的软件和工具可以大大提高效率和质量。以下是六款有助于写论文的软件app推荐&#xff0c;其中特别重点介绍千笔-AIPassPaPer这款AI原创论文写作平台。 1. 千笔-AIPassPaPer 千笔-AIPassPaPer是一款功能全面且高效的AI原创论文写作平台。它能…...

Python图形验证码的识别:一步步详解

在Web开发和自动化测试中&#xff0c;图形验证码的识别是一项常见且重要的任务。图形验证码作为防止自动化攻击的一种手段&#xff0c;通过随机生成包含字符或数字的图片来增加用户验证的难度。然而&#xff0c;对于需要自动化处理的场景&#xff0c;如Web自动化测试或爬虫&…...

Jenkins未授权访问漏洞

Jenkins未授权访问漏洞 默认情况下 Jenkins面板中用户可以选择执行脚本界面来操作一些系统层命令&#xff0c;攻击者可通过未授权访问漏洞或者暴力破解用户密码等进入后台管理服务&#xff0c;通过脚本执行界面从而获取服务器权限。 一、使用以下fofa语法进行产品搜索 port&…...

什么情况下跑代码内存才会爆

内存爆掉&#xff08;即内存溢出&#xff09;通常是由于代码在处理数据或计算时消耗了过多的内存资源&#xff0c;导致系统内存不足。以下是一些常见场景和代码示例&#xff0c;可能会导致内存爆掉&#xff1a; 1. 超大数据集加载: 加载非常大的数据集到内存中&#xff08;特…...

基于arcpro3.0.2运行报错问题:不能加载文件System.Text.Encoding.CodePages, Version=8.0.0.0

基于arcpro3.0.2运行报错问题:不能加载文件System.Text.Encoding.CodePages, Version8.0.0.0 报错问题描述&#xff1a; 基于arcpro3.0.2运行报错问题: Could not load file or assembly System.Text.Encoding.CodePages, Version8.0.0.0 解决办法&#xff1a; 重新拷贝打包生…...

elk+filebeat+kafka集群部署

实验框架图 192.168.124.10 es1 192.168.124.20 es2 192.168.124.30 losgtash kibana 192.168.124.50 MySQL nginx httpd 上一篇做完es1和es2以及192.168.124.30的部署 在192.168.124.50做配置部署 开启MySQL、nginx、http 因为nginx和http默认端口为80&#xff0…...

C++生化危机1.5源码

代码特别长&#xff0c;如若报错&#xff0c;请把1e9改成1000000000。 //1.5.12 #include <conio.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> #include <direct.h> i…...

RMAN-06618不同版本之间RMAN无法连接

RMAN Active Duplicate Between Two Oracle Versions (Doc ID 2346507.1)​编辑To Bottom In this Document Goal Solution References APPLIES TO: Oracle Database Cloud Schema Service - Version N/A and later Oracle Database Exadata Cloud Machine - Version N/A and…...

鸿蒙HarmonyOS开发:多种内置弹窗及自定义弹窗的详细使用指南

文章目录 一、消息提示框&#xff08;showToast&#xff09;1、导入模块2、语法3、参数4、示例5、效果 二、对话框&#xff08;showDialog&#xff09;1、导入模块2、语法3、参数4、示例5、效果 三、警告弹窗&#xff08;AlertDialog&#xff09;1、语法2、参数3、AlertDialogP…...

Python文件

一、文件的基本概念 1.1 文件类型 文件类型主要分为文本文件和二进制文件。文本文件是由一组特定编码的字符构成的文件&#xff0c;可以由某种文本编辑器对内容进行识别、处理、修改等操作。二进制文件由二进制数“0”和“1”构成&#xff0c;没有统一的字符编码&#xff0c;…...

超越标注:合成数据引领下的文本嵌入技术革新

论文:https://arxiv.org/pdf/2401.00368代码:https://github.com/microsoft/unilm/tree/master/e5机构:微软领域:嵌入模型发表:BAAI 2024这篇论文的标题是《Improving Text Embeddings with Large Language Models》,由微软公司的Liang Wang, Nan Yang, Xiaolong Huang, …...

IT运维中,如何快速进行故障排查?(以银行APP交易故障为例)

一、事件背景 正值"五一"黄金周旅游高峰期&#xff0c;某城商行的手机APP突然出现大面积交易失败和严重卡顿现象。据初步统计&#xff0c;从上午10点开始APP的交易成功率从正常的99%骤降至75%左右&#xff0c;用户反馈的交易失败投诉量在短短2小时内激增了500%。与此…...

Xshell远程连接Kali(默认 | 私钥)Note版

前言:xshell远程连接&#xff0c;私钥连接和常规默认连接 任务一 开启ssh服务 service ssh status //查看ssh服务状态 service ssh start //开启ssh服务 update-rc.d ssh enable //开启自启动ssh服务 任务二 修改配置文件 vi /etc/ssh/ssh_config //第一…...

系统设计 --- MongoDB亿级数据查询优化策略

系统设计 --- MongoDB亿级数据查询分表策略 背景Solution --- 分表 背景 使用audit log实现Audi Trail功能 Audit Trail范围: 六个月数据量: 每秒5-7条audi log&#xff0c;共计7千万 – 1亿条数据需要实现全文检索按照时间倒序因为license问题&#xff0c;不能使用ELK只能使用…...

【快手拥抱开源】通过快手团队开源的 KwaiCoder-AutoThink-preview 解锁大语言模型的潜力

引言&#xff1a; 在人工智能快速发展的浪潮中&#xff0c;快手Kwaipilot团队推出的 KwaiCoder-AutoThink-preview 具有里程碑意义——这是首个公开的AutoThink大语言模型&#xff08;LLM&#xff09;。该模型代表着该领域的重大突破&#xff0c;通过独特方式融合思考与非思考…...

CocosCreator 之 JavaScript/TypeScript和Java的相互交互

引擎版本&#xff1a; 3.8.1 语言&#xff1a; JavaScript/TypeScript、C、Java 环境&#xff1a;Window 参考&#xff1a;Java原生反射机制 您好&#xff0c;我是鹤九日&#xff01; 回顾 在上篇文章中&#xff1a;CocosCreator Android项目接入UnityAds 广告SDK。 我们简单讲…...

TRS收益互换:跨境资本流动的金融创新工具与系统化解决方案

一、TRS收益互换的本质与业务逻辑 &#xff08;一&#xff09;概念解析 TRS&#xff08;Total Return Swap&#xff09;收益互换是一种金融衍生工具&#xff0c;指交易双方约定在未来一定期限内&#xff0c;基于特定资产或指数的表现进行现金流交换的协议。其核心特征包括&am…...

C# 类和继承(抽象类)

抽象类 抽象类是指设计为被继承的类。抽象类只能被用作其他类的基类。 不能创建抽象类的实例。抽象类使用abstract修饰符声明。 抽象类可以包含抽象成员或普通的非抽象成员。抽象类的成员可以是抽象成员和普通带 实现的成员的任意组合。抽象类自己可以派生自另一个抽象类。例…...

【决胜公务员考试】求职OMG——见面课测验1

2025最新版&#xff01;&#xff01;&#xff01;6.8截至答题&#xff0c;大家注意呀&#xff01; 博主码字不易点个关注吧,祝期末顺利~~ 1.单选题(2分) 下列说法错误的是:&#xff08; B &#xff09; A.选调生属于公务员系统 B.公务员属于事业编 C.选调生有基层锻炼的要求 D…...

成都鼎讯硬核科技!雷达目标与干扰模拟器,以卓越性能制胜电磁频谱战

在现代战争中&#xff0c;电磁频谱已成为继陆、海、空、天之后的 “第五维战场”&#xff0c;雷达作为电磁频谱领域的关键装备&#xff0c;其干扰与抗干扰能力的较量&#xff0c;直接影响着战争的胜负走向。由成都鼎讯科技匠心打造的雷达目标与干扰模拟器&#xff0c;凭借数字射…...

【C++从零实现Json-Rpc框架】第六弹 —— 服务端模块划分

一、项目背景回顾 前五弹完成了Json-Rpc协议解析、请求处理、客户端调用等基础模块搭建。 本弹重点聚焦于服务端的模块划分与架构设计&#xff0c;提升代码结构的可维护性与扩展性。 二、服务端模块设计目标 高内聚低耦合&#xff1a;各模块职责清晰&#xff0c;便于独立开发…...

用机器学习破解新能源领域的“弃风”难题

音乐发烧友深有体会&#xff0c;玩音乐的本质就是玩电网。火电声音偏暖&#xff0c;水电偏冷&#xff0c;风电偏空旷。至于太阳能发的电&#xff0c;则略显朦胧和单薄。 不知你是否有感觉&#xff0c;近两年家里的音响声音越来越冷&#xff0c;听起来越来越单薄&#xff1f; —…...