Search in sources :

Example 11 with ProgressDialog

use of uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog in project SeqMonk by s-andrews.

the class SeqMonkApplication method downloadGenome.

/**
 * This method is usually called from data gathered by the genome selector
 * which will provide the required values for the assembly name.  This does
 * not actually load the specified genome, but just downloads it from the
 * online genome repository.
 *
 * @param species Species name
 * @param assembly Assembly name
 * @param size The size of the compressed genome file in bytes
 */
public void downloadGenome(String species, String assembly, int size) {
    GenomeDownloader d = new GenomeDownloader();
    d.addProgressListener(this);
    ProgressDialog pd = new ProgressDialog(this, "Downloading genome...");
    d.addProgressListener(pd);
    d.downloadGenome(species, assembly, size, true);
    pd.requestFocus();
}
Also used : GenomeDownloader(uk.ac.babraham.SeqMonk.Network.GenomeDownloader) ProgressDialog(uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog)

Example 12 with ProgressDialog

use of uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog in project SeqMonk by s-andrews.

the class SeqMonkApplication method saveProject.

/**
 * Saves the current project into the specified file.
 *
 * @param file The file into which the project will be saved
 */
public void saveProject(File file) {
    SeqMonkDataWriter writer = new SeqMonkDataWriter();
    writer.addProgressListener(new ProgressDialog(this, "Saving Project...", writer));
    writer.addProgressListener(this);
    writer.writeData(this, file);
    setTitle("SeqMonk [" + file.getName() + "]");
    SeqMonkPreferences.getInstance().addRecentlyOpenedFile(file.getAbsolutePath());
}
Also used : SeqMonkDataWriter(uk.ac.babraham.SeqMonk.DataWriters.SeqMonkDataWriter) ProgressDialog(uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog)

Example 13 with ProgressDialog

use of uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog in project SeqMonk by s-andrews.

the class SeqMonkApplication method loadProject.

public void loadProject(File file, boolean forceAssembly) {
    if (file == null)
        return;
    if (changesWereMade) {
        int answer = JOptionPane.showOptionDialog(this, "You have made changes which were not saved.  Do you want to save before exiting?", "Save before loading new data?", 0, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Save before Loading", "Load without Saving", "Cancel" }, "Save");
        switch(answer) {
            case 0:
                fileToLoad = file;
                saveProject();
                return;
            case 1:
                break;
            case 2:
                return;
        }
    }
    SeqMonkPreferences.getInstance().setLastUsedSaveLocation(file);
    if (!forceAssembly) {
        wipeAllData();
    }
    currentFile = file;
    SeqMonkParser parser = new SeqMonkParser(this);
    parser.addProgressListener(this);
    ProgressDialog dppd = new ProgressDialog(this, "Loading data...");
    parser.addProgressListener(dppd);
    parser.parseFile(file, forceAssembly);
    dppd.requestFocus();
    setTitle("SeqMonk [" + file.getName() + "]");
    SeqMonkPreferences.getInstance().addRecentlyOpenedFile(file.getAbsolutePath());
}
Also used : ProgressDialog(uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog) SeqMonkParser(uk.ac.babraham.SeqMonk.DataParsers.SeqMonkParser)

Example 14 with ProgressDialog

use of uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog in project SeqMonk by s-andrews.

the class FindFeatureDialog method run.

/* (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
public void run() {
    spd = new ProgressDialog("Searching...", this);
    spd.progressUpdated("Starting Search...", 0, 1);
    makeFeatureList();
}
Also used : ProgressDialog(uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog)

Example 15 with ProgressDialog

use of uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog in project SeqMonk by s-andrews.

the class HeatmapProbeListWindow method actionPerformed.

/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equals("close")) {
        setVisible(false);
        dispose();
    } else if (ae.getActionCommand().equals("save_image")) {
        ImageSaver.saveImage(heatmapPanel);
    } else if (ae.getActionCommand().equals("cluster")) {
        if (clusterButton.getText().equals("Cluster Interactions")) {
            // First we need to make up an interaction cluster matrix which we
            // can then feed to the generic hierarchical clustering program
            InteractionClusterMatrix clusterMatrix = new InteractionClusterMatrix(matrix.filteredInteractions(), matrix.probeCount());
            clusterMatrix.addListener(new ProgressDialog(this, "HiC Interaction Clustering", clusterMatrix));
            clusterMatrix.addListener(this);
            clusterMatrix.startCorrelating();
            clusterButton.setEnabled(false);
        } else {
            matrix.setCluster(null);
            saveClustersButton.setEnabled(false);
            clusterButton.setText("Cluster Interactions");
        }
    } else if (ae.getActionCommand().equals("save_probes")) {
        ProbeList newList = matrix.createProbeListFromCurrentInteractions();
        // Ask for a name for the list
        String groupName = null;
        while (true) {
            groupName = (String) JOptionPane.showInputDialog(this, "Enter list name", "Found " + newList.getAllProbes().length + " probes", JOptionPane.QUESTION_MESSAGE, null, null, newList.name());
            if (groupName == null) {
                // Since the list will automatically have been added to
                // the ProbeList tree we actively need to delete it if
                // they choose to cancel at this point.
                newList.delete();
                // They cancelled
                return;
            }
            if (groupName.length() == 0)
                // Try again
                continue;
            break;
        }
        newList.setName(groupName);
    } else if (ae.getActionCommand().equals("save_clusters")) {
        if (matrix.cluster() == null)
            return;
        // Get a limit for how many probes per cluster
        String howManyProbes = JOptionPane.showInputDialog(this, "Minimum number of probes per cluster", "10");
        if (howManyProbes == null)
            return;
        int minProbes;
        try {
            minProbes = Integer.parseInt(howManyProbes);
        } catch (NumberFormatException nfe) {
            JOptionPane.showMessageDialog(this, howManyProbes + " was not an integer", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        ProbeList newList = matrix.createProbeListsFromClusters(minProbes, heatmapPanel.probeListPanel().currentYStartIndex(), heatmapPanel.probeListPanel().currentYEndIndex());
        // This was called before clustering had completed.
        if (newList == null)
            return;
        // Ask for a name for the list
        String groupName = null;
        while (true) {
            groupName = (String) JOptionPane.showInputDialog(this, "Enter list name", "Found " + newList.getAllProbes().length + " probes", JOptionPane.QUESTION_MESSAGE, null, null, newList.name());
            if (groupName == null) {
                // Since the list will automatically have been added to
                // the ProbeList tree we actively need to delete it if
                // they choose to cancel at this point.
                newList.delete();
                // They cancelled
                return;
            }
            if (groupName.length() == 0)
                // Try again
                continue;
            break;
        }
        newList.setName(groupName);
    } else if (ae.getActionCommand().equals("make_report")) {
        new InteractionReportOptions(SeqMonkApplication.getInstance(), new AnnotatedInteractionReport(SeqMonkApplication.getInstance().dataCollection(), matrix));
    }
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) InteractionClusterMatrix(uk.ac.babraham.SeqMonk.DataTypes.Interaction.InteractionClusterMatrix) InteractionReportOptions(uk.ac.babraham.SeqMonk.Displays.Report.InteractionReport.InteractionReportOptions) ProgressDialog(uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog) AnnotatedInteractionReport(uk.ac.babraham.SeqMonk.Reports.Interaction.AnnotatedInteractionReport)

Aggregations

ProgressDialog (uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog)19 File (java.io.File)5 JFileChooser (javax.swing.JFileChooser)5 BorderLayout (java.awt.BorderLayout)4 JButton (javax.swing.JButton)4 JPanel (javax.swing.JPanel)4 InteractionClusterMatrix (uk.ac.babraham.SeqMonk.DataTypes.Interaction.InteractionClusterMatrix)4 FileFilter (javax.swing.filechooser.FileFilter)3 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 PrintWriter (java.io.PrintWriter)2 JSlider (javax.swing.JSlider)2 GenomeParser (uk.ac.babraham.SeqMonk.AnnotationParsers.GenomeParser)2 HierarchicalClusterSet (uk.ac.babraham.SeqMonk.DataTypes.Cluster.HierarchicalClusterSet)2 Chromosome (uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome)2 ProbeList (uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList)2 InteractionReportOptions (uk.ac.babraham.SeqMonk.Displays.Report.InteractionReport.InteractionReportOptions)2 GenomeDownloader (uk.ac.babraham.SeqMonk.Network.GenomeDownloader)2 AnnotatedInteractionReport (uk.ac.babraham.SeqMonk.Reports.Interaction.AnnotatedInteractionReport)2 SeqMonkException (uk.ac.babraham.SeqMonk.SeqMonkException)2