Newer
Older
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);
}
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
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);
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
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();
}
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
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();
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
}
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;
}
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
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 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())
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
//
// 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("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)
{
}
});
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 thisSAMRecord,
final SAMRecord thisSAMRecordMate,
final FileViewer viewDetail,
final List<String> bamList)
tjc
committed
{
if(bamList.size() > 1 && thisSAMRecord.getAttribute("FL") != null)
{
int bamIndex = (Integer)thisSAMRecord.getAttribute("FL");
if(bamIndex < bamList.size())
viewDetail.appendString("File "+bamList.get(bamIndex)+"\n\n", Level.INFO);
}
tjc
committed
viewDetail.appendString("Read Name "+thisSAMRecord.getReadName()+"\n", Level.INFO);
viewDetail.appendString("Coordinates "+thisSAMRecord.getAlignmentStart()+".."+
thisSAMRecord.getAlignmentEnd()+"\n", Level.DEBUG);
viewDetail.appendString("Length "+thisSAMRecord.getReadLength()+"\n", Level.DEBUG);
viewDetail.appendString("Reference Name "+thisSAMRecord.getReferenceName()+"\n", Level.DEBUG);
viewDetail.appendString("Inferred Size "+thisSAMRecord.getInferredInsertSize()+"\n", Level.DEBUG);
viewDetail.appendString("Mapping Quality "+thisSAMRecord.getMappingQuality()+"\n", Level.DEBUG);
viewDetail.appendString("Cigar String "+thisSAMRecord.getCigarString()+"\n", Level.DEBUG);
viewDetail.appendString("Strand "+
(thisSAMRecord.getReadNegativeStrandFlag() ? "-\n\n" : "+\n\n"), Level.DEBUG);
if(thisSAMRecord.getReadPairedFlag() && !thisSAMRecord.getMateUnmappedFlag())
{
if(thisSAMRecordMate != null)
{
viewDetail.appendString("Mate Coordinates "+thisSAMRecordMate.getAlignmentStart()+".."+
thisSAMRecordMate.getAlignmentEnd()+"\n", Level.DEBUG);
viewDetail.appendString("Mate Length "+thisSAMRecordMate.getReadLength()+"\n", Level.DEBUG);
viewDetail.appendString("Mate Reference Name "+thisSAMRecordMate.getReferenceName()+"\n", Level.DEBUG);
viewDetail.appendString("Mate Inferred Size "+thisSAMRecordMate.getInferredInsertSize()+"\n", Level.DEBUG);
viewDetail.appendString("Mate Mapping Quality "+thisSAMRecordMate.getMappingQuality()+"\n", Level.DEBUG);
viewDetail.appendString("Mate Cigar String "+thisSAMRecordMate.getCigarString()+"\n", Level.DEBUG);
}
else
{
viewDetail.appendString("Mate Start Coordinate "+thisSAMRecord.getMateAlignmentStart()+"\n", Level.DEBUG);
viewDetail.appendString("Mate Reference Name "+thisSAMRecord.getMateReferenceName()+"\n", Level.DEBUG);
}
viewDetail.appendString("Mate Strand "+
(thisSAMRecord.getMateNegativeStrandFlag() ? "-" : "+"), Level.DEBUG);
tjc
committed
}
else
{
viewDetail.appendString("Mate Unmapped ", Level.DEBUG);
tjc
committed
}
viewDetail.appendString("\n\nFlags:", Level.INFO);
viewDetail.appendString("\nDuplicate Read "+
(thisSAMRecord.getDuplicateReadFlag() ? "yes" : "no"), Level.DEBUG);
viewDetail.appendString("\nRead Paired "+
(thisSAMRecord.getReadPairedFlag() ? "yes" : "no"), Level.DEBUG);
if(thisSAMRecord.getReadPairedFlag())
{
viewDetail.appendString("\nFirst of Pair "+
tjc
committed
(thisSAMRecord.getFirstOfPairFlag() ? "yes" : "no"), Level.DEBUG);
tjc
committed
(thisSAMRecord.getMateUnmappedFlag() ? "yes" : "no"), Level.DEBUG);
tjc
committed
(thisSAMRecord.getProperPairFlag() ? "yes" : "no"), Level.DEBUG);
tjc
committed
viewDetail.appendString("\nRead Fails Vendor\nQuality Check "+
(thisSAMRecord.getReadFailsVendorQualityCheckFlag() ? "yes" : "no"), Level.DEBUG);
viewDetail.appendString("\nRead Unmapped "+
(thisSAMRecord.getReadUnmappedFlag() ? "yes" : "no"), Level.DEBUG);
if(thisSAMRecord.getReadPairedFlag())
viewDetail.appendString("\nSecond Of Pair "+
tjc
committed
(thisSAMRecord.getSecondOfPairFlag() ? "yes" : "no"), Level.DEBUG);
viewDetail.appendString("\n\nRead Bases:\n", Level.INFO);
// wrap the read bases
String seq = new String(thisSAMRecord.getReadBases());
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();
viewDetail.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
thisSAMRecord.sam.getMateUnmappedFlag())
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)
{
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;
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
}
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);
c.gridy++;
gridPanel.add(new JLabel("Minimum number of BAMs for reads to be present in:"), c);
c.gridy++;
gridPanel.add(minBams, c);
JRadioButton useAllBams = new JRadioButton("out of all BAMs", (groupsFrame.getNumberOfGroups() == 1));
JRadioButton useGroup = new JRadioButton("within a group", (groupsFrame.getNumberOfGroups() != 1));
if(groupsFrame.getNumberOfGroups() == 1)
useGroup.setEnabled(false);
final ButtonGroup group = new ButtonGroup();
group.add(useAllBams);
group.add(useGroup);
final Box xBox = Box.createHorizontalBox();
xBox.add(useAllBams);
xBox.add(useGroup);
xBox.add(Box.createHorizontalGlue());
c.gridy++;
gridPanel.add(xBox, c);
c.gridy++;
gridPanel.add(new JSeparator(), c);
c.gridy++;
gridPanel.add(new JLabel("Minimum feature size:"), c);
c.gridy++;
gridPanel.add(minSize, c);
final JCheckBox cbOpposite = new JCheckBox("Assume reads on opposite strand", false);
cbOpposite.setToolTipText("for cDNA experiments when the reads are on the opposite strand");
c.gridy++;
gridPanel.add(cbOpposite, c);
int status =
JOptionPane.showConfirmDialog(feature_display, gridPanel,
"Options", JOptionPane.OK_CANCEL_OPTION);
if(status == JOptionPane.CANCEL_OPTION)
return;
if(!useGroup.isSelected() && minBams.getValue() > bamList.size())
{
status =
JOptionPane.showConfirmDialog(feature_display,
"The minimum number of BAMs setting can not be\n"+
"greater than the total number of BAM files.\n"+