本文整理汇总了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());
}
示例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;
}