private Alignment getCurrentAlignment() throws ErrorMsg { if (!isAligned) { throw new RuntimeException("Should be called for aligned records only"); } if (alignmentIterator == null) { log.debug("Recovering SAM record after detaching from iterator. Alignment id: " + sraAlignmentId); if (sraAlignmentId == null) { throw new RuntimeException("Cannot recover SAM object after detaching from iterator: no alignment id"); } alignmentIterator = getReadCollection().getAlignment(sraAlignmentId); } return alignmentIterator; }
private Alignment getCurrentAlignment() throws ErrorMsg { if (!isAligned) { throw new RuntimeException("Should be called for aligned records only"); } if (alignmentIterator == null) { log.debug("Recovering SAM record after detaching from iterator. Alignment id: " + sraAlignmentId); if (sraAlignmentId == null) { throw new RuntimeException("Cannot recover SAM object after detaching from iterator: no alignment id"); } alignmentIterator = getReadCollection().getAlignment(sraAlignmentId); } return alignmentIterator; }
private Read getCurrentUnalignedRead() throws ErrorMsg { if (isAligned) { throw new RuntimeException("Should be called for unaligned records only"); } if (unalignmentIterator == null) { log.debug("Recovering SAM record after detaching from iterator. Read id: " + sraReadId + ", fragment index: " + unalignedReadFragmentIndex); if (sraReadId == null) { throw new RuntimeException("Cannot recover SAM object after detaching from iterator: no read id"); } Read read = getReadCollection().getRead(sraReadId); for (int i = 0; i < unalignedReadFragmentIndex + 1; i++) { read.nextFragment(); } unalignmentIterator = read; } return unalignmentIterator; }
private Read getCurrentUnalignedRead() throws ErrorMsg { if (isAligned) { throw new RuntimeException("Should be called for unaligned records only"); } if (unalignmentIterator == null) { log.debug("Recovering SAM record after detaching from iterator. Read id: " + sraReadId + ", fragment index: " + unalignedReadFragmentIndex); if (sraReadId == null) { throw new RuntimeException("Cannot recover SAM object after detaching from iterator: no read id"); } Read read = getReadCollection().getRead(sraReadId); for (int i = 0; i < unalignedReadFragmentIndex + 1; i++) { read.nextFragment(); } unalignmentIterator = read; } return unalignmentIterator; }
private String getAttributeGroupNameImpl() { try { String readGroupName; if (isAligned) { readGroupName = getCurrentAlignment().getReadGroup(); } else { readGroupName = getCurrentUnalignedRead().getReadGroup(); } if (!readGroupName.isEmpty()) { return readGroupName; } return getReadCollection().getName(); } catch (ErrorMsg e) { throw new RuntimeException(e); } } }
private String getAttributeGroupNameImpl() { try { String readGroupName; if (isAligned) { readGroupName = getCurrentAlignment().getReadGroup(); } else { readGroupName = getCurrentUnalignedRead().getReadGroup(); } if (!readGroupName.isEmpty()) { return readGroupName; } return getReadCollection().getName(); } catch (ErrorMsg e) { throw new RuntimeException(e); } } }