/** * HACK TO CREATE GATKSAMRECORD WITH ONLY A HEADER FOR TESTING PURPOSES ONLY * @param header */ public GATKSAMRecord(final SAMFileHeader header) { this(new SAMRecord(header)); }
/** Create a new SAMRecord to be filled in */ @Override public SAMRecord createSAMRecord(final SAMFileHeader header) { return new SAMRecord(header); }
/** Create a new SAMRecord to be filled in */ @Override public SAMRecord createSAMRecord(final SAMFileHeader header) { return new SAMRecord(header); }
@Test public void testCompareDifferentNames() throws Exception { final SAMRecord a = new SAMRecord(null); a.setReadName("A"); final SAMRecord b = new SAMRecord(null); b.setReadName("B"); // hashes are providing a different order in this case Assert.assertTrue(COMPARATOR.compare(a, b) != 0); Assert.assertTrue(COMPARATOR.compare(b, a) != 0); }
@Test(expectedExceptions=IllegalStateException.class) public void testNullHeaderForceMateIndexResolutionFailure() { // force the internal SAMRecord reference index value to null initial state final SAMRecord sam = new SAMRecord(null); sam.setMateReferenceName("unresolvable"); sam.getMateReferenceIndex(); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_setUnsignedIntegerAttributeTooLarge() { SAMFileHeader header = new SAMFileHeader(); SAMRecord record = new SAMRecord(header); record.setAttribute("UI", BinaryCodec.MAX_UINT + 1); }
@Test public void testEmptyArrayAttributeHasNoCommaWhenWrittenToSAM(){ final SAMFileHeader header = new SAMFileHeader(); final SAMRecord record = new SAMRecord(header); record.setAttribute("xa", new int[0]); Assert.assertTrue(record.getSAMString().endsWith("xa:B:i\n")); } }
private SAMRecord createSamRecordWithAdapterSequence(final int readLength, final IlluminaAdapterPair adapterPair, final int adapterPosition) { final String adapterString = adapterPair.get3PrimeAdapterInReadOrder(); final int replacementLength = Math.min(adapterString.length(), readLength - adapterPosition); final String adapterSubstring = adapterString.substring(0, replacementLength); final String readBases = replaceSubstring(makeBogusReadString(readLength), adapterSubstring, adapterPosition, adapterSubstring.length()); final SAMRecord rec = new SAMRecord(null); rec.setReadString(readBases); return rec; }
@Test(dataProvider = "brokenUmiProvider", expectedExceptions = PicardException.class) public void testBrokenUmi(final String brokenUmi) { SAMFileHeader header = new SAMFileHeader(); SAMRecord rec = new SAMRecord(header); rec.setAttribute("RX", brokenUmi); // This should throw an exception due to a broken UMI in rec UmiUtil.getTopStrandNormalizedUmi(rec, "RX", true); } }
@Test(expectedExceptions = SAMException.class) public void test_getUnsignedIntegerAttribute_negative() { SAMFileHeader header = new SAMFileHeader(); SAMRecord record = new SAMRecord(header); record.setAttribute("UI", -1L); record.getUnsignedIntegerAttribute("UI"); }
@Test(dataProvider = "makeReferenceFromAlignment") public void testMakeReferenceFromAlignment(final String seq, final String cigar, final String md, boolean includeReferenceBasesForDeletions, final String expectedReference) { final SAMRecord rec = new SAMRecord(null); rec.setReadName("test"); rec.setReadString(seq); rec.setCigarString(cigar); rec.setAttribute(SAMTag.MD.name(), md); final byte[] refBases = SequenceUtil.makeReferenceFromAlignment(rec, includeReferenceBasesForDeletions); Assert.assertEquals(StringUtil.bytesToString(refBases), expectedReference); }
@Test() public void test_setAttribute_empty_string() { final SAMFileHeader header = new SAMFileHeader(); final SAMRecord record = new SAMRecord(header); Assert.assertNull(record.getStringAttribute(SAMTag.MD.name())); record.setAttribute(SAMTag.MD.name(), ""); Assert.assertNotNull(record.getStringAttribute(SAMTag.MD.name())); Assert.assertEquals(record.getStringAttribute(SAMTag.MD.name()),""); record.setAttribute(SAMTag.MD.name(), null); Assert.assertNull(record.getStringAttribute(SAMTag.MD.name())); }
private SAMRecord generateRecord(String name) { SAMRecord record = new SAMRecord(new SAMFileHeader()); record.setReadName(name); record.setBaseQualities(highQualities); record.setReadBases(refBases); return record; }
private static SAMRecord createRecord(int start, int mappingQuality) { final SAMRecord rec = new SAMRecord(getHeader()); rec.setReadName("read"); rec.setReferenceName("1"); rec.setAlignmentStart(start); rec.setMappingQuality(mappingQuality); return rec; }
@BeforeTest public void setUp(){ record = new SAMRecord(new SAMFileHeader()); record.setReadName("testRecord"); record.setReadBases(bases); record.setBaseQualities(qualities); }
@BeforeTest public void setUp(){ record = new SAMRecord(new SAMFileHeader()); record.setReadName("testRecord"); record.setReadBases(bases); record.setBaseQualities(qualities); }
@BeforeTest public void setUp(){ String referenceString = ">chrM\nACCTACGTTCAATATTCTTCACCTACGTTCAATATTCTTCACCTACGTTCAATATTCTTCACCTACGTTCAATATTCTTCACCTACGTTCAATATTCTTC"; ref = new ReferenceSequence("chrM", 0, referenceString.getBytes()); sequence = new SAMSequenceRecord("chrM", 100); record = new SAMRecord(new SAMFileHeader()); record.setReadName("test"); record.setBaseQualities(qualities); record.setReadBases(refBases); secondRecord = generateRecord("test1"); thirdRecord = generateRecord("test2"); }
public SAMRecord createTestSamRec() { final SAMFileHeader header = new SAMFileHeader(); final SAMRecord rec = new SAMRecord(header); rec.setReadString("ACACACACAC"); rec.setBaseQualityString("HHHHHIIIII"); rec.setAttribute("X1", new byte[] {1,2,3,4,5}); rec.setAttribute("X2", new short[] {1,2,3,4,5}); rec.setAttribute("X3", new int[] {1,2,3,4,5}); rec.setAttribute("X4", new float[] {1.0f,2.0f,3.0f,4.0f,5.0f}); rec.setAttribute("Y1", "AAAAGAAAAC"); return(rec); }
@BeforeTest public void setUp() { SAMRecord record = new SAMRecord(new SAMFileHeader()); record.setReadName("testRecord"); record.setReadBases(bases); record.setBaseQualities(qualities); typedRecordAndOffset = EdgingRecordAndOffset.createBeginRecord(record, 10, 10, 10); typedRecordAndOffsetEnd = EdgingRecordAndOffset.createEndRecord(typedRecordAndOffset); }