diff --git a/art b/art old mode 100755 new mode 100644 index 87d56c82ffbfb55a1314f7fed2841df7536ddf73..4ff736b49574e9740ad346927906bc326015ea60 --- a/art +++ b/art @@ -89,22 +89,23 @@ SYNOPSIS USAGE $0 [options] <SEQUENCE_FILE> [+FEATURE_FILE ...] OPTIONS - SEQUENCE_FILE An EMBL, GenBank, FASTA, or GFF3 file - FEATURE_FILE An Artemis TAB file, or GFF file - - -quiet Suppress normal info messages while running - -options FILE Read a text file of options from FILE - -debug Run using the debugging JVM instead - -fast | -fast64 Use the FastVM (hp Tru64 UNIX) with 32/64 bit pointers - - -Dblack_belt_mode=? Keep warning messages to a minimum [true,false] - -Doffset=XXX Open viewer at base position XXX [integer >= 1] - -Duserplot=FILE[,FILE2] Open one or more userplots - -Dbam=FILE[,FILE2,...] Open one or more BAM, VCF or BCF files - -Dshow_forward_lines=? Hide/show forward frame lines [true,false] - -Dshow_reverse_lines=? Hide/show reverse frame lines [true,false] - -Dchado="h:p/d?u" Get Artemis to open this CHADO database - -Dread_only Open CHADO database read-only + SEQUENCE_FILE An EMBL, GenBank, FASTA, or GFF3 file + FEATURE_FILE An Artemis TAB file, or GFF file + + -quiet Suppress normal info messages while running + -options FILE Read a text file of options from FILE + -debug Run using the debugging JVM instead + -fast | -fast64 Use the FastVM (hp Tru64 UNIX) with 32/64 bit pointers + + -Dblack_belt_mode=? Keep warning messages to a minimum [true,false] + -Doffset=XXX Open viewer at base position XXX [integer >= 1] + -Duserplot=FILE[,FILE2] Open one or more userplots + -Dloguserplot=FILE[,FILE2] Open one or more userplots, take log(data) + -Dbam=FILE[,FILE2,...] Open one or more BAM, VCF or BCF files + -Dshow_forward_lines=? Hide/show forward frame lines [true,false] + -Dshow_reverse_lines=? Hide/show reverse frame lines [true,false] + -Dchado="h:p/d?u" Get Artemis to open this CHADO database + -Dread_only Open CHADO database read-only EXAMPLES % art AJ006275.embl % art contigs.fa +annotation.gff +islands.tab diff --git a/etc/versions b/etc/versions index 32a28bca9f587e3594e167d398c06e24283c2bbe..f0b938b63103ada57b94ffb17016faa15e94e275 100644 --- a/etc/versions +++ b/etc/versions @@ -1,4 +1,4 @@ -Artemis Release 14.0.16 -ACT Release 11.0.16 +Artemis Release 14.0.17 +ACT Release 11.0.17 DNAPlotter Release 1.7 BamView 1.2.2 diff --git a/uk/ac/sanger/artemis/components/BasePlot.java b/uk/ac/sanger/artemis/components/BasePlot.java index 6503e20eb24d93b920fecaff39e9ac2199cf10a8..9d595b25bd9fb27d6e2bfbc9066dfe5e759880bf 100644 --- a/uk/ac/sanger/artemis/components/BasePlot.java +++ b/uk/ac/sanger/artemis/components/BasePlot.java @@ -985,45 +985,43 @@ public class BasePlot extends Plot if(offset < 1) offset = 0; - final int get_values_return_count = + final int nvalues = getBaseAlgorithm().getValueCount(); int xpos = getPointPosition(event.getPoint().x); - - //getXCoordinate(getWidthInBases(), - // offset, event.getPoint().x); - String tt = Integer.toString(xpos); - NumberFormat df= NumberFormat.getNumberInstance(); + NumberFormat df = NumberFormat.getNumberInstance(); df.setMaximumFractionDigits(2); - float ypos; - for(int value_index = 0; value_index < get_values_return_count; - ++value_index) - { - ypos = getYCoordinate(step_size, getWindowSize(), - offset, value_array_array[value_index], - xpos); - tt = tt + ", " + df.format(ypos); - } - + for(int i = 0; i < nvalues; ++i) + tt += ", " + df.format( + getYCoordinate(step_size, getWindowSize(), + offset, value_array_array[i], xpos)); + if(lines != null) { // if heat map display column number String plotType = lines[0].getPlotType(); if(plotType.equals(LineAttributes.PLOT_TYPES[2])) { - final int graph_height = super.getSize().height - + final int graph_height = getSize().height - getLabelHeight() - getScaleHeight() - 2; - - float hgt = ((float)graph_height/(float)lines.length); + + int hgt = graph_height/value_array_array.length; float mousePos = (float) (event.getPoint().getY()- getLabelHeight() - getScaleHeight() - 2.f ); int plotNumber = Math.round(( mousePos / hgt )+.5f); if(plotNumber < 1) plotNumber = 1; + else if(plotNumber > value_array_array.length) + plotNumber = value_array_array.length; + + if(nvalues > 5) + tt = Integer.toString(xpos)+", "+df.format( + getYCoordinate(step_size, getWindowSize(), + offset, value_array_array[plotNumber-1], xpos)); tt = "Plot number : "+plotNumber+"\n"+tt; } diff --git a/uk/ac/sanger/artemis/components/GraphMenu.java b/uk/ac/sanger/artemis/components/GraphMenu.java index 72b05f3cd27a8fcd01a769e0652b103ffa1e4f40..fde8f89f3d0242698da434a97ee6aa4da720a657 100644 --- a/uk/ac/sanger/artemis/components/GraphMenu.java +++ b/uk/ac/sanger/artemis/components/GraphMenu.java @@ -46,6 +46,7 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.IOException; import java.io.File; +import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.Vector; @@ -170,7 +171,7 @@ public class GraphMenu extends JMenu { try { - addUserPlot (null); + addUserPlot ((uk.ac.sanger.artemis.util.Document)null, false); adjustSplitPane(true); } catch(java.lang.OutOfMemoryError emem) @@ -245,34 +246,24 @@ public class GraphMenu extends JMenu } // add user plots from the command line JVM option - if(System.getProperty("userplot"+ (index > 0 ? index : "")) != null) + if(System.getProperty("userplot"+ (index > 0 ? index : "")) != null || + System.getProperty("loguserplot"+ (index > 0 ? index : "")) != null) { - String plots[] = System.getProperty("userplot"+ (index > 0 ? index : "")).split("[\\s,]"); + String plots[] = new String[]{}; + if(System.getProperty("userplot"+ (index > 0 ? index : "")) != null) + plots = System.getProperty("userplot"+ (index > 0 ? index : "")).split("[\\s,]"); + + String logplots[] = new String[]{}; + if(System.getProperty("loguserplot"+ (index > 0 ? index : "")) != null) + logplots = System.getProperty("loguserplot"+ (index > 0 ? index : "")).split("[\\s,]"); try { for(int i=0;i<plots.length; i++) - { - if(plots[i].startsWith("http:") || - plots[i].startsWith("file:") || - plots[i].startsWith("ftp:")) - { - uk.ac.sanger.artemis.util.Document document = - new uk.ac.sanger.artemis.util.URLDocument (new URL(plots[i])); - addUserPlot (document); - } - else - { - File f = new File(plots[i]); - if(f.exists()) - { - uk.ac.sanger.artemis.util.Document document = - new uk.ac.sanger.artemis.util.FileDocument (f); - addUserPlot (document); - } - else - System.err.println(plots[i]+" not found."); - } - } + addUserPlot (plots[i], false); + + for(int i=0;i<logplots.length; i++) + addUserPlot (logplots[i], true); + splitPane.setDividerSize(3); splitPane.setDividerLocation(150); } @@ -559,12 +550,27 @@ public class GraphMenu extends JMenu return true; } + private void addUserPlot (final String plot, final boolean isLog) throws MalformedURLException + { + if (plot.startsWith("http:") || plot.startsWith("file:") || plot.startsWith("ftp:")) + addUserPlot(new uk.ac.sanger.artemis.util.URLDocument(new URL(plot)), isLog); + else + { + File f = new File(plot); + if (f.exists()) + addUserPlot(new uk.ac.sanger.artemis.util.FileDocument(f), isLog); + else + System.err.println(plot + " not found."); + } + } + /** * Add a UserDataAlgorithm to the display. **/ - private void addUserPlot (uk.ac.sanger.artemis.util.Document document) + private void addUserPlot (uk.ac.sanger.artemis.util.Document document, + boolean isLog) { - final JCheckBox logTransform = new JCheckBox("Use log(data+1)", false); + final JCheckBox logTransform = new JCheckBox("Use log(data+1)", isLog); if (document == null) { final JFrame frame = Utilities.getComponentFrame(base_plot_group); diff --git a/uk/ac/sanger/artemis/components/Plot.java b/uk/ac/sanger/artemis/components/Plot.java index 7a09c5d9c9afdfcfe88395bf300c3a726c1a3fe0..b5a726915d514c500e50e94def7f14827dda16cb 100644 --- a/uk/ac/sanger/artemis/components/Plot.java +++ b/uk/ac/sanger/artemis/components/Plot.java @@ -977,6 +977,10 @@ public abstract class Plot extends JPanel final float min_value, final float max_value) { + // if a heatmap do not show the average + if(lines != null && lines[0].getPlotType().equals(LineAttributes.PLOT_TYPES[2])) + return; + final Float average = getAlgorithm().getAverage(); if(average != null) diff --git a/uk/ac/sanger/artemis/components/PrintArtemis.java b/uk/ac/sanger/artemis/components/PrintArtemis.java index ac1bebf0c133fe90a775b1d5d12e36f78bced6c2..a05c3eef2acf6531a54378c11c069d3419472e13 100644 --- a/uk/ac/sanger/artemis/components/PrintArtemis.java +++ b/uk/ac/sanger/artemis/components/PrintArtemis.java @@ -134,10 +134,12 @@ public class PrintArtemis extends ScrollPanel implements Printable { FeatureList flist = entry.getFeatureList(); Point ploc = flist.getViewport().getViewPosition(); - //flist.setOpaque(false); - g2d.translate(0,-ploc.y); - flist.paintComponent(g2d); - //flist.setOpaque(true); + BufferedImage offScreen = new BufferedImage(flist.getViewport().getWidth(), + flist.getViewport().getHeight(), BufferedImage.TYPE_INT_RGB); + Graphics og = offScreen.getGraphics(); + og.translate(0,-ploc.y); + flist.paintComponent(og); + g2d.drawImage(offScreen, 0, 0, null); } } diff --git a/uk/ac/sanger/artemis/components/ProjectProperty.java b/uk/ac/sanger/artemis/components/ProjectProperty.java index 267094cf0b3bde84dcbe0a3589ead22866427850..d91a7e1985f0fe3727b768fd5ecefcdfe1209ce8 100644 --- a/uk/ac/sanger/artemis/components/ProjectProperty.java +++ b/uk/ac/sanger/artemis/components/ProjectProperty.java @@ -98,11 +98,12 @@ public class ProjectProperty extends JFrame private final static int NEXT_GEN_DATA = 3; private final static int CHADO = 4; private final static int USERPLOT = 5; + private final static int LOGUSERPLOT = 6; private static org.apache.log4j.Logger logger4j = org.apache.log4j.Logger.getLogger(ProjectProperty.class); private final static String[] TYPES = - { "title", "sequence", "annotation", "bam", "vcf", "userplot", "chado" }; + { "title", "sequence", "annotation", "bam", "vcf", "userplot", "log_userplot", "chado" }; public ProjectProperty() { @@ -428,6 +429,8 @@ public class ProjectProperty extends JFrame settings.put(ProjectProperty.CHADO, vText); else if(keyStr.equals("userplot")) settings.put(ProjectProperty.USERPLOT, vText); + else if(keyStr.equals("log_userplot")) + settings.put(ProjectProperty.LOGUSERPLOT, vText); } // ADD property @@ -754,6 +757,8 @@ public class ProjectProperty extends JFrame { System.getProperties().remove("bam"); System.getProperties().remove("chado"); + System.getProperties().remove("userplot"); + System.getProperties().remove("loguserplot"); } catch(Exception e){ e.printStackTrace(); } @@ -793,9 +798,17 @@ public class ProjectProperty extends JFrame userplot += ","+ann.getText().trim(); } if(!userplot.equals("")) - System.setProperty("userplot", userplot.replaceFirst(",", "")); - - + System.setProperty("userplot", userplot.replaceFirst(",", "")); + break; + case ProjectProperty.LOGUSERPLOT: + String loguserplot = ""; + for(JTextField ann: vText) + { + if(ann.isEnabled()) + loguserplot += ","+ann.getText().trim(); + } + if(!loguserplot.equals("")) + System.setProperty("loguserplot", loguserplot.replaceFirst(",", "")); break; case ProjectProperty.CHADO: seenSequence = true; diff --git a/uk/ac/sanger/artemis/components/alignment/AbstractGraphPanel.java b/uk/ac/sanger/artemis/components/alignment/AbstractGraphPanel.java index e8e7f432703f96947584396defa06d959e1c6299..9f651b952c224c2165f1eb87abc1fc3944c29335 100644 --- a/uk/ac/sanger/artemis/components/alignment/AbstractGraphPanel.java +++ b/uk/ac/sanger/artemis/components/alignment/AbstractGraphPanel.java @@ -168,7 +168,7 @@ public class AbstractGraphPanel extends JPanel final int hgt, final Color c) { - if(bamView.getSelection() != null) + if(bamView != null && bamView.getSelection() != null) { final Range selectedRange = bamView.getSelection().getSelectionRange(); if(selectedRange != null) diff --git a/uk/ac/sanger/artemis/components/alignment/BamView.java b/uk/ac/sanger/artemis/components/alignment/BamView.java index 5f394637f873969dc8e786fd45ece5ebde04efc9..891e4387074c127336fc956bb544d7367e35c96d 100644 --- a/uk/ac/sanger/artemis/components/alignment/BamView.java +++ b/uk/ac/sanger/artemis/components/alignment/BamView.java @@ -210,6 +210,7 @@ public class BamView extends JPanel private CoveragePanel coverageView = new CoveragePanel(); + protected static String BAM_SUFFIX = ".*\\.(bam|cram)$"; /** Used to colour the frames. */ private static Color LIGHT_GREY = new Color(200, 200, 200); private static Color DARK_GREEN = new Color(0, 150, 0); @@ -2240,10 +2241,10 @@ public class BamView extends JPanel { FileSelectionDialog bamFileSelection = new FileSelectionDialog( null, false, "BamView", "BAM"); - List<String> bamFiles = bamFileSelection.getFiles(".*\\.(bam|cram)$"); + List<String> bamFiles = bamFileSelection.getFiles(BAM_SUFFIX); int count = bamList.size(); - bamList.addAll(bamFileSelection.getFiles(".*\\.(bam|cram)$")); + bamList.addAll(bamFileSelection.getFiles(BAM_SUFFIX)); for(int i=0; i<bamFiles.size(); i++) addToViewMenu(i+count); @@ -3670,7 +3671,7 @@ public class BamView extends JPanel System.setProperty("default_directory", System.getProperty("user.dir")); FileSelectionDialog fileSelection = new FileSelectionDialog( null, true, "BamView", "BAM"); - bam = fileSelection.getFiles(".*\\.(bam|cram)$"); + bam = fileSelection.getFiles(BAM_SUFFIX); reference = fileSelection.getReferenceFile(); if(reference == null || reference.equals("")) reference = null; diff --git a/uk/ac/sanger/artemis/components/alignment/FileSelectionDialog.java b/uk/ac/sanger/artemis/components/alignment/FileSelectionDialog.java index 1e9d24519c6293a5bab658a2d3e4820e646ac05e..c5944bfff3645faed7bcc9f72b8ae9a2cda94bd5 100644 --- a/uk/ac/sanger/artemis/components/alignment/FileSelectionDialog.java +++ b/uk/ac/sanger/artemis/components/alignment/FileSelectionDialog.java @@ -29,6 +29,7 @@ import javax.swing.JPanel; import javax.swing.JTextField; import uk.ac.sanger.artemis.components.StickyFileChooser; +import uk.ac.sanger.artemis.components.variant.VCFview; /** * File selection panel to allow input of DNA sequences @@ -66,14 +67,14 @@ public class FileSelectionDialog extends JDialog { super(f, program+" :: Select Files", true); - addBamField(fileType); + addBamField(fileType, null); JButton addMoreFiles = new JButton("Add More"); addMoreFiles.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - addBamField(fileType); + addBamField(fileType, null); } }); @@ -90,7 +91,7 @@ public class FileSelectionDialog extends JDialog c.gridy = ++row; dialog.add(referenceField, c); JButton selectReference = new JButton("Select..."); - addActionListener(selectReference, referenceField); + addActionListener(selectReference, referenceField, fileType); c.gridx = 1; dialog.add(selectReference, c); } @@ -120,11 +121,13 @@ public class FileSelectionDialog extends JDialog * Add a text field to the dialog for adding in a path * to a BAM file. */ - private void addBamField(String fileType) + private void addBamField(String fileType, String fileName) { JTextField bamField = new JTextField(30); bamFields.add(bamField); + if(fileName != null) + bamField.setText(fileName); bamField.setPreferredSize( new Dimension(200,bamField.getPreferredSize().height)); c.gridy = row; @@ -135,7 +138,7 @@ public class FileSelectionDialog extends JDialog dialog.add(bamField, c); c.gridx = 1; JButton selectBam = new JButton("Select..."); - addActionListener(selectBam, bamField); + addActionListener(selectBam, bamField, fileType); dialog.add(selectBam, c); pack(); @@ -145,19 +148,51 @@ public class FileSelectionDialog extends JDialog * Add action listener to a button. * @param fileSelectionButton * @param tfield + * @param fileType */ private void addActionListener(final JButton fileSelectionButton, - final JTextField tfield) + final JTextField tfield, + final String fileType) { + final javax.swing.filechooser.FileFilter filter = + new javax.swing.filechooser.FileFilter() + { + public boolean accept(final File file) + { + if(file.isDirectory() || + file.getName().matches(VCFview.VCFFILE_SUFFIX) || + file.getName().matches(BamView.BAM_SUFFIX)) + return true; + return false; + } + + public String getDescription() + { + return "BAM / VCF files"; + } + }; + fileSelectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StickyFileChooser fileChooser = new StickyFileChooser(); + fileChooser.setMultiSelectionEnabled(true); + fileChooser.setFileFilter(filter); + int status = fileChooser.showOpenDialog(null); if(status == StickyFileChooser.CANCEL_OPTION) return; - tfield.setText(fileChooser.getSelectedFile().getAbsolutePath()); + + + File[] files = fileChooser.getSelectedFiles(); + tfield.setText(files[0].getAbsolutePath()); + + if(files.length > 1) + { + for(int i=1; i<files.length; i++) + addBamField(fileType, files[i].getAbsolutePath()); + } } }); } @@ -319,4 +354,5 @@ public class FileSelectionDialog extends JDialog { return referenceField.getText(); } + } \ No newline at end of file