-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More informative error messages when dictionaries don't match (#1870)
- Loading branch information
Showing
13 changed files
with
154 additions
and
31 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
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
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
48 changes: 48 additions & 0 deletions
48
src/test/java/picard/util/SequenceDictionaryUtilsTest.java
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,48 @@ | ||
package picard.util; | ||
|
||
import htsjdk.samtools.SAMSequenceDictionary; | ||
import htsjdk.samtools.SAMSequenceRecord; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
import picard.PicardException; | ||
|
||
import java.util.List; | ||
|
||
public class SequenceDictionaryUtilsTest { | ||
|
||
@Test | ||
public void testSequenceDictionaryPositive() { | ||
final SAMSequenceDictionary s1 = new SAMSequenceDictionary( | ||
List.of( | ||
new SAMSequenceRecord("chr1", 10), | ||
new SAMSequenceRecord("chr2", 15), | ||
new SAMSequenceRecord("chr3", 20) | ||
) | ||
); | ||
SequenceDictionaryUtils.assertSequenceDictionariesEqual( | ||
s1, | ||
"s1", | ||
new SAMSequenceDictionary(s1.getSequences()), | ||
"s2"); | ||
} | ||
|
||
@DataProvider | ||
public Object[][] sequenceDictionaryNegativeProvider() { | ||
return new Object[][]{ | ||
{ | ||
new SAMSequenceDictionary(List.of(new SAMSequenceRecord("chr1", 100))), | ||
new SAMSequenceDictionary(List.of(new SAMSequenceRecord("chr1", 200))) | ||
}, | ||
{ | ||
new SAMSequenceDictionary(List.of(new SAMSequenceRecord("chr1", 10))), | ||
new SAMSequenceDictionary(List.of(new SAMSequenceRecord("chr2", 10))) | ||
}, | ||
}; | ||
} | ||
|
||
@Test(dataProvider = "sequenceDictionaryNegativeProvider", expectedExceptions = PicardException.class) | ||
public void testSequenceDictionaryNegative(final SAMSequenceDictionary s1, final SAMSequenceDictionary s2 ) { | ||
SequenceDictionaryUtils.assertSequenceDictionariesEqual(s1, "s1", s2, "s2"); | ||
} | ||
|
||
} |