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


Java VCFHeaderLineType类代码示例

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


VCFHeaderLineType类属于htsjdk.variant.vcf包,在下文中一共展示了VCFHeaderLineType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: filterLine

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean filterLine(final T obj, String line) {
	
	if(line.startsWith(BEGIN)) {
		if(currentField != null) {
			Map<String, VCFInfoHeaderLine> infoMap = (Map<String, VCFInfoHeaderLine>)obj;
			infoMap.put(currentField, new VCFInfoHeaderLine(currentField, count, type, desc));
		}
		currentField = line.substring(1);
		if(currentField.trim().equals("")) throw new IllegalArgumentException("Field name is empty, please check filed name starts with @");
		desc = "";
		count = VCFHeaderLineCount.UNBOUNDED;
		type = VCFHeaderLineType.String;
		
		return false;
	} else if(line.equals("") || line.startsWith(COMMENT_LINE)) {
		return false;
	} else {
		return true;
	}
}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:23,代码来源:VcfInfoReadConfig.java

示例4: filterInfoByWhiteList

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
private Map<String, Object> filterInfoByWhiteList(VariantContext context,
                                                  VcfFilterInfo vcfFilterInfo, VCFHeader vcfHeader) {
    Map<String, Object> permittedInfo = new HashMap<>();
    Map<String, Object> info = context.getAttributes();

    vcfFilterInfo.getInfoItems().forEach(key -> {
        if (info.containsKey(key.getName()) && vcfHeader.getInfoHeaderLine(key.getName()) != null) {
            int count = vcfHeader.getInfoHeaderLine(key.getName()).getCount(context);
            switch (key.getType()) {
                case Integer:
                    addNumberInfo(permittedInfo, info, count, VCFHeaderLineType.Integer, key);
                    break;
                case Float:
                    addNumberInfo(permittedInfo, info, count, VCFHeaderLineType.Float, key);
                    break;
                case Flag:
                    permittedInfo.put(key.getName(), parseFlagInfo(permittedInfo, info, count, key));
                    break;
                default:
                    permittedInfo.put(key.getName(), info.get(key.getName()));
            }
        }
    });

    return permittedInfo;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:27,代码来源:FeatureIndexManager.java

示例5: getGroupByField

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
private String getGroupByField(List<VcfFile> files, String groupBy) throws IOException {
    IndexSortField sortField = IndexSortField.getByName(groupBy);
    if (sortField == null) {
        VcfFilterInfo info = vcfManager.getFiltersInfo(
            files.stream().map(BaseEntity::getId).collect(Collectors.toList()));

        InfoItem infoItem = info.getInfoItemMap().get(groupBy);
        Assert.notNull(infoItem, "Unknown sort field: " + groupBy);

        if (infoItem.getType() == VCFHeaderLineType.Integer || infoItem.getType() == VCFHeaderLineType.Float) {
            return FeatureIndexFields.getGroupName(infoItem.getName().toLowerCase());
        } else {
            return infoItem.getName().toLowerCase();
        }
    } else {
        if (sortField.getType() == SortField.Type.INT || sortField.getType() == SortField.Type.FLOAT) {
            return sortField.getField().getGroupName();
        } else {
            return sortField.getField().fieldName;
        }
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:23,代码来源:FeatureIndexDao.java

示例6: 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

示例7: getGroupByField

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
private String getGroupByField(List<VcfFile> files, String groupBy) throws IOException {
    IndexSortField sortField = IndexSortField.getByName(groupBy);
    if (sortField == null) {
        VcfFilterInfo info = vcfManager.getFiltersInfo(
                files.stream().map(BaseEntity::getId).collect(Collectors.toList()));

        InfoItem infoItem = info.getInfoItemMap().get(groupBy);
        Assert.notNull(infoItem, "Unknown sort field: " + groupBy);

        if (infoItem.getType() == VCFHeaderLineType.Integer || infoItem.getType() == VCFHeaderLineType.Float) {
            return FeatureIndexFields.getGroupName(infoItem.getName().toLowerCase());
        } else {
            return infoItem.getName().toLowerCase();
        }
    } else {
        if (sortField.getType() == SortField.Type.INT || sortField.getType() == SortField.Type.FLOAT) {
            return sortField.getField().getGroupName();
        } else {
            return sortField.getField().fieldName;
        }
    }
}
 
开发者ID:epam,项目名称:NGB,代码行数:23,代码来源:FeatureIndexDao.java

示例8: onTraversalStart

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
@Override
public void onTraversalStart() {
    final VCFHeader inputHeader = getHeaderForVariants();
    final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder());
    headerLines.add(new VCFInfoHeaderLine(EXPECTED_ALLELE_FRACTION_NAME, 1, VCFHeaderLineType.Float, "expected allele fraction in pooled bam"));
    final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples());
    headerLines.addAll(getDefaultToolVCFHeaderLines());
    vcfWriter = createVCFWriter(outputVcf);
    vcfWriter.writeHeader(vcfHeader);

    final List<MixingFraction> mixingFractionsList = MixingFraction.readMixingFractions(inputMixingFractions);
    final Map<String, Double> mixingfractionsMap = mixingFractionsList.stream()
            .collect(Collectors.toMap(MixingFraction::getSample, MixingFraction::getMixingFraction));
    mixingFractionsInSampleOrder = inputHeader.getSampleNamesInOrder().stream()
            .mapToDouble(mixingfractionsMap::get).toArray();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:17,代码来源:AnnotateVcfWithExpectedAlleleFraction.java

示例9: addHeaders

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
private void addHeaders(VCFHeader header, String prefix, String infix, String note) {
    VCFInfoHeaderLine infoClinVarBasicInfo = new VCFInfoHeaderLine(prefix + infix + "BASIC_INFO",
            VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String,
            "Annotation of basic info with the form 'allele | hgvs string | origin'" + note);
    header.addMetaDataLine(infoClinVarBasicInfo);

    VCFInfoHeaderLine infoClinVarVarInfo = new VCFInfoHeaderLine(prefix + infix + "VAR_INFO",
            VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String,
            "Annotation of variant source information of the form 'allele | db name | id in db | origins'" + note);
    header.addMetaDataLine(infoClinVarVarInfo);
    
    VCFInfoHeaderLine infoClinVarDiseaseInfo = new VCFInfoHeaderLine(prefix + infix + "DISEASE_INFO",
            VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.String,
            "Annotation of disease information of the form 'allele | significance | disease db | id in disease db "
                    + "| name in disease db | revision status | clinical accession'" + note);
    header.addMetaDataLine(infoClinVarDiseaseInfo);
}
 
开发者ID:charite,项目名称:jannovar,代码行数:18,代码来源:ClinVarVCFHeaderExtender.java

示例10: addHeaders

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
/**
 * Add header entries.
 * 
 * @param header The {@link VCFHeader} to extend.
 */
public void addHeaders(VCFHeader header) {
	header.addMetaDataLine(new VCFFilterHeaderLine(FILTER_GT_DE_NOVO_PARENT_AD2,
			"Supporting read count for alternative allele in tentative de novo call > "
					+ options.getDeNovoMaxParentAd2()));
	header.addMetaDataLine(new VCFFilterHeaderLine(FILTER_GT_DE_NOVO_IN_SIBLING,
			"Non-ref genotype also seen in sibling"));

	header.addMetaDataLine(
			new VCFFormatHeaderLine(FORMAT_GT_DE_NOVO, 1, VCFHeaderLineType.Character,
					"Whether the variant looks de novo by genotype, one of {'Y', 'N'}."));
	header.addMetaDataLine(
			new VCFFormatHeaderLine(FORMAT_PARENTS_REF, 1, VCFHeaderLineType.Character,
					"Whether both parent's genotype is reference, one of {'Y', 'N'}."));

	header.addMetaDataLine(new VCFFilterHeaderLine(FILTER_GT_ONE_PARENT_FILTERED,
			"One parent was filtered or no-call, filter child as well, important for inheritance "
					+ "filtration as filtered variants count as no-call which counts as "
					+ "wild-card by default; \"one/both parents filtered\" don't count. (enabled: "
					+ options.isApplyParentGtFilteredFilters() + ")"));
	header.addMetaDataLine(new VCFFilterHeaderLine(FILTER_GT_BOTH_PARENTS_FILTERED,
			"Both parents are filtered or no-call, filter child as well, important for inheritance "
					+ "filtration as filtered variants count as no-call which counts as "
					+ "wild-card by default; \"one/both parents filtered\" don't count. (enabled: "
					+ options.isApplyParentGtFilteredFilters() + ")"));
}
 
开发者ID:charite,项目名称:jannovar,代码行数:31,代码来源:PedigreeFilterHeaderExtender.java

示例11: writeHeader

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
@Override
public void writeHeader(final VCFHeader header) {
	final VCFHeader header2=new VCFHeader(header);
	header2.addMetaDataLine(
			new VCFInfoHeaderLine(this.ATT,
					VCFHeaderLineCount.UNBOUNDED,
					VCFHeaderLineType.String,
					"TRAP Score:((ALT|GENE|SCORE) in Trap Database  http://trap-score.org/"
				));
	header2.addMetaDataLine(
			new VCFInfoHeaderLine(this.ATT_MIN,
					1,
					VCFHeaderLineType.Float,
					"Min Score in Trap Database  http://trap-score.org/"
				));
	header2.addMetaDataLine(
			new VCFInfoHeaderLine(this.ATT_MAX,
					1,
					VCFHeaderLineType.Float,
					"Max Score in Trap Database  http://trap-score.org/"
				));
	super.writeHeader(header2);
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:24,代码来源:VcfTrap.java

示例12: writeHeader

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
@Override
public void writeHeader(final VCFHeader header) {
	this.limitToThoseFilters = 
			CtxWriterFactory.this.onlyThoseFiltersTagStr.stream().flatMap(
					S->Arrays.asList(S.split("[, ]")).stream()).
					filter(S->!StringUtil.isBlank(S)).
					collect(Collectors.toSet())
					;
	this.infoHeaderLine = new VCFInfoHeaderLine(
			CtxWriterFactory.this.infoName.trim(),
			VCFHeaderLineCount.UNBOUNDED,
			VCFHeaderLineType.String,
			"Variant was previously FILTERed with the given values."
			);
	if(header.getInfoHeaderLine(infoHeaderLine.getID())!=null)
		{
		throw new JvarkitException.UserError("INFO["+this.infoHeaderLine.getID()+"] already exists in input VCF.");
		}
	
	
	final VCFHeader h2= new VCFHeader(header);	
	h2.addMetaDataLine(this.infoHeaderLine);
	super.writeHeader(h2);
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:25,代码来源:VcfMoveFiltersToInfo.java

示例13: CtxWriter

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
CtxWriter(final VariantContextWriter delegate) {
super(delegate);
Objects.requireNonNull(delegate);
Arrays.fill(this.ome2manifest,null);
for(final OmeType ome:OmeType.values()) {
	for(final String pop: POPS)
		{
		if(!CtxWriterFactory.this.doNotInsertAlleleCount) this.infoFields.add(new InfoField("AC_"+pop,ome,true,VCFHeaderLineType.Integer));
		if(!CtxWriterFactory.this.doNotInsertAlleleFreq) this.infoFields.add(new InfoField("AF_"+pop,ome,true,VCFHeaderLineType.Float));
		if(!CtxWriterFactory.this.doNotInsertAlleleNumber) this.infoFields.add(new InfoField("AN_"+pop,ome,pop.equals("POPMAX"),VCFHeaderLineType.Integer));
		}
	if(!CtxWriterFactory.this.doNotInsertAlleleCount) this.infoFields.add(new InfoField("AC",ome,true,VCFHeaderLineType.Integer));
	if(!CtxWriterFactory.this.doNotInsertAlleleFreq) infoFields.add(new InfoField("AF",ome,true,VCFHeaderLineType.Float));
	if(!CtxWriterFactory.this.doNotInsertAlleleNumber) infoFields.add(new InfoField("AN",ome,false,VCFHeaderLineType.Integer));
	}
}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:17,代码来源:VcfGnomad.java

示例14: setBedHeaderInfo

import htsjdk.variant.vcf.VCFHeaderLineType; //导入依赖的package包/类
public void setBedHeaderInfo(String dbLabel) {
		if(count == null) {
			System.err.println("You should set number for field " + name + " of bed file " + dbLabel + ", or we will use 'number=.' instead. ");
			count = VCFHeaderLineCount.UNBOUNDED;
		}
		if(type == null) {
			System.err.println("You should set type for field " + name + " of bed file " + dbLabel + ", or we will use 'type=string' instead. ");
			type = VCFHeaderLineType.String;
		}
//		if(count == null || type == null) throw new IllegalArgumentException("DB format is bed, please set number and type for field name " + name);
		this.vcfInfo = new VCFInfoHeaderLine((outName != null) ? outName:getName() , count, type, description);
	}
 
开发者ID:mulinlab,项目名称:vanno,代码行数:13,代码来源:AnnoFieldBean_bak.java

示例15: 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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。