public int getAttributeAsInt(String key, int defaultValue) { return commonInfo.getAttributeAsInt(key, defaultValue); } public double getAttributeAsDouble(String key, double defaultValue) { return commonInfo.getAttributeAsDouble(key, defaultValue); }
public int getAttributeAsInt(String key, int defaultValue) { return commonInfo.getAttributeAsInt(key, defaultValue); } public double getAttributeAsDouble(String key, double defaultValue) { return commonInfo.getAttributeAsDouble(key, defaultValue); }
public int getAttributeAsInt(String key, int defaultValue) { return commonInfo.getAttributeAsInt(key, defaultValue); } public double getAttributeAsDouble(String key, double defaultValue) { return commonInfo.getAttributeAsDouble(key, defaultValue); }
/** * Converts a {@link VCFFileReader} to an IntervalList. The name field of the IntervalList is taken from the ID field * of the variant, if it exists. If not, creates a name of the format interval-n where n is a running number that increments * only on un-named intervals. Will use a "END" tag in the INFO field as the end of the interval (if exists). * * @param vcf the vcfReader to be used for the conversion * @return an IntervalList constructed from input vcf */ public static IntervalList toIntervalList(final VCFFileReader vcf, final boolean includeFiltered) { //grab the dictionary from the VCF and use it in the IntervalList final SAMSequenceDictionary dict = vcf.getFileHeader().getSequenceDictionary(); final SAMFileHeader samFileHeader = new SAMFileHeader(); samFileHeader.setSequenceDictionary(dict); final IntervalList list = new IntervalList(samFileHeader); int intervals = 0; for (final VariantContext vc : vcf) { if (includeFiltered || !vc.isFiltered()) { String name = vc.getID(); final Integer intervalEnd = vc.getCommonInfo().getAttributeAsInt(VCFConstants.END_KEY, vc.getEnd()); if (VCFConstants.EMPTY_ID_FIELD.equals(name) || name == null) name = "interval-" + (++intervals); list.add(new Interval(vc.getContig(), vc.getStart(), intervalEnd, false, name)); } } return list; }
/** * Converts a {@link VCFFileReader} to an IntervalList. The name field of the IntervalList is taken from the ID field * of the variant, if it exists. If not, creates a name of the format interval-n where n is a running number that increments * only on un-named intervals. Will use a "END" tag in the INFO field as the end of the interval (if exists). * * @param vcf the vcfReader to be used for the conversion * @return an IntervalList constructed from input vcf */ public static IntervalList toIntervalList(final VCFFileReader vcf, final boolean includeFiltered) { //grab the dictionary from the VCF and use it in the IntervalList final SAMSequenceDictionary dict = vcf.getFileHeader().getSequenceDictionary(); final SAMFileHeader samFileHeader = new SAMFileHeader(); samFileHeader.setSequenceDictionary(dict); final IntervalList list = new IntervalList(samFileHeader); int intervals = 0; for (final VariantContext vc : vcf) { if (includeFiltered || !vc.isFiltered()) { String name = vc.getID(); final Integer intervalEnd = vc.getCommonInfo().getAttributeAsInt(VCFConstants.END_KEY, vc.getEnd()); if (VCFConstants.EMPTY_ID_FIELD.equals(name) || name == null) name = "interval-" + (++intervals); list.add(new Interval(vc.getContig(), vc.getStart(), intervalEnd, false, name)); } } return list; }