@Override protected SAMSequenceDictionary getDictionaryForMergedBam() { SAMSequenceDictionary referenceDict = SAMSequenceDictionaryExtractor.extractDictionary(referenceFasta.toPath()); if (referenceDict == null) { throw new PicardException("No sequence dictionary found for " + referenceFasta.getAbsolutePath() + ". Use Picard's CreateSequenceDictionary to create a sequence dictionary."); } return SAMSequenceDictionary.mergeDictionaries(alignedSamDictionary, referenceDict, requiredMatchingDictionaryTags); }
@Override protected SAMSequenceDictionary getDictionaryForMergedBam() { SAMSequenceDictionary referenceDict = SAMSequenceDictionaryExtractor.extractDictionary(referenceFasta.toPath()); if (referenceDict == null) { throw new PicardException("No sequence dictionary found for " + referenceFasta.getAbsolutePath() + ". Use Picard's CreateSequenceDictionary to create a sequence dictionary."); } return SAMSequenceDictionary.mergeDictionaries(alignedSamDictionary, referenceDict, requiredMatchingDictionaryTags); }
@Test(dataProvider = "testMergeDictionariesData", expectedExceptions = IllegalArgumentException.class) public void testMergeDictionaries(final SAMSequenceRecord rec1, final SAMSequenceRecord rec2, boolean canMerge) throws Exception { final SAMSequenceDictionary dict1 = new SAMSequenceDictionary(Collections.singletonList(rec1)); final SAMSequenceDictionary dict2 = new SAMSequenceDictionary(Collections.singletonList(rec2)); try { SAMSequenceDictionary.mergeDictionaries(dict1, dict2, SAMSequenceDictionary.DEFAULT_DICTIONARY_EQUAL_TAG); } catch (final IllegalArgumentException e) { if (canMerge) { throw new Exception("Expected to be able to merge dictionaries, but wasn't:" , e); } else { throw e; } } if (canMerge){ throw new IllegalArgumentException("Expected to be able to merge dictionaries, and was indeed able to do so."); } else { throw new Exception("Expected to not be able to merge dictionaries, but was able"); } }