-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed IntervalList fromFiles() so that it doesn't call .unique() on… (
#1273) * Changed IntervalList fromFiles() so that it doesn't call .unique() on the interval list before returning it. While this is a change in API, it is more consistent with fromFile() that similarly doesn't call .unique() before returning the result. This should fix an issue in picard where CollectHsMetrics (incorrectly) merges abutting intervals prior to merging them. **NOTA BENE** BREAKING CHANGE! Users who would like to keep the old behaviour should call uniqued() on the resulting IntervalList prior to using.
- Loading branch information
Yossi Farjoun
authored
Feb 22, 2019
1 parent
3b3d107
commit 0cc762f
Showing
6 changed files
with
119 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package htsjdk.samtools.util; | ||
|
||
import htsjdk.HtsjdkTest; | ||
import htsjdk.samtools.SAMFileHeader; | ||
import htsjdk.variant.utils.SAMSequenceDictionaryExtractor; | ||
import org.testng.Assert; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
public class IntervalUtilTest extends HtsjdkTest { | ||
|
||
final SAMFileHeader header = new SAMFileHeader(SAMSequenceDictionaryExtractor.extractDictionary( | ||
IOUtil.getPath("src/test/resources/htsjdk/samtools/intervallist/IntervalListchr123_empty.interval_list"))); | ||
final IntervalList intervalList = new IntervalList(header); | ||
|
||
public IntervalUtilTest() throws IOException {} | ||
|
||
@BeforeClass | ||
public void initialize() throws IOException { | ||
|
||
intervalList.add(new Interval("1", 1, 2, true, "tiny_at_1")); | ||
intervalList.add(new Interval("1", 2, 3, true, "tiny_at_2")); | ||
intervalList.add(new Interval("1", 4, 5, true, "tiny_at_4")); | ||
} | ||
|
||
@DataProvider | ||
public Iterator<Object[]> testMergeDifferentlyData() { | ||
final List<Object[]> tests = new ArrayList<>(); | ||
|
||
IntervalList result1 = new IntervalList(header); | ||
result1.add(new Interval("1", 1, 5, true, "tiny_at_1|tiny_at_2|tiny_at_4")); | ||
tests.add(new Object[]{true, true, true, result1}); | ||
|
||
return tests.iterator(); | ||
} | ||
|
||
@Test(dataProvider = "testMergeDifferentlyData") | ||
public void testMergeDifferently(final boolean mergeAbutting, final boolean concatNames, final boolean requireSameStrand, final IntervalList expectedResult) { | ||
IntervalUtil.IntervalCombiner combiner = new IntervalUtil.IntervalCombiner(); | ||
|
||
combiner.setCombineAbutting(mergeAbutting).setConcatenateNames(concatNames).setEnforceSameStrand(requireSameStrand); | ||
Assert.assertEquals(expectedResult, combiner.combine(intervalList)); | ||
|
||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/resources/htsjdk/samtools/metrics/metricsOneCopyReordered.metrics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## htsjdk.samtools.metrics.StringHeader | ||
# picard.illumina.MarkIlluminaAdapters INPUT=testdata/picard/illumina/MarkIlluminaAdaptersTest/unevenReads.sam OUTPUT=/var/folders/tc/hy9lszxd1dg9cf4bky51mrrd9k3s6g/T/uneven5946421709712534555.sam METRICS=/var/folders/tc/hy9lszxd1dg9cf4bky51mrrd9k3s6g/T/uneven4591996041776878558.metrics MIN_MATCH_BASES_SE=12 MIN_MATCH_BASES_PE=6 MAX_ERROR_RATE_SE=0.1 MAX_ERROR_RATE_PE=0.1 ADAPTERS=[INDEXED, DUAL_INDEXED, PAIRED_END] ADAPTER_TRUNCATION_LENGTH=30 PRUNE_ADAPTER_LIST_AFTER_THIS_MANY_ADAPTERS_SEEN=100 NUM_ADAPTERS_TO_KEEP=1 VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false GA4GH_CLIENT_SECRETS=client_secrets.json | ||
## htsjdk.samtools.metrics.StringHeader | ||
# Started on: Mon Aug 24 13:31:51 EDT 2015 | ||
|
||
## METRICS CLASS htsjdk.samtools.metrics.MetricsFileTest$TestMetric | ||
DATE_PROP SHORT_PROP INTEGER_PROP LONG_PROP FLOAT_PROP DOUBLE_PROP ENUM_PROP BOOLEAN_PROP CHARACTER_PROP SHORT_PRIMITIVE INT_PRIMITIVE LONG_PRIMITIVE FLOAT_PRIMITIVE DOUBLE_PRIMITIVE BOOLEAN_PRIMITIVE CHAR_PRIMITIVE STRING_PROP | ||
2008-12-31 123 9223372036854775807 456.789001 0.713487 Two N A 123 919834781 9223372034707292160 0.55694 0.229233 Y B Hello World | ||
|
||
## HISTOGRAM java.lang.Integer | ||
clipped_bases read_count | ||
6 1 | ||
7 1 |