Newer
Older
/* VCFview
*
* created: July 2010
*
* This file is part of Artemis
*
* Copyright(C) 2010 Genome Research Limited
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or(at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package uk.ac.sanger.artemis.components.variant;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.regex.Pattern;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.text.JTextComponent;
import net.sf.samtools.util.BlockCompressedInputStream;
import org.apache.log4j.Level;
import uk.ac.sanger.artemis.Entry;
import uk.ac.sanger.artemis.EntryGroup;
import uk.ac.sanger.artemis.Feature;
import uk.ac.sanger.artemis.FeatureKeyPredicate;
import uk.ac.sanger.artemis.FeatureVector;
import uk.ac.sanger.artemis.SelectionChangeEvent;
import uk.ac.sanger.artemis.SelectionChangeListener;
import uk.ac.sanger.artemis.components.DisplayAdjustmentEvent;
import uk.ac.sanger.artemis.components.DisplayAdjustmentListener;
import uk.ac.sanger.artemis.components.EntryEdit;
import uk.ac.sanger.artemis.components.FeatureDisplay;
import uk.ac.sanger.artemis.components.FileViewer;
import uk.ac.sanger.artemis.components.MessageDialog;
import uk.ac.sanger.artemis.components.MultiComparator;
import uk.ac.sanger.artemis.components.genebuilder.AutoCompleteComboDocument;
import uk.ac.sanger.artemis.editor.MultiLineToolTipUI;
import uk.ac.sanger.artemis.io.EntryInformation;
import uk.ac.sanger.artemis.io.Key;
import uk.ac.sanger.artemis.io.RangeVector;
import uk.ac.sanger.artemis.sequence.MarkerRange;
import uk.ac.sanger.artemis.sequence.NoSequenceException;
import uk.ac.sanger.artemis.util.Document;
import uk.ac.sanger.artemis.util.DocumentFactory;
import uk.ac.sanger.artemis.util.FTPSeekableStream;
import uk.ac.sanger.artemis.util.OutOfRangeException;
public class VCFview extends JPanel
implements DisplayAdjustmentListener, SelectionChangeListener
{
private static final long serialVersionUID = 1L;
private JScrollBar scrollBar;
private List<Integer> hideVcfList = new Vector<Integer>();
private FeatureDisplay feature_display;
private EntryGroup entryGroup;
private VCFRecord mouseVCF;
//record of where a mouse drag starts
private int dragStart = -1;
private JMenu vcfFilesMenu = new JMenu("VCF files");
protected boolean showSynonymous = true;
protected boolean showNonSynonymous = true;
protected boolean showDeletions = true;
protected boolean showInsertions = true;
protected boolean showMultiAlleles = true;
// show variants that do not overlap CDS
protected boolean showNonOverlappings = true;
protected boolean showNonVariants = false;
new JCheckBoxMenuItem("Mark new stops within CDS features", true);
private static int VARIANT_COLOUR_SCHEME = 0;
private static int SYN_COLOUR_SCHEME = 1;
private static int QUAL_COLOUR_SCHEME = 2;
private int colourScheme = 0;
private Color colMap[] = makeColours(Color.RED, 255);
Hashtable<String, Integer> offsetLengths = null;
private boolean concatSequences = false;
protected static Pattern tabPattern = Pattern.compile("\t");
public static String VCFFILE_SUFFIX = ".*\\.[bv]{1}cf(\\.gz)*$";
private static String FILE_SUFFIX = "\\.[bv]{1}cf(\\.gz)*$";
private List<Integer> cacheVariantLines;
public static org.apache.log4j.Logger logger4j =
org.apache.log4j.Logger.getLogger(VCFview.class);
public VCFview(final JFrame frame,
final JPanel vcfPanel,
final List<String> vcfFiles,
final int nbasesInView,
final int seqLength,
final String chr,
final String reference,
final FeatureDisplay feature_display)
{
super();
this.nbasesInView = nbasesInView;
this.seqLength = seqLength;
this.chr = chr;
this.feature_display = feature_display;
this.vcfPanel = vcfPanel;
setBackground(Color.white);
MultiLineToolTipUI.initialize();
setToolTipText("");
vcfPanel.setPreferredSize(new Dimension(900,
(vcfFiles.size()+1)*(LINE_HEIGHT+5)));
this.entryGroup = feature_display.getEntryGroup();
this.entryGroup = getReference(reference);
if(entryGroup != null)
this.seqLength = entryGroup.getSequenceEntry().getBases().getLength();
header = new String[vcfFiles.size()];
for(int i=0; i<vcfFiles.size(); i++)
{
catch(java.lang.UnsupportedClassVersionError err)
{
JOptionPane.showMessageDialog(null,
"This requires Java 1.6 or higher.",
"Check Java Version", JOptionPane.WARNING_MESSAGE);
}
final JScrollPane jspView = new JScrollPane(this,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
vcfPanel.setLayout(new BorderLayout());
vcfPanel.add(jspView, BorderLayout.CENTER);
JPanel bottomPanel = new JPanel(new BorderLayout());
graphPanel = new GraphPanel(this);
graphPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.gray));
graphPanel.setPreferredSize(new Dimension(900, 100));
graphPanel.setVisible(false);
bottomPanel.add(graphPanel, BorderLayout.CENTER);
vcfPanel.add(bottomPanel, BorderLayout.SOUTH);
if(this.nbasesInView > this.seqLength)
this.nbasesInView = this.seqLength/2;
scrollBar = new JScrollBar(JScrollBar.HORIZONTAL, 1, this.nbasesInView, 1, this.seqLength);
scrollBar.setUnitIncrement(nbasesInView/20);
scrollBar.addAdjustmentListener(new AdjustmentListener()
{
public void adjustmentValueChanged(AdjustmentEvent e)
{
repaint();
}
});
//
//
addMouseListener(new PopupListener());
//
setDisplay();
if(feature_display == null)
{
bottomPanel.add(scrollBar, BorderLayout.SOUTH);
}
else
{
Border empty = new EmptyBorder(0,0,0,0);
jspView.setBorder(empty);
private void createMenus(final JFrame frame, final JScrollPane jspView)
if(feature_display != null)
topPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
else
{
markNewStops.setSelected(false);
markNewStops.setEnabled(false);
if(frame != null)
frame.setJMenuBar((JMenuBar)topPanel);
JMenu fileMenu = new JMenu("File");
topPanel.add(fileMenu);
JMenuItem printImage = new JMenuItem("Save As Image Files (png/jpeg)...");
printImage.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
{
PrintVCFview part = new PrintVCFview(VCFview.this);
part.print();
}
});
fileMenu.add(printImage);
JMenuItem printPS = new JMenuItem("Print...");
printPS.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
{
PrintVCFview part = new PrintVCFview(VCFview.this);
part.validate();
part.doPrintActions();
}
});
fileMenu.add(printPS);
JMenuItem close = new JMenuItem("Close");
fileMenu.add(close);
close.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
{
VCFview.this.setVisible(false);
Component comp = VCFview.this;
while( !(comp instanceof JFrame) )
comp = comp.getParent();
((JFrame)comp).dispose();
}
});
JButton zoomIn = new JButton("-");
Insets ins = new Insets(1,1,1,1);
zoomIn.setMargin(ins);
zoomIn.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
{
setZoomLevel((int) (VCFview.this.nbasesInView * 1.1));
}
});
topPanel.add(zoomIn);
JButton zoomOut = new JButton("+");
zoomOut.setMargin(ins);
zoomOut.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
{
setZoomLevel((int) (VCFview.this.nbasesInView * .9));
}
});
topPanel.add(zoomOut);
}
final JComboBox combo = new JComboBox(vcfReaders[0].getSeqNames());
combo.setEditable(true);
JTextComponent editor = (JTextComponent) combo.getEditor().getEditorComponent();
editor.setDocument(new AutoCompleteComboDocument(combo));
combo.setSelectedItem(this.chr);
combo.setMaximumRowCount(20);
combo.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
if(combo.getSelectedItem().equals("Combine References"))
concatSequences = true;
else
{
VCFview.this.chr = (String) combo.getSelectedItem();
concatSequences = false;
}
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
if(topPanel instanceof JPanel)
vcfPanel.add(topPanel, BorderLayout.NORTH);
// auto hide top panel
final JCheckBox buttonAutoHide = new JCheckBox("Hide", true);
buttonAutoHide.setToolTipText("Auto-Hide");
topPanel.add(buttonAutoHide);
final MouseMotionListener mouseMotionListener = new MouseMotionListener()
{
public void mouseDragged(MouseEvent event)
{
handleCanvasMouseDrag(event);
}
public void mouseMoved(MouseEvent e)
{
findVariantAtPoint(e.getPoint());
int thisHgt = HEIGHT;
if (thisHgt < 5)
thisHgt = 15;
int y = (int) (e.getY() - jspView.getViewport().getViewRect().getY());
if (y < thisHgt)
topPanel.setVisible(true);
else
{
if (buttonAutoHide.isSelected())
topPanel.setVisible(false);
}
}
};
addMouseMotionListener(mouseMotionListener);
// popup menu
popup = new JPopupMenu();
JMenuItem addVCFMenu = new JMenuItem("Add VCF ...");
addVCFMenu.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
FileSelectionDialog fileSelection = new FileSelectionDialog(
null, true, "VCFview", "VCF");
List<String> vcfFileList = fileSelection.getFiles(VCFFILE_SUFFIX);
AbstractVCFReader[] trTmp = new AbstractVCFReader[count + vcfReaders.length];
System.arraycopy(vcfReaders, 0, trTmp, 0, vcfReaders.length);
vcfReaders = trTmp;
System.arraycopy(header, 0, hdTmp, 0, header.length);
header = hdTmp;
for (int i = 0; i < vcfFileList.size(); i++)
header[i+oldSize] = readHeader(vcfFileList.get(i), i+oldSize);
for(int i=0; i<vcfFileList.size(); i++)
addToViewMenu(i+oldSize);
setDisplay();
repaint();
jspView.revalidate();
}
});
popup.add(addVCFMenu);
popup.add(vcfFilesMenu);
for(int i=0; i<vcfFiles.size(); i++)
addToViewMenu(i);
markNewStops.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(!markNewStops.isSelected())
markAsNewStop = false;
repaint();
}
});
popup.add(markNewStops);
final JMenuItem byQuality = new JMenuItem("Filter ...");
byQuality.addActionListener(new ActionListener(){
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
final JMenu colourBy = new JMenu("Colour By");
popup.add(colourBy);
ButtonGroup group = new ButtonGroup();
final JRadioButtonMenuItem colByAlt = new JRadioButtonMenuItem("Variant");
colByAlt.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(colByAlt.isSelected())
colourScheme = 0;
repaint();
}
});
colourBy.add(colByAlt);
final JRadioButtonMenuItem colBySyn = new JRadioButtonMenuItem("Synonymous/Non-synonymous");
colBySyn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(colBySyn.isSelected())
colourScheme = 1;
repaint();
}
});
colourBy.add(colBySyn);
final JRadioButtonMenuItem colByScore = new JRadioButtonMenuItem("Score");
colByScore.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(colByScore.isSelected())
colourScheme = 2;
repaint();
}
});
colourBy.add(colByScore);
group.add(colByAlt);
group.add(colBySyn);
group.add(colByScore);
colByAlt.setSelected(true);
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
if (feature_display != null)
{
final JMenu create = new JMenu("Create");
final JMenuItem createTab = new JMenuItem(
"Features from variants");
popup.add(create);
create.add(createTab);
createTab.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Container f = getVcfContainer();
try
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.createFeatures(VCFview.this, entryGroup);
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
}
});
}
final JMenu export = new JMenu("Write");
popup.add(export);
final JMenuItem exportVCF = new JMenuItem("Filtered VCF");
exportVCF.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
Container f = getVcfContainer();
try
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.export(vcfFiles, VCFview.this);
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
export.add(exportVCF);
final JMenuItem exportFastaSelected = new JMenuItem("FASTA of selected feature(s) ...");
exportFastaSelected.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
Container f = getVcfContainer();
try
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.exportFasta(VCFview.this, selection.getAllFeatures(), false, null);
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
}
});
export.add(exportFastaSelected);
final JMenuItem exportFasta = new JMenuItem("FASTA of selected base range ...");
exportFasta.addActionListener(new ActionListener(){
Container f = getVcfContainer();
try
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.exportFastaByRange(VCFview.this, selection, false, null);
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
final JMenu view = new JMenu("View");
popup.add(view);
final JMenuItem viewFastaSelected = new JMenuItem("FASTA of selected feature(s) ...");
viewFastaSelected.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
Container f = getVcfContainer();
try
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.exportFasta(VCFview.this, selection.getAllFeatures(), true, null);
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
}
});
final JMenuItem viewFasta = new JMenuItem("FASTA of selected base range ...");
viewFasta.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
Container f = getVcfContainer();
try
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.exportFastaByRange(VCFview.this, selection, true, null);
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
JMenu graph = new JMenu("Graph");
popup.add(graph);
final JCheckBoxMenuItem graphSNP = new JCheckBoxMenuItem("SNP");
final JCheckBoxMenuItem graphDP = new JCheckBoxMenuItem("Depth (DP)");
graph.add(graphSNP);
graphSNP.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
graphPanel.setVisible(graphSNP.isSelected());
graphDP.setSelected(false);
graphPanel.setType(0);
graphPanel.repaint();
}
});
graph.add(graphDP);
graphDP.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
graphPanel.setVisible(graphDP.isSelected());
graphSNP.setSelected(false);
graphPanel.setType(1);
graphPanel.repaint();
}
});
final JMenuItem snpOverview = new JMenuItem("Overview for selected features");
popup.add(snpOverview);
snpOverview.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
f.setCursor(new Cursor(Cursor.WAIT_CURSOR));
IOUtils.countVariants(VCFview.this, selection.getAllFeatures());
}
catch (IOException e1)
{
JOptionPane.showMessageDialog(null, e1.getMessage());
}
finally
{
f.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
}
});
final JCheckBoxMenuItem labels = new JCheckBoxMenuItem("Show Labels", showLabels);
labels.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
showLabels = labels.isSelected();
repaint();
}
});
popup.add(new JSeparator());
popup.add(labels);
private void addToViewMenu(final int thisBamIndex)
{
final JCheckBoxMenuItem cbBam = new JCheckBoxMenuItem(
getLabel(thisBamIndex), true);
vcfFilesMenu.add(cbBam);
cbBam.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(cbBam.isSelected())
hideVcfList.remove(new Integer(thisBamIndex));
else
hideVcfList.add(new Integer(thisBamIndex));
repaint();
}
});
}
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
private static EntryGroup getReference(String reference)
{
EntryGroup entryGroup = new SimpleEntryGroup();
final Document entry_document = DocumentFactory.makeDocument(reference);
final EntryInformation artemis_entry_information =
Options.getArtemisEntryInformation();
final uk.ac.sanger.artemis.io.Entry new_embl_entry =
EntryFileDialog.getEntryFromFile(null, entry_document,
artemis_entry_information,
false);
if(new_embl_entry != null) // the read failed
{
Entry entry = null;
Bases bases = null;
try
{
if (entryGroup.getSequenceEntry() != null)
bases = entryGroup.getSequenceEntry().getBases();
if (bases == null)
{
entry = new Entry(new_embl_entry);
bases = entry.getBases();
}
else
entry = new Entry(bases, new_embl_entry);
entryGroup.add(entry);
}
catch (OutOfRangeException e)
{
new MessageDialog(null, "read failed: one of the features in "
+ reference + " has an out of range " + "location: "
+ e.getMessage());
}
catch (NoSequenceException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return entryGroup;
}
/**
* Test and download if on a http server
* @param fileName
* @return
*/
if(!fileName.startsWith("http:") && !fileName.startsWith("ftp:"))
return download(fileName+".tbi", ".tbi");
protected String download(String f, String suffix)
{
try
{
final URL urlFile = new URL(f);
InputStream is = urlFile.openStream();
// Create temp file.
String name = urlFile.getFile();
int ind = name.lastIndexOf('/');
if(ind > -1)
name = name.substring(ind+1);
File bcfFile = File.createTempFile(name.replaceAll("[\\/\\s]", "_"), suffix);
bcfFile.deleteOnExit();
FileOutputStream out = new FileOutputStream(bcfFile);
int c;
while ((c = is.read()) != -1)
out.write(c);
out.flush();
out.close();
is.close();
return bcfFile.getAbsolutePath();
}
catch(IOException ioe)
{
JOptionPane.showMessageDialog(null,
"Problem downloading\n"+f,
"Problem", JOptionPane.WARNING_MESSAGE);
}
return null;
}
/**
* Read the vcf header
* @param fileName
* @return
*/
private String readHeader(String fileName, int index)
{
StringBuffer buff = new StringBuffer();
buff.append(fileName+"\n");
try
{
String hdr = ((BCFReader)vcfReaders[index]).headerToString();
if(hdr.indexOf("VCFv4") > -1)
vcfReaders[index].setVcf_v4(true);
String indexfileName = testForURL(fileName, false);
BlockCompressedInputStream is;
if(fileName.startsWith("http")|| fileName.startsWith("ftp"))
{
URL url = new URL(fileName);
if(fileName.startsWith("ftp"))
vcfReaders[index] = new TabixReader(indexfileName.substring(0, indexfileName.length()-4), new FTPSeekableStream(url));
else
vcfReaders[index] = new TabixReader(indexfileName.substring(0, indexfileName.length()-4), url);
is = new BlockCompressedInputStream(url);
}
else
{
vcfReaders[index] = new TabixReader(fileName);
is = new BlockCompressedInputStream(new FileInputStream(fileName));
}
vcfReaders[index].setVcf_v4(true);
return buff.toString();
}
/**
* Set the number of bases being displayed
* @param nbasesInView
*/
private void setZoomLevel(final int nbasesInView)
{
int startValue = scrollBar.getValue();
this.nbasesInView = nbasesInView;
float pixPerBase = getPixPerBaseByWidth();
this.nbasesInView = (int)(getWidth()/pixPerBase);
if(scrollBar != null)
{
scrollBar.setValues(startValue, nbasesInView, 1, seqLength);
scrollBar.setUnitIncrement(nbasesInView/20);
scrollBar.setBlockIncrement(nbasesInView);
}
}
public String getToolTipText()
{
"Seq: "+mouseVCF.getChrom()+"\n";
msg += "Pos: "+mouseVCF.getPos()+"\n";
msg += "ID: "+mouseVCF.getID()+"\n";
msg += "Variant: "+mouseVCF.getRef()+" -> "+mouseVCF.getAlt().toString()+"\n";
msg += "Qual: "+mouseVCF.getQuality()+"\n";
String pl;
if((pl = mouseVCF.getFormatValue("PL")) != null && pl.split(",").length > 1)
msg += "Genotype likelihood (PL): "+pl+"\n";
/**
* For VCF files with multiple references sequences, calculate
* the offset from the start of the concatenated sequence for
* a given reference.
* @param refName
* @return
*/
protected int getSequenceOffset(String refName)
{
if(!concatSequences)
return 0;
if(offsetLengths == null)
{
FeatureVector features = entryGroup.getAllFeatures();
offsetLengths = new Hashtable<String, Integer>(contigs.length);
for(int i=0; i<contigs.length; i++)
{
FeatureContigPredicate predicate = new FeatureContigPredicate(contigs[i]);
for(int j=0; j<features.size(); j++)
{
if(predicate.testPredicate(features.elementAt(j)))
{
offsetLengths.put(contigs[i], features.elementAt(j).getFirstBase()-1);
break;
}
}
}
tjc
committed
if(offsetLengths.size() != contigs.length)
System.err.println("Number of contigs found : "+offsetLengths.size() +
"\nNumber of contigs in VCF: "+contigs.length);
tjc
committed
JOptionPane.showMessageDialog(this,
"There is a problem matching the reference sequences\n"+
"to the names in the VCF file. This may mean the labels\n"+
"on the reference features do not match those in the in\n"+
"the VCF file.",
"Problem Found", JOptionPane.WARNING_MESSAGE);
}
return offsetLengths.get(refName);
}
public void repaint()
{
super.repaint();
if(graphPanel != null && graphPanel.isVisible())
graphPanel.repaint();
}
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
drawSelectionRange((Graphics2D)g, pixPerBase, start, end);
FeatureVector features = getCDSFeaturesInRange(start, end);
if(hideVcfList.contains(i))
continue;
for(int j=0; j<contigs.length; j++)
{