Newer
Older
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
{
handleCanvasMouseDrag(event);
}
public void mouseMoved(MouseEvent e)
{
lastMousePoint = 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);
}
mainPanel.repaint();
mainPanel.revalidate();
}
};
addMouseMotionListener(mouseMotionListener);
combo = new SequenceComboBox(seqNames){
private static final long serialVersionUID = 1L;
public void update(IndexReferenceEvent event)
{
laststart = -1;
if(feature_display != null)
setZoomLevel(feature_display.getMaxVisibleBases());
else
setZoomLevel(BamView.this.nbasesInView);
}
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
topPanel.add(combo);
if(feature_display == null)
{
final JTextField baseText = new JTextField(8);
JButton goTo = new JButton("GoTo:");
goTo.setToolTipText("Go to base position");
goTo.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try
{
int basePosition = Integer.parseInt(baseText.getText());
scrollBar.setValue(basePosition);
}
catch (NumberFormatException nfe)
{
JOptionPane.showMessageDialog(BamView.this,
"Expecting a base number!", "Number Format",
JOptionPane.WARNING_MESSAGE);
}
}
});
topPanel.add(goTo);
topPanel.add(baseText);
JButton zoomIn = new JButton("-");
zoomIn.setToolTipText("Zoom out (up arrow)");
Insets ins = new Insets(1,1,1,1);
zoomIn.setMargin(ins);
zoomIn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
setZoomLevel((int) (BamView.this.nbasesInView * 1.1));
}
});
topPanel.add(zoomIn);
JButton zoomOut = new JButton("+");
zoomOut.setToolTipText("Zoom in (down arrow)");
zoomOut.setMargin(ins);
zoomOut.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (showBaseAlignment)
return;
setZoomLevel((int) (BamView.this.nbasesInView * .9));
}
});
topPanel.add(zoomOut);
}
topPanel.add(buttonAutoHide);
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
if(feature_display != null)
{
JButton close = new JButton("Close");
topPanel.add(close);
close.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
final JPanel containerPanel = (JPanel) mainPanel.getParent();
feature_display.removeDisplayAdjustmentListener(BamView.this);
feature_display.getSelection().removeSelectionChangeListener(BamView.this);
containerPanel.remove(mainPanel);
if(containerPanel.getComponentCount() > 0)
containerPanel.revalidate();
else
{
if(entry_edit != null)
entry_edit.setNGDivider();
else
containerPanel.setVisible(false);
}
}
});
}
public void setVisible(boolean visible)
{
super.setVisible(visible);
mainPanel.setVisible(visible);
private void setViewportMidPoint()
{
Point p = jspView.getViewport().getLocation();
p.y = (getHeight() - jspView.getViewport().getViewRect().height)/2;
jspView.getViewport().setViewPosition(p);
}
private void setViewportBtm()
{
jspView.getVerticalScrollBar().setValue(
jspView.getVerticalScrollBar().getMaximum());
}
if(feature_display != null)
return feature_display.getForwardBaseAtLeftEdge();
else
return scrollBar.getValue();
}
/**
* Set the panel size based on the number of bases visible
* and repaint.
* @param nbasesInView
*/
if(isBaseAlignmentView(pixPerBase))
this.nbasesInView = (int)(mainPanel.getWidth()/pixPerBase);
if(ruler == null)
ruler = new Ruler();
jspView.setColumnHeaderView(ruler);
showBaseAlignment = true;
markInsertions.setEnabled(true);
if(!isCoverageView(pixPerBase) && nbasesInView >= MAX_BASES)
{
cbLastSelected = getSelectedCheckBoxMenuItem();
cbCoverageView.setSelected(true);
coverageView.setPlotByStrand(false);
else if(isCoverageView(pixPerBase) && nbasesInView < MAX_BASES && cbLastSelected != null)
{
cbLastSelected.setSelected(true);
cbLastSelected = null;
}
else
setViewportMidPoint();
markInsertions.setEnabled(false);
{
scrollBar.setValues(startValue, nbasesInView, 1,
getMaxBasesInPanel(getSequenceLength()));
scrollBar.setUnitIncrement(nbasesInView/20);
scrollBar.setBlockIncrement(nbasesInView);
}
* Set the start and end base positions to display.
* @param start
* @param end
* @param event
public void setDisplay(int start,
int end,
DisplayAdjustmentEvent event)
this.startBase = start;
this.endBase = end;
else
{
if(feature_display == null)
pixPerBase = 1000.f/(float)(end-start+1);
else
pixPerBase = feature_display.getWidth()/(float)(end-start+1);
}
if(event == null)
{
this.startBase = -1;
this.endBase = -1;
}
/**
* Return an Artemis entry from a file
* @param entryFileName
* @param entryGroup
* @return
* @throws NoSequenceException
*/
private Entry getEntry(final String entryFileName, final EntryGroup entryGroup)
throws NoSequenceException
{
final Document entry_document = DocumentFactory.makeDocument(entryFileName);
final EntryInformation artemis_entry_information =
Options.getArtemisEntryInformation();
//System.out.println(entryFileName);
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
return null;
Entry entry = null;
try
{
if(entryGroup.getSequenceEntry() != null)
bases = entryGroup.getSequenceEntry().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 " +
entryFileName + " has an out of range " +
"location: " + e.getMessage());
}
return entry;
}
private boolean isShowScale()
{
return (feature_display == null ? true : false);
}
public JScrollPane getJspView()
{
return jspView;
}
/**
* Handle a mouse drag event on the drawing canvas.
**/
if(event.getButton() == MouseEvent.BUTTON3 || bases == null)
tjc
committed
highlightSAMRecord = null;
if(event.getClickCount() > 1)
{
getSelection().clear();
repaint();
return;
}
highlightRange(event,
MouseEvent.BUTTON1_DOWN_MASK & MouseEvent.BUTTON2_DOWN_MASK);
}
/**
*
* @param event
* @param onmask
*/
protected void highlightRange(MouseEvent event, int onmask)
int start = (int) ( ( (event.getPoint().getX())/pixPerBase) + getBaseAtStartOfView() );
if(start < 1)
start = 1;
if(start > seqLength)
start = seqLength;
if (dragStart < 0 && (event.getModifiersEx() & onmask) == onmask)
dragStart = start;
else if((event.getModifiersEx() & onmask) != onmask)
dragStart = -1;
if(dragStart < 0)
drag_range = new MarkerRange (bases.getForwardStrand(), start, start);
else
drag_range = new MarkerRange (bases.getForwardStrand(), dragStart, start);
getSelection().setMarkerRange(drag_range);
repaint();
/**
* Get the colour for the given read given to it by the coverage plot.
* @param samRecord
* @return
*/
private Color getColourByCoverageColour(BamViewRecord samRecord)
short fileIndex = 0;
fileIndex = samRecord.bamIndex;
return getColourByCoverageColour(fileIndex);
}
private Color getColourByCoverageColour(final short fileIndex)
{
LineAttributes lines[] = CoveragePanel.getLineAttributes(bamList.size());
return lines[fileIndex].getLineColour();
}
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
protected int getMaxBases()
{
return MAX_BASES;
}
protected void setMaxBases(int max)
{
MAX_BASES = max;
}
private boolean isStackView()
{
return cbStackView.isSelected();
}
private boolean isPairedStackView()
{
return cbPairedStackView.isSelected();
}
private boolean isStrandStackView()
{
return cbStrandStackView.isSelected();
}
private boolean isCoverageView(float pixPerBase)
{
if(isBaseAlignmentView(pixPerBase))
return false;
return cbCoverageView.isSelected() || cbCoverageStrandView.isSelected() || cbCoverageHeatMap.isSelected();
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
}
private boolean isIsizeStackView()
{
return cbIsizeStackView.isSelected();
}
private boolean isBaseAlignmentView(float pixPerBase)
{
if(pixPerBase*1.08f >= ALIGNMENT_PIX_PER_BASE)
return true;
return false;
}
private JCheckBoxMenuItem getSelectedCheckBoxMenuItem()
{
if(isStackView())
return cbStackView;
if(isPairedStackView())
return cbPairedStackView;
if(isStrandStackView())
return cbStrandStackView;
if(isIsizeStackView())
return cbIsizeStackView;
if(cbCoverageView.isSelected())
return cbCoverageView;
if(cbCoverageHeatMap.isSelected())
return cbCoverageHeatMap;
protected List<BamViewRecord> getReadsInView()
protected int getBasesInView()
{
return nbasesInView;
}
protected void setHighlightSAMRecord(BamViewRecord highlightSAMRecord)
{
this.highlightSAMRecord = highlightSAMRecord;
}
protected BamViewRecord getHighlightSAMRecord()
protected FeatureDisplay getFeatureDisplay()
{
return feature_display;
}
/**
* @return the combo
*/
public SequenceComboBox getCombo()
{
return combo;
}
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
private String getVersion()
{
final ClassLoader cl = this.getClass().getClassLoader();
try
{
String line;
InputStream in = cl.getResourceAsStream("etc/versions");
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
while((line = reader.readLine()) != null)
{
if(line.startsWith("BamView"))
return line.substring( "BamView".length() ).trim();
}
reader.close();
in.close();
}
catch (Exception ex)
{
}
return null;
}
public void openBamView(final List<String> bamsList)
BamView bamView = new BamView(bamsList,
null, nbasesInView, entry_edit,
feature_display, bases, (JPanel) mainPanel.getParent(), null);
bamView.getJspView().getVerticalScrollBar().setValue(
bamView.getJspView().getVerticalScrollBar().getMaximum());
getJspView().getVerticalScrollBar().setValue(
bamView.getJspView().getVerticalScrollBar().getMaximum());
int start = getBaseAtStartOfView();
setDisplay(start, nbasesInView+start, null);
if(feature_display != null)
{
feature_display.addDisplayAdjustmentListener(bamView);
feature_display.getSelection().addSelectionChangeListener(bamView);
}
}
public void displayAdjustmentValueChanged(final DisplayAdjustmentEvent event)
if(event.getType() == DisplayAdjustmentEvent.REV_COMP_EVENT &&
event.isRevCompDisplay())
JOptionPane.showMessageDialog(this,
"Flipping the display is not supported by BamView.", "Warning",
JOptionPane.WARNING_MESSAGE);
if(!asynchronous)
{
// if not asynchronous
displayAdjustmentWork(event);
return;
}
public Object construct()
{
try
{
Thread.sleep(500);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
if(event.getStart() != ((FeatureDisplay)event.getSource()).getForwardBaseAtLeftEdge())
{
waitingFrame.showWaiting("waiting...", mainPanel);
waitingFrame.setVisible(false);
return null;
}
};
worker.start();
/**
* Carry out the display agjustment event action.
* @param event
*/
private void displayAdjustmentWork(final DisplayAdjustmentEvent event)
{
if(event.getType() == DisplayAdjustmentEvent.SCALE_ADJUST_EVENT)
{
laststart = -1;
BamView.this.startBase = event.getStart();
BamView.this.endBase = event.getEnd();
int width = feature_display.getMaxVisibleBases();
setZoomLevel(width);
repaint();
}
else
{
setDisplay(event.getStart(),
event.getStart()+feature_display.getMaxVisibleBases(), event);
repaint();
}
}
public void selectionChanged(SelectionChangeEvent event)
{
repaint();
protected int start;
protected int end;
protected String refSeq;
setPreferredSize(new Dimension(mainPanel.getWidth(), 26));
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
drawBaseScale(g2, start, end, 12);
}
private void drawBaseScale(Graphics2D g2, int start, int end, int ypos)
{
int startMark = (((int)(start/10))*10)+1;
if(end > getSequenceLength())
end = getSequenceLength();
for(int i=startMark; i<end; i+=20)
for(int i=startMark; i<end; i+=10)
{
int xpos = (i-start)*ALIGNMENT_PIX_PER_BASE;
xpos+=(ALIGNMENT_PIX_PER_BASE/2);
g2.drawLine(xpos, ypos+1, xpos, ypos+5);
}
if(refSeq != null)
{
ypos+=15;
g2.setColor(LIGHT_GREY);
g2.fillRect(0, ypos-11, getWidth(), 11);
g2.translate(0, 16);
drawSelectionRange(g2, ALIGNMENT_PIX_PER_BASE, start, end, Color.yellow);
g2.translate(0, -16);
g2.setColor(Color.black);
g2.drawString(refSeq, 0, ypos-2);
}
/**
* Popup menu listener
*/
class PopupListener extends MouseAdapter
{
private JMenuItem gotoMateMenuItem;
private JMenuItem showDetails;
private JMenu coverageMenu;
private JMenuItem createGroup;
tjc
committed
public void mouseClicked(MouseEvent e)
{
if(e.isPopupTrigger() ||
e.getButton() == MouseEvent.BUTTON3)
return;
BamView.this.requestFocus();
if(e.getClickCount() > 1)
getSelection().clear();
else if(e.getButton() == MouseEvent.BUTTON1)
{
if(isCoverageView(getPixPerBaseByWidth()))
coverageView.singleClick(e.isShiftDown(),
e.getPoint().y-getJspView().getViewport().getViewPosition().y);
else
highlightSAMRecord = mouseOverSAMRecord;
}
else
highlightRange(e, MouseEvent.BUTTON2_DOWN_MASK);
repaint();
}
public void mousePressed(MouseEvent e)
{
maybeShowPopup(e);
}
public void mouseReleased(MouseEvent e)
{
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e)
{
if(e.isPopupTrigger())
//
// coverage heatmap menu options
if(coverageMenu != null)
popup.remove(coverageMenu);
if(isCoverageView(getPixPerBaseByWidth()) && coverageView.isPlotHeatMap())
{
if(coverageMenu == null)
{
coverageMenu = new JMenu("Coverage HeatMap");
final JCheckBoxMenuItem coverageGrid = new JCheckBoxMenuItem("Show heatmap grid", false);
coverageGrid.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
coverageView.showLabels(coverageGrid.isSelected());
}
});
coverageMenu.add(coverageGrid);
createGroup = new JMenuItem("Create group from selected BAMs");
createGroup.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String groupName = "group_"+n;
groupsFrame.addGroup(groupName);
final List<String> selected = coverageView.getSelected();
for(String sel: selected)
groupsFrame.addToGroup((new File(sel)).getName(), groupName);
groupsFrame.updateAndDisplay();
n++;
}
});
coverageMenu.add(createGroup);
}
createGroup.setEnabled(coverageView.hasSelectedBams());
popup.add(coverageMenu);
}
if(gotoMateMenuItem != null)
popup.remove(gotoMateMenuItem);
tjc
committed
if(showDetails != null)
popup.remove(showDetails);
if( mouseOverSAMRecord != null &&
mouseOverSAMRecord.sam.getReadPairedFlag() &&
!mouseOverSAMRecord.sam.getMateUnmappedFlag() )
{
final BamViewRecord thisSAMRecord = mouseOverSAMRecord;
gotoMateMenuItem = new JMenuItem("Go to mate of : "+
thisSAMRecord.sam.getReadName());
gotoMateMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String name = thisSAMRecord.sam.getMateReferenceName();
if(name.equals("="))
name = thisSAMRecord.sam.getReferenceName();
int offset = getSequenceOffset(name);
if(feature_display != null)
feature_display.makeBaseVisible(
thisSAMRecord.sam.getMateAlignmentStart()+offset);
else
scrollBar.setValue(
thisSAMRecord.sam.getMateAlignmentStart()+offset-
(nbasesInView/2));
highlightSAMRecord = thisSAMRecord;
}
});
popup.add(gotoMateMenuItem);
tjc
committed
}
if( mouseOverSAMRecord != null)
{
final BamViewRecord thisSAMRecord = mouseOverSAMRecord;
tjc
committed
showDetails = new JMenuItem("Show details of : "+
thisSAMRecord.sam.getReadName());
tjc
committed
showDetails.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
openFileViewer(thisSAMRecord.sam, getMate(thisSAMRecord), bamList);
tjc
committed
});
popup.add(showDetails);
}
popup.show(e.getComponent(),
e.getX(), e.getY());
protected static void openFileViewer(SAMRecord readRecord, SAMRecord mateRecord, List<String> bamList)
{
FileViewer viewDetail = new FileViewer(readRecord.getReadName(), true, false, false);
appendToDetailView(readRecord, mateRecord, viewDetail, bamList);
private static void appendToDetailView(final SAMRecord sam,
final SAMRecord mate,
final FileViewer viewer,
final List<String> bamList)
tjc
committed
{
if(bamList.size() > 1 && sam.getAttribute("FL") != null)
int bamIdx = (Integer)sam.getAttribute("FL");
if(bamIdx < bamList.size())
viewer.appendString("File "+bamList.get(bamIdx)+"\n\n", Level.INFO);
viewer.appendString("Read Name "+sam.getReadName()+"\n", Level.INFO);
viewer.appendString("Coordinates "+sam.getAlignmentStart()+".."+
sam.getAlignmentEnd()+"\n", Level.DEBUG);
viewer.appendString("Length "+sam.getReadLength()+"\n", Level.DEBUG);
viewer.appendString("Reference Name "+sam.getReferenceName()+"\n", Level.DEBUG);
viewer.appendString("Inferred Size "+sam.getInferredInsertSize()+"\n", Level.DEBUG);
viewer.appendString("Mapping Quality "+sam.getMappingQuality()+"\n", Level.DEBUG);
viewer.appendString("Cigar String "+sam.getCigarString()+"\n", Level.DEBUG);
viewer.appendString("Strand "+
(sam.getReadNegativeStrandFlag() ? "-\n\n" : "+\n\n"), Level.DEBUG);
viewer.appendString("Mate Coordinates "+mate.getAlignmentStart()+".."+
mate.getAlignmentEnd()+"\n", Level.DEBUG);
viewer.appendString("Mate Length "+mate.getReadLength()+"\n", Level.DEBUG);
viewer.appendString("Mate Reference Name "+mate.getReferenceName()+"\n", Level.DEBUG);
viewer.appendString("Mate Inferred Size "+mate.getInferredInsertSize()+"\n", Level.DEBUG);
viewer.appendString("Mate Mapping Quality "+mate.getMappingQuality()+"\n", Level.DEBUG);
viewer.appendString("Mate Cigar String "+mate.getCigarString()+"\n", Level.DEBUG);
viewer.appendString("Mate Start Coordinate "+sam.getMateAlignmentStart()+"\n", Level.DEBUG);
viewer.appendString("Mate Reference Name "+sam.getMateReferenceName()+"\n", Level.DEBUG);
viewer.appendString("Mate Strand "+
(sam.getMateNegativeStrandFlag() ? "-" : "+"), Level.DEBUG);
tjc
committed
}
viewer.appendString("\n\nFlags:", Level.INFO);
viewer.appendString("\nDuplicate Read "+
(sam.getDuplicateReadFlag() ? "yes" : "no"), Level.DEBUG);
viewer.appendString("\nRead Paired "+
(sam.getReadPairedFlag() ? "yes" : "no"), Level.DEBUG);
if(sam.getReadPairedFlag())
viewer.appendString("\nFirst of Pair "+
(sam.getFirstOfPairFlag() ? "yes" : "no"), Level.DEBUG);
viewer.appendString("\nMate Unmapped "+
(sam.getMateUnmappedFlag() ? "yes" : "no"), Level.DEBUG);
viewer.appendString("\nProper Pair "+
(sam.getProperPairFlag() ? "yes" : "no"), Level.DEBUG);
viewer.appendString("\nRead Fails Vendor\nQuality Check "+
(sam.getReadFailsVendorQualityCheckFlag() ? "yes" : "no"), Level.DEBUG);
viewer.appendString("\nRead Unmapped "+
(sam.getReadUnmappedFlag() ? "yes" : "no"), Level.DEBUG);
if(sam.getReadPairedFlag())
viewer.appendString("\nSecond Of Pair "+
(sam.getSecondOfPairFlag() ? "yes" : "no"), Level.DEBUG);
viewer.appendString("\n\nRead Bases:\n", Level.INFO);
wrapReadBases(sam, viewer);
if(sam.getReadPairedFlag() && mate != null)
{
viewer.appendString("\nMate Read Bases:\n", Level.INFO);
wrapReadBases(mate, viewer);
}
}
private static void wrapReadBases(final SAMRecord sam,
final FileViewer viewer)
{
final String seq = new String(sam.getReadBases());
final int MAX_SEQ_LINE_LENGTH = 100;
for(int i=0; i<=seq.length(); i+=MAX_SEQ_LINE_LENGTH)
{
int iend = i+MAX_SEQ_LINE_LENGTH;
if(iend > seq.length())
iend = seq.length();
viewer.appendString(seq.substring(i, iend)+"\n", Level.DEBUG);
tjc
committed
}
/**
* Query for the mate of a read
* @param mate
* @return
*/
protected SAMRecord getMate(BamViewRecord thisSAMRecord)
if(!thisSAMRecord.sam.getReadPairedFlag()) // read is not paired in sequencing
SAMRecord mate = null;
try
{
short fileIndex = 0;
if(bamList.size()>1 && thisSAMRecord.bamIndex > 0)
fileIndex = thisSAMRecord.bamIndex;
String bam = bamList.get(fileIndex);
final SAMFileReader inputSam = getSAMFileReader(bam);
mate = inputSam.queryMate(thisSAMRecord.sam);
}
catch (Exception e)
{
logger4j.warn("WARN: BamView.getMate() :: "+e.getMessage());
e.printStackTrace();
}
return mate;
}
protected SAMRecordPredicate getSamRecordFlagPredicate()
{
return samRecordFlagPredicate;
}
protected void setSamRecordFlagPredicate(
{
laststart = -1;
lastend = -1;
this.samRecordFlagPredicate = samRecordFlagPredicate;
}
tjc
committed
protected SAMRecordMapQPredicate getSamRecordMapQPredicate()
{
return samRecordMapQPredicate;
}
protected void setSamRecordMapQPredicate(
SAMRecordMapQPredicate samRecordMapQPredicate)
{
laststart = -1;
lastend = -1;
this.samRecordMapQPredicate = samRecordMapQPredicate;
}
/**
* @return the concatSequences
*/
protected boolean isConcatSequences()
{
return concatSequences;
}
class PairedRead
{
BamViewRecord sam1;
BamViewRecord sam2;
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
}
class CreateFeatures
{
CreateFeatures(final GroupBamFrame groupsFrame)
{
final TextFieldInt threshold = new TextFieldInt();
final TextFieldInt minSize = new TextFieldInt();
final TextFieldInt minBams = new TextFieldInt();
threshold.setValue(6);
minSize.setValue(6);
minBams.setValue( (groupsFrame.getNumberOfGroups() == 1 ?
bamList.size() : groupsFrame.getMaximumBamsInGroup()) );
final JPanel gridPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
gridPanel.add(new JLabel("Minimum number of reads:"), c);
c.gridy++;
gridPanel.add(threshold, c);
c.gridy++;
gridPanel.add(new JSeparator(), c);