/** * Converts the underlying 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 on un-named intervals. Will use the "END" tag in the INFO field as the end of the interval * (if exists). * * @return an IntervalList constructed from input vcf */ public IntervalList toIntervalList() { return toIntervalList(false); }
/** * Parse a VCF file and convert 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 * * @param path a VCF * @return */ public static IntervalList toIntervalList(final Path path) { return toIntervalList(path, false); }
/** * Converts a vcf 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) { return toIntervalList(vcf, false); }
/** * Converts a vcf 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) { return toIntervalList(vcf, false); }
/** * Parse a VCF file and convert 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 * * @param path a VCF * @return */ public static IntervalList toIntervalList(final Path path) { return toIntervalList(path, false); }
/** * Converts the underlying 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 on un-named intervals. Will use the "END" tag in the INFO field as the end of the interval * (if exists). * * @return an IntervalList constructed from input vcf */ public IntervalList toIntervalList() { return toIntervalList(false); }
public IntervalList toIntervalList(final boolean includeFiltered) { return toIntervalList(this, includeFiltered); }
public IntervalList toIntervalList(final boolean includeFiltered) { return toIntervalList(this, includeFiltered); }
/** * Converts a vcf 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 * * @deprecated since July 2018 since use {@link #toIntervalList(VCFFileReader, boolean)} instead */ @Deprecated public static IntervalList fromVcf(final VCFFileReader vcf, final boolean includeFiltered) { return toIntervalList(vcf, includeFiltered); }
/** * Parse a VCF file and convert 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 * * @param file * @return * @deprecated since July 2018 use {@link #toIntervalList(Path, boolean)} instead */ @Deprecated public static IntervalList fromVcf(final File file, final boolean includeFiltered) { return toIntervalList(file.toPath(), includeFiltered); }
/** * Converts a vcf 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 * * @deprecated since July 2018 since use {@link #toIntervalList(VCFFileReader, boolean)} instead */ @Deprecated public static IntervalList fromVcf(final VCFFileReader vcf, final boolean includeFiltered) { return toIntervalList(vcf, includeFiltered); }
/** * Parse a VCF file and convert 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 * * @param file * @return * @deprecated since July 2018 use {@link #toIntervalList(Path, boolean)} instead */ @Deprecated public static IntervalList fromVcf(final File file, final boolean includeFiltered) { return toIntervalList(file.toPath(), includeFiltered); }
/** * Parse a VCF file and convert 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 * * @param file a VCF * @return an {@link IntervalList} * * @deprecated since July 2018 use {@link #toIntervalList(Path)} instead */ @Deprecated public static IntervalList fromVcf(final File file) { return toIntervalList(file.toPath()); }
/** * Parse a VCF file and convert 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 * * @param file a VCF * @return an {@link IntervalList} * * @deprecated since July 2018 use {@link #toIntervalList(Path)} instead */ @Deprecated public static IntervalList fromVcf(final File file) { return toIntervalList(file.toPath()); }
public static IntervalList toIntervalList(final Path path, final boolean includeFiltered) { try (final VCFFileReader vcfReader = new VCFFileReader(path, false)) { return vcfReader.toIntervalList(includeFiltered); } }
public static IntervalList toIntervalList(final Path path, final boolean includeFiltered) { try (final VCFFileReader vcfReader = new VCFFileReader(path, false)) { return vcfReader.toIntervalList(includeFiltered); } }
@Test(expectedExceptions = IllegalArgumentException.class) public void testContigsAbsentInHeader() { String vcf = TEST_DIR.resolve("IntervalListFromVCFNoContigLines.vcf").toString(); final File vcfFile = new File(vcf); VCFFileReader.toIntervalList(vcfFile.toPath()); }
@Test(dataProvider = "VCFCompData") public void testFromVCF(final Path vcf, final Path compInterval, final boolean invertVCF) { final IntervalList compList = IntervalList.fromPath(compInterval); final IntervalList list = invertVCF ? IntervalList.invert(VCFFileReader.toIntervalList(vcf)) : VCFFileReader.toIntervalList(vcf); compList.getHeader().getSequenceDictionary().assertSameDictionary(list.getHeader().getSequenceDictionary()); final Collection<Interval> intervals = CollectionUtil.makeCollection(list.iterator()); final Collection<Interval> compIntervals = CollectionUtil.makeCollection(compList.iterator()); //assert that the intervals correspond Assert.assertEquals(intervals, compIntervals); final List<String> intervalNames = new LinkedList<>(); final List<String> compIntervalNames = new LinkedList<>(); for (final Interval interval : intervals) { intervalNames.add(interval.getName()); } for (final Interval interval : compIntervals) { compIntervalNames.add(interval.getName()); } //assert that the names match Assert.assertEquals(intervalNames, compIntervalNames); }
@Test(dataProvider = "VCFCompData") public void testFromVCFWithPath(final Path vcf, final Path compInterval, final boolean invertVCF) { final IntervalList compList = IntervalList.fromPath(compInterval); final IntervalList list = invertVCF ? IntervalList.invert(VCFFileReader.toIntervalList(vcf)) : VCFFileReader.toIntervalList(vcf); compList.getHeader().getSequenceDictionary().assertSameDictionary(list.getHeader().getSequenceDictionary()); final Collection<Interval> intervals = CollectionUtil.makeCollection(list.iterator()); final Collection<Interval> compIntervals = CollectionUtil.makeCollection(compList.iterator()); //assert that the intervals correspond Assert.assertEquals(intervals, compIntervals); final List<String> intervalNames = new LinkedList<>(); final List<String> compIntervalNames = new LinkedList<>(); for (final Interval interval : intervals) { intervalNames.add(interval.getName()); } for (final Interval interval : compIntervals) { compIntervalNames.add(interval.getName()); } //assert that the names match Assert.assertEquals(intervalNames, compIntervalNames); }