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


Java VCFHeaderLineType.Flag方法代码示例

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


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

示例1: checkType

import htsjdk.variant.vcf.VCFHeaderLineType; //导入方法依赖的package包/类
public static VCFHeaderLineType checkType(String type) {
	type = type.trim().toLowerCase();
	if(type.equals("integer")) {
		return VCFHeaderLineType.Integer;
	} else if(type.equals("float")) {
		return VCFHeaderLineType.Float;
	} else if(type.equals("string")) {
		return VCFHeaderLineType.String;
	} else if(type.equals("character")) {
		return VCFHeaderLineType.Character;
	} else if(type.equals("flag")) {
		return VCFHeaderLineType.Flag;
	} else {
		throw new IllegalArgumentException(ErrorMsg.VU_LINE_TYPE_ERR);
	}
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:17,代码来源:VannoUtils.java

示例2: getFieldsValBED

import htsjdk.variant.vcf.VCFHeaderLineType; //导入方法依赖的package包/类
public void getFieldsValBED(NodeWithRefAlt query, NodeWithRefAlt db, boolean forceOverlap) {
	String val, name;
	AnnoFieldBean_bak field;

	for (String key : keys) {
		field = fields.get(key);
		val = db.colToValMap.get(bedFieldsMap.get(key) - 1);
		if(val == null) throw new IllegalArgumentException("Can't find val for column " + bedFieldsMap.get(key));
		
		name = field.getOutName() != null ? field.getOutName() : field.getName();
		if(field.getVcfInfo().getType() == VCFHeaderLineType.Flag) {
			results.add(new AnnNode(name, name));
		} else {
			if(forceOverlap) results.add(new AnnNode(name, field.getValForForceOverlap(val, query, db)));
			else results.add(new AnnNode(name, field.getVal(val, query, db)));
		}
	}
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:19,代码来源:AnnoDBBean_bak.java

示例3: createTypedValue

import htsjdk.variant.vcf.VCFHeaderLineType; //导入方法依赖的package包/类
private static Value createTypedValue(VCFHeaderLineType type, Object value) {
  if (type == VCFHeaderLineType.Flag) {
    return Value.newBuilder().setBoolValue((Boolean) value).build();
  }

  // Booleans are given as Boolean objects. Strangely, Floats and Integers
  // are given as String objects by HTSJDK.
  if (!(value instanceof String)) {
    throw new IllegalStateException("Received non-Boolean, non-List type in non-String format. "
        + "This is most likely due to a change in htsjdk's library.");
  }

  String stringValue = (String) value;
  boolean isNumeric = stringValue.matches("[-+]?\\d+(\\.\\d+)?");

  if (type == VCFHeaderLineType.Integer && isNumeric) {
    return Value.newBuilder().setNumberValue(Integer.parseInt(stringValue)).build();
  }

  if (type == VCFHeaderLineType.Float && isNumeric) {
    return Value.newBuilder().setNumberValue(Double.parseDouble(stringValue)).build();
  }


  return Value.newBuilder().setStringValue(stringValue).build();
}
 
开发者ID:verilylifesciences,项目名称:genomewarp,代码行数:27,代码来源:VcfToVariant.java

示例4: getFieldsValVCF

import htsjdk.variant.vcf.VCFHeaderLineType; //导入方法依赖的package包/类
public void getFieldsValVCF(NodeWithRefAlt query, NodeWithRefAlt db, boolean forceOverlap) {
	int beg, end;
	String val, info = db.info, name;
	AnnoFieldBean_bak field;
	for (String key : keys) {
		field = fields.get(key);
		name = field.getOutName() != null ? field.getOutName() : field.getName();
		beg = info.indexOf(field.getName());
		if(beg != -1) {
			if(field.getVcfInfo().getType() == VCFHeaderLineType.Flag) {
				results.add(new AnnNode(name, name));
			} else {
				beg = info.indexOf("=", beg);
				end = info.indexOf(VCFConstants.INFO_FIELD_SEPARATOR, beg);
				if(end == -1) {
					val = info.substring(beg + 1);
				} else {
					val = info.substring(beg + 1, end);
				}
				
				if(forceOverlap) results.add(new AnnNode(name, field.getValForForceOverlap(val, query, db)));
				else results.add(new AnnNode(name, field.getVal(val, query, db)));
			}
		} else {
			if(field.getVcfInfo().getType() == VCFHeaderLineType.Flag) {
				results.add(new AnnNode(name, null));
			} else {
				throw new IllegalArgumentException("Can't find field " + name + " in " + db.origStr);
			}
		}
	}
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:33,代码来源:AnnoDBBean_bak.java


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