@Test(dataProvider = "testRows") public void testRows(String acc, int recordIndex, int flags, String readName, String bases, String quals, int refStart, String cigar, String refName, int mapQ, boolean hasMate, boolean isSecondOfPair, boolean isSecondaryAlignment) { SAMRecord record = getRecordByIndex(acc, recordIndex, false); checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondOfPair, isSecondaryAlignment); }
@Test(dataProvider = "testCounts") public void testCounts(String acc, int expectedNumMapped, int expectedNumUnmapped) { SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open( SamInputResource.of(new SRAAccession(acc)) ); final SAMRecordIterator samRecordIterator = reader.iterator(); assertCorrectCountsOfMappedAndUnmappedRecords(samRecordIterator, expectedNumMapped, expectedNumUnmapped); }
checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondOfPair, isSecondaryAlignment);
@Test(dataProvider = "testCountsBySpan") public void testCountsBySpan(String acc, List<Chunk> chunks, int expectedNumMapped, int expectedNumUnmapped) { SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open( SamInputResource.of(new SRAAccession(acc)) ); final SAMRecordIterator samRecordIterator = ((SamReader.Indexing) reader).iterator(new BAMFileSpan(chunks)); assertCorrectCountsOfMappedAndUnmappedRecords(samRecordIterator, expectedNumMapped, expectedNumUnmapped); }
checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondOfPair, isSecondaryAlignment);
@Test(dataProvider = "testRows") public void testRowsAfterIteratorDetach(String acc, int recordIndex, int flags, String readName, String bases, String quals, int refStart, String cigar, String refName, int mapQ, boolean hasMate, boolean isSecondOfPair, boolean isSecondaryAlignment) { SAMRecord record = getRecordByIndex(acc, recordIndex, true); checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondOfPair, isSecondaryAlignment); }
@Test(dataProvider = "testRows") public void testRowsOverrideValues(String acc, int recordIndex, int flags, String readName, String bases, String quals, int refStart, String cigar, String refName, int mapQ, boolean hasMate, boolean isSecondOfPair, boolean isSecondaryAlignment) { SAMRecord record = getRecordByIndex(acc, recordIndex, true); SAMFileHeader header = record.getHeader(); record.setFlags(0); record.setReadUnmappedFlag(refStart == -1); record.setReadBases("C".getBytes()); record.setBaseQualities(SAMUtils.fastqToPhred("A")); if (refStart == -1) { checkSAMRecord(record, 4, readName, "C", "A", refStart, "1M", refName, mapQ, false, false, false); } else { int sequenceIndex = header.getSequenceIndex(refName); Assert.assertFalse(sequenceIndex == -1); if (sequenceIndex == 0) { if (header.getSequenceDictionary().getSequences().size() > 1) { sequenceIndex++; } } else { sequenceIndex--; } refName = header.getSequence(sequenceIndex).getSequenceName(); record.setAlignmentStart(refStart - 100); record.setCigarString("1M"); record.setMappingQuality(mapQ - 1); record.setReferenceIndex(sequenceIndex); checkSAMRecord(record, 0, readName, "C", "A", refStart - 100, "1M", refName, mapQ - 1, false, false, false); } }