From a6bc0eea3c5c17e824d9922ec742bc30814f70a0 Mon Sep 17 00:00:00 2001 From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04> Date: Wed, 30 Jun 2010 13:51:08 +0000 Subject: [PATCH] fix for zoomed in nucleotide view showing reads with gaps joined by lines git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@14129 ee4ac58c-ac51-4696-9907-e4b3aa274f04 --- .../artemis/components/alignment/BamView.java | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/uk/ac/sanger/artemis/components/alignment/BamView.java b/uk/ac/sanger/artemis/components/alignment/BamView.java index 9b579072a..82a69a680 100644 --- a/uk/ac/sanger/artemis/components/alignment/BamView.java +++ b/uk/ac/sanger/artemis/components/alignment/BamView.java @@ -878,8 +878,10 @@ public class BamView extends JPanel g2.drawString(readSeq.substring(readPos, readPos+1), refPos*ALIGNMENT_PIX_PER_BASE, ypos); + + } - + // look for insertions if(markInsertions.isSelected() && i < blocks.size()-1) { @@ -905,24 +907,44 @@ public class BamView extends JPanel g2.setColor(col); } } + + // highlight + if(highlightSAMRecord != null && + highlightSAMRecord.getReadName().equals(samRecord.getReadName())) + { + refPos = block.getReferenceStart() + offset - refSeqStart; + int xstart = refPos*ALIGNMENT_PIX_PER_BASE; + int width = block.getLength()*ALIGNMENT_PIX_PER_BASE; + Color col1 = g2.getColor(); + g2.setColor(Color.red); + g2.drawRect(xstart, ypos-BASE_HEIGHT, width, BASE_HEIGHT); + if(i < blocks.size()-1) + { + int nextStart = + (blocks.get(i+1).getReferenceStart() + offset - refSeqStart)*ALIGNMENT_PIX_PER_BASE; + g2.drawLine(xstart+width, ypos-(BASE_HEIGHT/2), nextStart, ypos-(BASE_HEIGHT/2)); + } + + g2.setColor(col1); + } + else if(i < blocks.size()-1) + { + refPos = block.getReferenceStart() + offset - refSeqStart; + int xstart = refPos*ALIGNMENT_PIX_PER_BASE; + int width = block.getLength()*ALIGNMENT_PIX_PER_BASE; + int nextStart = + (blocks.get(i+1).getReferenceStart() + offset - refSeqStart)*ALIGNMENT_PIX_PER_BASE; + g2.drawLine(xstart+width, ypos-(BASE_HEIGHT/2), nextStart, ypos-(BASE_HEIGHT/2)); + } } - // highlight - if(highlightSAMRecord != null && - highlightSAMRecord.getReadName().equals(samRecord.getReadName()) && - blocks.size() > 0) - { - refPos = blocks.get(0).getReferenceStart()+offset-refSeqStart; - int xstart = refPos*ALIGNMENT_PIX_PER_BASE; - int width = len*ALIGNMENT_PIX_PER_BASE; - g2.setColor(Color.red); - g2.drawRect(xstart, ypos-BASE_HEIGHT, width, BASE_HEIGHT); - } - if(lastMousePoint != null && blocks.size() > 0) { refPos = blocks.get(0).getReferenceStart()+offset-refSeqStart; int xstart = refPos*ALIGNMENT_PIX_PER_BASE; + + refPos = blocks.get(blocks.size()-1).getReferenceStart()+ + blocks.get(blocks.size()-1).getLength()+offset-refSeqStart; int xend = (refPos+len)*ALIGNMENT_PIX_PER_BASE; if(lastMousePoint.getY() > ypos-11 && lastMousePoint.getY() < ypos) -- GitLab