private void addBlock(final int tStart, final int qStart, final int blockLength) { blockList.add(new ContinuousBlock(tStart, qStart, blockLength)); }
void write(final PrintWriter writer) { writer.printf("chain\t%f\t%s\t%d\t+\t%d\t%d\t%s\t%d\t%s\t%d\t%d\t%d\n", score, fromSequenceName, fromSequenceSize, fromChainStart, fromChainEnd, toSequenceName, toSequenceSize, (toOppositeStrand ? "-": "+"), toChainStart, toChainEnd, id); for (int i = 0; i < blockList.size() - 1; ++i) { final ContinuousBlock thisBlock = blockList.get(i); final ContinuousBlock nextBlock = blockList.get(i+1); final int fromGap = nextBlock.fromStart - thisBlock.getFromEnd(); final int toGap = nextBlock.toStart - thisBlock.getToEnd(); writer.printf("%d\t%d\t%d\n", thisBlock.blockLength, fromGap, toGap); } writer.printf("%d\n", blockList.get(blockList.size() - 1).blockLength); writer.println(); }
if (lastBlock.getFromEnd() != fromChainEnd) { throw new SAMException("Last block from end != chain from end for chain " + id); if (lastBlock.getToEnd() != toChainEnd) { throw new SAMException("Last block to end < chain to end for chain " + id); final ContinuousBlock thisBlock = blockList.get(i); final ContinuousBlock prevBlock = blockList.get(i-1); if (thisBlock.fromStart < prevBlock.getFromEnd()) { throw new SAMException("Continuous block " + i + " from starts before previous block ends for chain " + id); if (thisBlock.toStart < prevBlock.getToEnd()) { throw new SAMException("Continuous block " + i + " to starts before previous block ends for chain " + id);
if (block.fromStart >= end) { break; } else if (block.getFromEnd() <= start) { continue; if (block.getFromEnd() > end) { offsetFromEnd = block.getFromEnd() - end; } else { offsetFromEnd = 0; int thisIntersection = Math.min(end, block.getFromEnd()) - Math.max(start, block.fromStart); if (thisIntersection <= 0) { throw new SAMException("Should have been some intersection.");
if (block.fromStart >= end) { break; } else if (block.getFromEnd() <= start) { continue; if (block.getFromEnd() > end) { offsetFromEnd = block.getFromEnd() - end; } else { offsetFromEnd = 0; int thisIntersection = Math.min(end, block.getFromEnd()) - Math.max(start, block.fromStart); if (thisIntersection <= 0) { throw new SAMException("Should have been some intersection.");
if (block.fromStart >= end) { break; } else if (block.getFromEnd() <= start) { continue; if (block.getFromEnd() > end) { offsetFromEnd = block.getFromEnd() - end; } else { offsetFromEnd = 0; int thisIntersection = Math.min(end, block.getFromEnd()) - Math.max(start, block.fromStart); if (thisIntersection <= 0) { throw new SAMException("Should have been some intersection.");
if (lastBlock.getFromEnd() != fromChainEnd) { throw new SAMException("Last block from end != chain from end for chain " + id); if (lastBlock.getToEnd() != toChainEnd) { throw new SAMException("Last block to end < chain to end for chain " + id); final ContinuousBlock thisBlock = blockList.get(i); final ContinuousBlock prevBlock = blockList.get(i-1); if (thisBlock.fromStart < prevBlock.getFromEnd()) { throw new SAMException("Continuous block " + i + " from starts before previous block ends for chain " + id); if (thisBlock.toStart < prevBlock.getToEnd()) { throw new SAMException("Continuous block " + i + " to starts before previous block ends for chain " + id);
if (lastBlock.getFromEnd() != fromChainEnd) { throw new SAMException("Last block from end != chain from end for chain " + id); if (lastBlock.getToEnd() != toChainEnd) { throw new SAMException("Last block to end < chain to end for chain " + id); final ContinuousBlock thisBlock = blockList.get(i); final ContinuousBlock prevBlock = blockList.get(i-1); if (thisBlock.fromStart < prevBlock.getFromEnd()) { throw new SAMException("Continuous block " + i + " from starts before previous block ends for chain " + id); if (thisBlock.toStart < prevBlock.getToEnd()) { throw new SAMException("Continuous block " + i + " to starts before previous block ends for chain " + id);
private static Interval createToInterval(final String intervalName, final TargetIntersection targetIntersection) { // Compute the query interval given the offsets of the target interval start and end into the first and // last ContinuousBlocks. int toStart = targetIntersection.chain.getBlock(targetIntersection.firstBlockIndex).toStart + targetIntersection.startOffset; int toEnd = targetIntersection.chain.getBlock(targetIntersection.lastBlockIndex).getToEnd() - targetIntersection.offsetFromEnd; if (toEnd <= toStart || toStart < 0) { throw new SAMException("Something strange lifting over interval " + intervalName); } if (targetIntersection.chain.toNegativeStrand) { // Flip if query is negative. int negativeStart = targetIntersection.chain.toSequenceSize - toEnd; int negativeEnd = targetIntersection.chain.toSequenceSize - toStart; toStart = negativeStart; toEnd = negativeEnd; } // Convert to 1-based, inclusive. return new Interval(targetIntersection.chain.toSequenceName, toStart+1, toEnd, targetIntersection.chain.toNegativeStrand, intervalName); }
private static Interval createToInterval(final String intervalName, final boolean sourceNegativeStrand, final TargetIntersection targetIntersection) { // Compute the query interval given the offsets of the target interval start and end into the first and // last ContinuousBlocks. int toStart = targetIntersection.chain.getBlock(targetIntersection.firstBlockIndex).toStart + targetIntersection.startOffset; int toEnd = targetIntersection.chain.getBlock(targetIntersection.lastBlockIndex).getToEnd() - targetIntersection.offsetFromEnd; if (toEnd <= toStart || toStart < 0) { throw new SAMException("Something strange lifting over interval " + intervalName); } if (targetIntersection.chain.toOppositeStrand) { // Flip if query is negative. int negativeStart = targetIntersection.chain.toSequenceSize - toEnd; int negativeEnd = targetIntersection.chain.toSequenceSize - toStart; toStart = negativeStart; toEnd = negativeEnd; } // Convert to 1-based, inclusive. final boolean negativeStrand = targetIntersection.chain.toOppositeStrand ? !sourceNegativeStrand : sourceNegativeStrand; return new Interval(targetIntersection.chain.toSequenceName, toStart+1, toEnd, negativeStrand, intervalName); }
private static Interval createToInterval(final String intervalName, final boolean sourceNegativeStrand, final TargetIntersection targetIntersection) { // Compute the query interval given the offsets of the target interval start and end into the first and // last ContinuousBlocks. int toStart = targetIntersection.chain.getBlock(targetIntersection.firstBlockIndex).toStart + targetIntersection.startOffset; int toEnd = targetIntersection.chain.getBlock(targetIntersection.lastBlockIndex).getToEnd() - targetIntersection.offsetFromEnd; if (toEnd <= toStart || toStart < 0) { throw new SAMException("Something strange lifting over interval " + intervalName); } if (targetIntersection.chain.toOppositeStrand) { // Flip if query is negative. int negativeStart = targetIntersection.chain.toSequenceSize - toEnd; int negativeEnd = targetIntersection.chain.toSequenceSize - toStart; toStart = negativeStart; toEnd = negativeEnd; } // Convert to 1-based, inclusive. final boolean negativeStrand = targetIntersection.chain.toOppositeStrand ? !sourceNegativeStrand : sourceNegativeStrand; return new Interval(targetIntersection.chain.toSequenceName, toStart+1, toEnd, negativeStrand, intervalName); }
void write(final PrintWriter writer) { writer.printf("chain\t%f\t%s\t%d\t+\t%d\t%d\t%s\t%d\t%s\t%d\t%d\t%d\n", score, fromSequenceName, fromSequenceSize, fromChainStart, fromChainEnd, toSequenceName, toSequenceSize, (toNegativeStrand? "-": "+"), toChainStart, toChainEnd, id); for (int i = 0; i < blockList.size() - 1; ++i) { final ContinuousBlock thisBlock = blockList.get(i); final ContinuousBlock nextBlock = blockList.get(i+1); final int fromGap = nextBlock.fromStart - thisBlock.getFromEnd(); final int toGap = nextBlock.toStart - thisBlock.getToEnd(); writer.printf("%d\t%d\t%d\n", thisBlock.blockLength, fromGap, toGap); } writer.printf("%d\n", blockList.get(blockList.size() - 1).blockLength); writer.println(); }
private void addBlock(final int tStart, final int qStart, final int blockLength) { blockList.add(new ContinuousBlock(tStart, qStart, blockLength)); }
void write(final PrintWriter writer) { writer.printf("chain\t%f\t%s\t%d\t+\t%d\t%d\t%s\t%d\t%s\t%d\t%d\t%d\n", score, fromSequenceName, fromSequenceSize, fromChainStart, fromChainEnd, toSequenceName, toSequenceSize, (toOppositeStrand ? "-": "+"), toChainStart, toChainEnd, id); for (int i = 0; i < blockList.size() - 1; ++i) { final ContinuousBlock thisBlock = blockList.get(i); final ContinuousBlock nextBlock = blockList.get(i+1); final int fromGap = nextBlock.fromStart - thisBlock.getFromEnd(); final int toGap = nextBlock.toStart - thisBlock.getToEnd(); writer.printf("%d\t%d\t%d\n", thisBlock.blockLength, fromGap, toGap); } writer.printf("%d\n", blockList.get(blockList.size() - 1).blockLength); writer.println(); }
private void addBlock(final int tStart, final int qStart, final int blockLength) { blockList.add(new ContinuousBlock(tStart, qStart, blockLength)); }