Newer
Older
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);
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
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"+
"Set this to the number of BAMs (i.e. "+bamList.size()+").",
"Options", JOptionPane.OK_CANCEL_OPTION);
if(status == JOptionPane.CANCEL_OPTION)
return;
minBams.setValue(bamList.size());
}
else if(useGroup.isSelected() && minBams.getValue() > groupsFrame.getMaximumBamsInGroup())
{
status =
JOptionPane.showConfirmDialog(feature_display,
"Minimum number of BAMs setting can not be greater than\n"+
"the total number of BAM files found in any of the groups.\n"+
"Set this to the greatest number of BAM files in any\n"+
"group (i.e. "+groupsFrame.getMaximumBamsInGroup()+").",
"Options", JOptionPane.OK_CANCEL_OPTION);
if(status == JOptionPane.CANCEL_OPTION)
return;
minBams.setValue(groupsFrame.getMaximumBamsInGroup());
}
new MappedReads((String)combo.getSelectedItem(),BamView.this, samFileReaderHash,
seqNames, offsetLengths, concatSequences, seqLengths,
(useGroup.isSelected() ? groupsFrame : null), threshold.getValue(),
minSize.getValue(), minBams.getValue(), cbOpposite.isSelected(), true);
}
}
if(args.length == 0 && BamFrame.isMac())
{
try
{
Thread.sleep(1000);
}
catch (InterruptedException e1) {}
if(args.length == 0 || args[0].equals("NEW-BAMVIEW"))
System.setProperty("default_directory", System.getProperty("user.dir"));
FileSelectionDialog fileSelection = new FileSelectionDialog(
null, true, "BamView", "BAM");
reference = fileSelection.getReferenceFile();
if(reference == null || reference.equals(""))
reference = null;
if(args.length > 0 && args[0].equals("NEW-BAMVIEW"))
return;
System.err.println("No files found.");
else if(!args[0].startsWith("-"))
{
for(int i=0; i< args.length; i++)
bam.add(args[i]);
}
String chr = null;
String vw = null;
boolean orientation = false;
boolean covPlot = false;
boolean snpPlot = false;
int base = 0;
{
while(i < args.length-1 && !args[++i].startsWith("-"))
{
String filename = args[i];
if(FileSelectionDialog.isListOfFiles(filename))
bam.addAll(FileSelectionDialog.getListOfFiles(filename));
else
bam.add(filename);
}
nbasesInView = Integer.parseInt(args[++i]);
else if(args[i].equals("-s"))
System.setProperty("samtoolDir", args[++i]);
else if(args[i].equals("-c"))
chr = args[++i].trim();
else if(args[i].equals("-b"))
base = Integer.parseInt(args[++i].trim());
else if(args[i].equals("-v"))
vw = args[++i].trim();
else if(args[i].equals("-o"))
orientation = true;
else if(args[i].equals("-pc"))
covPlot = true;
else if(args[i].equals("-ps"))
snpPlot = true;
else if(args[i].startsWith("-h"))
{
System.out.println("-h\t show help");
System.out.println("-a\t BAM/SAM file to display");
System.out.println("-r\t reference file (optional)");
System.out.println("-n\t number of bases to display in the view (optional)");
System.out.println("-c\t chromosome name (optional)");
System.out.println("-v\t view (optional - IS (inferred size), S (stack, default), PS (paired stack), ST (strand), C (coverage))");
System.out.println("-b\t base position (optional)");
System.out.println("-o\t show orientation (optional)");
System.out.println("-pc\t plot coverage (optional)");
System.out.println("-ps\t plot SNP (optional and only with -r)");
final BamView view = new BamView(bam, reference, nbasesInView, null, null,
(JPanel)frame.getContentPane(), frame);
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
if(chr != null)
view.combo.setSelectedItem(chr);
if(vw != null)
{
if(vw.equalsIgnoreCase("IS"))
view.cbIsizeStackView.setSelected(true);
if(vw.equalsIgnoreCase("PS"))
view.cbPairedStackView.setSelected(true);
if(vw.equalsIgnoreCase("ST"))
view.cbStrandStackView.setSelected(true);
if(vw.equalsIgnoreCase("C"))
view.cbCoverageView.setSelected(true);
}
if(base > 0)
view.scrollBar.setValue(base);
if(orientation)
view.isOrientation = true;
if(covPlot)
{
view.isCoverage = true;
view.coveragePanel.setVisible(true);
}
if(snpPlot)
{
view.isSNPplot = true;
view.snpPanel.setVisible(true);
}
// translucent
//frame.getRootPane().putClientProperty("Window.alpha", new Float(0.9f));
/*frame.addWindowFocusListener(new WindowFocusListener()
{
public void windowGainedFocus(WindowEvent e)
{
view.requestFocus();
}
public void windowLostFocus(WindowEvent e){}
view.jspView.getVerticalScrollBar().setValue(
view.jspView.getVerticalScrollBar().getMaximum());