@Test(dataProvider = "positiveTestsData") public void testPositive(final String cigar) { Assert.assertNull(TextCigarCodec.decode(cigar).isValid(null, -1)); }
@Test(dataProvider = "negativeTestsData") public void testNegative(final String cigar, final SAMValidationError.Type type) { final List<SAMValidationError> errors = TextCigarCodec.decode(cigar).isValid(null, -1); Assert.assertEquals(errors.size(), 1, String.format("Got %d error, expected exactly one error.", errors.size())); Assert.assertEquals(errors.get(0).getType(), type); }
if (cigar.isValid(null, -1) == null) { // This should take care of most invalid Cigar Strings (picard's "exhaustive" implementation)
final String cigarTypeName) { List<SAMValidationError> ret = cigar.isValid(rec.getReadName(), recordNumber); if (referenceIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { SAMFileHeader samHeader = rec.getHeader();
@Override public GATKSAMRecord apply(final GATKSAMRecord read) { if(read == null) throw new UserException.BadInput("try to transform a null GATKSAMRecord"); final Cigar originalCigar = read.getCigar(); if (originalCigar.isValid(read.getReadName(),-1) != null) throw new UserException.BadInput("try to transform a read with non-valid cigar string: readName: "+read.getReadName()+" Cigar String: "+originalCigar); read.setCigar(refactorNDNtoN(originalCigar)); return read; }
final String cigarTypeName) { List<SAMValidationError> ret = cigar.isValid(rec.getReadName(), recordNumber); if (referenceIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { SAMFileHeader samHeader = rec.getHeader();
final String cigarTypeName) { List<SAMValidationError> ret = cigar.isValid(rec.getReadName(), recordNumber); if (referenceIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { final SAMSequenceRecord sequence = rec.getHeader().getSequence(referenceIndex);
final String cigarTypeName) { List<SAMValidationError> ret = cigar.isValid(rec.getReadName(), recordNumber); if (referenceIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { SAMFileHeader samHeader = rec.getHeader();
@Test(enabled = !DEBUG) public void testRevertSoftClippedBasesWithThreshold() { for (Cigar cigar : cigarList) { final int leadingSoftClips = leadingCigarElementLength(cigar, CigarOperator.SOFT_CLIP); final int tailSoftClips = leadingCigarElementLength(CigarUtils.invertCigar(cigar), CigarOperator.SOFT_CLIP); final GATKSAMRecord read = ReadClipperTestUtils.makeReadFromCigar(cigar, 0); final GATKSAMRecord unclipped = ReadClipper.revertSoftClippedBases(read); assertUnclippedLimits(read, unclipped); // Make sure limits haven't changed Assert.assertNull(read.getCigar().isValid(null, -1)); Assert.assertNull(unclipped.getCigar().isValid(null, -1)); if (!(leadingSoftClips > 0 || tailSoftClips > 0)) Assert.assertEquals(read.getCigarString(), unclipped.getCigarString()); } }
@Test(dataProvider="clipData") public void basicTest(final String testName, final int start, final String inputCigar, final boolean negativeStrand, final int clipPosition, final String expectedCigar, final int expectedAdjustedStart) throws IOException { List<CigarElement> cigar = TextCigarCodec.decode(inputCigar).getCigarElements(); if (negativeStrand){ List<CigarElement> copiedList = new ArrayList<CigarElement>(cigar); Collections.reverse(copiedList); cigar = copiedList; } List<CigarElement> result = CigarUtil.softClipEndOfRead(clipPosition, cigar); Cigar newCigar = new Cigar(result); Cigar oldCigar = new Cigar(cigar); if (negativeStrand){ Collections.reverse(result); newCigar = new Cigar(result); int oldLength = oldCigar.getReferenceLength(); int newLength = newCigar.getReferenceLength(); int sizeChange = oldLength - newLength; //Assert.assertEquals(sizeChange, numClippedBases + adjustment, testName + " sizeChange == numClippedBases"); Assert.assertEquals(start + sizeChange, expectedAdjustedStart, sizeChange + " " + testName); Assert.assertTrue(sizeChange >= 0, "sizeChange >= 0. " + sizeChange); } Assert.assertEquals (TextCigarCodec.encode(newCigar), expectedCigar, testName); Assert.assertEquals(newCigar.getReadLength(), oldCigar.getReadLength()); Assert.assertNull(newCigar.isValid(testName, -1)); }
final List<SAMValidationError> validationErrors = cigar.isValid(rec.getReadName(), -1); if (validationErrors != null && validationErrors.size() != 0) { log.error("Invalid cigar for read " + rec +
final List<SAMValidationError> validationErrors = cigar.isValid(rec.getReadName(), -1); if (validationErrors != null && !validationErrors.isEmpty()) { log.error("Invalid cigar for read " + rec +
final List<SAMValidationError> validationErrors = cigar.isValid(rec.getReadName(), -1); if (validationErrors != null && !validationErrors.isEmpty()) { log.error("Invalid cigar for read " + rec +