当前位置: 首页>>代码示例>>Java>>正文


Java Genotype.getExtendedAttribute方法代码示例

本文整理汇总了Java中htsjdk.variant.variantcontext.Genotype.getExtendedAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Genotype.getExtendedAttribute方法的具体用法?Java Genotype.getExtendedAttribute怎么用?Java Genotype.getExtendedAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.variant.variantcontext.Genotype的用法示例。


在下文中一共展示了Genotype.getExtendedAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseMantaPRSR

import htsjdk.variant.variantcontext.Genotype; //导入方法依赖的package包/类
private static List<String> parseMantaPRSR(final Genotype genotype) {
    String pr = (String) genotype.getExtendedAttribute("PR", "0,0");
    String sr = (String) genotype.getExtendedAttribute("SR", "0,0");
    return Stream.concat(Arrays.stream(pr.split(",")), Arrays.stream(sr.split(","))).collect(Collectors.toList());
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:6,代码来源:TSVOutput.java

示例2: parseOtherGenotypeFields

import htsjdk.variant.variantcontext.Genotype; //导入方法依赖的package包/类
private static boolean parseOtherGenotypeFields(String field, VariantContext vc,
    ListValue.Builder lvBuilder, Genotype g, VCFHeader header) {

  if (!g.hasAnyAttribute(field)) {
    return false;
  }

  final VCFFormatHeaderLine metaData = header.getFormatHeaderLine(field);
  if (metaData == null) {
    logger.log(Level.WARNING, String.format("Could not find matching VCF header field for "
        + "genotype field %s", field));
    return false;
  }

  VCFHeaderLineType type = metaData.getType();
  Object value = g.getExtendedAttribute(field);
  final int fieldCount = metaData.getCount(vc);
  if (fieldCount == 1) {
    lvBuilder.addValues(createTypedValue(type, value));
    return true;
  }

  if (!(value instanceof String)) {
    throw new IllegalStateException("received non-Flag genotype field as non-String type");
  }
  String[] valueArray = ((String) value).split(",");
  if (valueArray.length == 1) {
    throw new IllegalStateException(String.format("header indicating a count greater than 1 "
        + "with non-List type found for field %s",
        field));
  }

  boolean allFalse = true;
  for (int i = 0; i < valueArray.length; i++) {
    VCFHeaderLineType thisType = VCFHeaderLineType.String;
    if (!valueArray[i].equals(VCFConstants.MISSING_VALUE_v4)) {
      thisType = type;
      allFalse = false;
    }

    lvBuilder.addValues(createTypedValue(thisType, valueArray[i]));
  }
  // We only add the lvBuilder if there is at least one non-missing value
  return !allFalse;
}
 
开发者ID:verilylifesciences,项目名称:genomewarp,代码行数:46,代码来源:VcfToVariant.java


注:本文中的htsjdk.variant.variantcontext.Genotype.getExtendedAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。